The Windows Scripting Host - dFPUG-Portal
The Windows Scripting Host - dFPUG-Portal
The Windows Scripting Host - dFPUG-Portal
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Print Article<br />
Arguments Parameters to a shortcut object<br />
Description A description of a shortcut object<br />
Hotkey <strong>The</strong> hot key of a shortcut object<br />
IconLocation <strong>The</strong> icon location of a shortcut object<br />
TargetPath <strong>The</strong> target path of a shortcut object<br />
WindowStyle <strong>The</strong> window style of a shortcut object<br />
WorkingDirectory <strong>The</strong> working directory of a shortcut object<br />
<strong>The</strong> WSHShortcut object only has one method -- Save() -- which saves the shortcut object to the file system.<br />
ExpandEnvironmentSettings (strString)<br />
This method expands a process environment variable and returns the result. A typical environment variable is WINDIR. <strong>The</strong><br />
following code illustrates how this method works:<br />
Fullpath = WSHShell.ExpandEnvironmentStrings ;<br />
("%windir%\notepad.exe, 0")<br />
Popup (strText, [natSecondsToWait], [strTitle], [natType])<br />
This method displays the Window MessageBox. Unlike the existing MessageBox function, the Popup method accepts an<br />
optional argument to clear the dialog box after a specified amount of time. <strong>The</strong> following line of code illustrates how the Popup<br />
method works:<br />
WSHShell.Popup("Message",1,"Title",64)<br />
Run(strCommand, [intWindowStyle], [blnWaitOnReturn])<br />
<strong>The</strong> Run method creates a new process that executes a specified command with a specified window style. In addition to being<br />
able to specify the command and the window style, a third parameter can be used to determine whether script execution<br />
should pause until the new process has terminated.<br />
Applications windows can be started in several states. <strong>The</strong> following outlines the various options available:<br />
SW_HIDE 0<br />
SW_MINIMIZE 6<br />
SW_RESTORE 9<br />
SW_SHOW 5<br />
SW_SHOWMAXIMIZED 3<br />
SW_SHOWMINIMIZED 2<br />
SW_SHOWMINNOACTIVE 7<br />
SW_SHOWNA 8<br />
SW_SHOWNOACTIVATE 4<br />
SW_SHOWNORMAL 1<br />
<strong>The</strong> following code starts Notepad with a normal window:<br />
WSHshell.Run("notepad",1)<br />
<strong>The</strong> following code starts Notepad with a maximized window. In addition, the user must close Notepad before control will<br />
return to VFP:<br />
WSHshell.Run("notepad",3,.T.)<br />
Fully qualified paths can be used to denote a file to execute. <strong>The</strong> following code starts Visio:<br />
WSHshell.Run("D:\VISIO\VISIO32.EXE")<br />
Also, script files can be executed with the Run method as well:<br />
WSHshell.Run("hello world.vbs")<br />
WSHshell.Run("hello world.js")<br />
Network object properties and methods<br />
ComputerName<br />
This property denotes the name of the computer:<br />
ComputerName = WSHNetwork.ComputerName<br />
UserDomain<br />
http://foxtalknewsletter.com/ME2/Audiences/Segments/Publications/Print.asp?Module=...<br />
Seite 4 von 6<br />
31.01.06