You are here: PSPad forum > English discussion forum > getting started in Scripting
Posted by: djehres | Date: 06/12/2012 19:44 | IP: IP Logged
Can somebody point me in the right direction?
I am trying to learn scripting in PsPad and having trouble getting started.
I am using Windows 7 and have WSH enabled.
I have a file under the PsPad => Script => VBScript directory
Called hello0.vbs
When I click on it it displays “Windows Scripting Host” dialog box with the text “hello world.”.
I want to be able to edit files with Find and Replace for strings.
I am using VBScript ( anything better ? ) can somebody give me directions to get enabled?
Something like:
1. Here is a file put it under this dir
2. Go to the Menu Script(?) or Edit (?)
3. Execute the script from the menu
Any help will be appreciated.
Thanks.
Posted by: pspad | Date: 06/12/2012 20:54 | IP: IP Logged
If you downloaded full version, in the subfolder Script you have file Readme.TXT with script syntax and examples
In subfolders with script languages are some script files - you can talke it as example
In PSPad web page / extensions you have many scripts for doenload.
All scripts will appear in menu Script in PSpad.
Go to Program settings / System and ensure that scripting support is enabled.
Posted by: djehres | Date: 06/12/2012 21:30 | IP: IP Logged
thanks.
When I set check the scripting support Check box I get this:
Microsoft VBScript runtime error
Line:2 Pos:1
Description:Object doesn’t support this property or method: ‘WScript.Arguments’
When I double click on the *.vbs file they work.
How do I get a Script Menu on the toolbar?
Which is easier to do VBScript or JScript (Java Script?) ?
thanks.
Posted by: vbr | Date: 06/13/2012 01:33 | IP: IP Logged
djehres:thanks.When I set check the scripting support Check box I get this:
Microsoft VBScript runtime error
Line:2 Pos:1
Description:Object doesn’t support this property or method: ‘WScript.Arguments’When I double click on the *.vbs file they work.
How do I get a Script Menu on the toolbar?
Which is easier to do VBScript or JScript (Java Script?) ?
thanks.
Hi,
from the above message it seems, that WSH is working in your PSPad installation, but there seems to be an error in your script source.
Within PSPad you can only use scripts written for it specifically, the menu items in "Scripts" are created in the Init function of the script.
The reference for the supported functions can be found in the rtf file:
...\PSPad\Script\ReadMe.rtf
I don't use vbscript myself for PSPad scripting (but rather javascript), but the usage is fairly similar.
You can have a look at a simple script I posted in some previous thread:
There are also some simple scripts in the full PSPad installation - including vbscript - in the respective subfolders
...\PSPad\Script\
(If you actually wanted to use standalone programs or runable scripts arguments rather than PSPad-internal scripts, you can assign them in the Tools panel (Ctrl+F2) in the Favourites (usually under the tab with "heart" icon).
hth,
vbr
Posted by: nergmlam | Date: 06/13/2012 08:51 | IP: IP Logged
Hi
PsPad works 100% perfect with vbScript, I'm using it on my work at Slagelse Municipality in Denmark, making install scripts to our CapaSystems management, that makes installations to our 3.500 computers 
So don't worry, just use the needed time to learn it, and if you need to study vbScript (or other scripting languanes) more, maybe pay a visit to:
--
Sincerely
J. Malmgren
IT-Programmer
Denmark
Version 4.5.7(2441)
Posted by: Stefan | Date: 06/13/2012 18:32 | IP: IP Logged
"WScript." is an property of the WSH (Windows Scripting Host)
It is available if we run an script with wscript.exe or cscript.exe.
For example via WinExplorer or from the command line. (DOS-Box)
But with PSPad we use PSPad as "Host".
So there is no WScript. available.
(The same with InternetExplorer by the way.
It's an own host too)
I think, "WScript.arguments" makes no sense
anyway inside an PSPad script.
Use InputBox() to get arguments from the user.
--
greets, Stefan
(pleased user since 1722)
inofficial FAQs + Infos + Special Settings
Edited 1 time(s). Last edit at 06/13/2012 19:18 by Stefan.
Posted by: nergmlam | Date: 06/14/2012 09:17 | IP: IP Logged
Hi
Actually you can use both "wScript.arguments" and InputBox(), when you write vbScripts using PsPad.
Both of them works, when your final .vbs file is run by the user with cScript.exe or wScript.exe, which (.vbs) normally is associated in Explorer.exe, so the user can just doubleclick it, or leftclick it to decide in Explorer.exe's context menu to run it with either cScript.exe or wScript.exe, and the difference is that cScript.exe is the "command-line" version, and wScript.exe is the "Windows" version.
The purpose of "wScript.arguments" is to make it possible for the user to decide before running your vbScript, which one of your arguments to use, it could e.g. be silent arguments or something else you want to customize for your users. If the user wants to use one of your arguments, they normally needs to make a .cmd file (there are other options), and it could be using your -silent argument:
Quote:@Echo off
CLS
C:\<YourScriptFile.vbs> -silent
Exit
So you need to "catch" the "wScript.arguments" inside your vbScript, and decide inside your vbScript what to do with e.g. -silent.
The purpose of InputBox() is to make it possible for you to ask the user while running your vbScript, about something you want to customize for your users. So you need to decide inside your vbScript what to do with the users input.
--
Sincerely
J. Malmgren
IT-Programmer
Denmark
Version 4.5.7(2441)
Editor PSPad - freeware editor, © 2001 - 2013 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák