running WSF

Ken Ray kray at sonsothunder.com
Wed May 14 02:07:01 EDT 2003


Richard,

First of all, you need to just have two lines of your code in a .vbs
file, and then use shell() to run the file as you might with any other
file. So I created a doc on my desktop called "test.vbs" with this code
in it:

  set WshShell = WScript.CreateObject("WScript.Shell")
  WshShell.AppActivate "Calculator"

(BTW: Note that you didn't have closing quote and paren on the 'set
WshShell' line in your code below.)

Then, from MC, I have this:

on mouseUp
  set the hideConsoleWindows to true
  get shell("cd C:\Documents and Settings\Ken Ray\Desktop & start
test.vbs")
end mouseUp

.. and voila!

Keep in mind that WSH isn't supported on older Windows versions, and you
need to know the name of the app you want to activate using the code
above, but it *does* work!

Have fun,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 

> -----Original Message-----
> From: metacard-admin at lists.runrev.com 
> [mailto:metacard-admin at lists.runrev.com] On Behalf Of Richard Gaskin
> Sent: Tuesday, May 13, 2003 9:08 PM
> To: MetaCard List
> Subject: running WSF
> 
> 
> Nearly completely ignorant about Windows Scripting Host, 
> after poking around on the 'Net I fpound that I can put this 
> into a .wsf file and use launch to activate a given process 
> (bring it to the front):
> 
> <package>
>    <job id="vbs">
>       <script language="VBScript">
>          set WshShell = WScript.CreateObject("WScript.Shell
>          WshShell.AppActivate "Calculator"
>       </script>
>    </job>
> </package>
> 
> 
> Is there any way I could run that directly, such as with the 
> shell function? I've tried setting the shellcommand to 
> wscript.exe to no avail.
> 
> Thanks in advance -
> 
> -- 
>  Richard Gaskin 
>  Fourth World Media Corporation
>  Developer of WebMerge 2.2: Publish any database on any site  
> ___________________________________________________________
>  Ambassador at FourthWorld.com       http://www.FourthWorld.com
>  Tel: 323-225-3717                       AIM: FourthWorldInc
> 
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/metac> ard
> 





More information about the metacard mailing list