Moving a rev stack to the foreground

Ken Ray kray at sonsothunder.com
Sun Nov 23 16:13:26 EST 2008



> For Windows, here is a possible solution:
> <http://runrev.info/Activate%20Application.htm>

Thanks for posting that, Mark... it's been a long time since I wrote that
code, and since we can now call VBScript directly without having to use the
shell , I just wanted to bring up a couple of things:

1) We *can't* use the new "do <script> as `VBScript`" for activating an
application because it requires WScript, and WScript doesn't exist inside
Revolution (see the online docs), so you *do* have to create a file and
execute it, AFAIK.

2) I've run into installations where the user's $PATH environment variable
wasn't set to point to %SystemRoot%\%System32%, so attempts to call
"cscript.exe" failed. In this case, it's better to use a full path by
substituting: 

        specialFolderPath(37) & "/cscript.exe"

instead of just "cscript.exe".

3) The code suggests writing a file to "C:\vbs_temp.vbs" to hold the script,
but there are some instances where I've discovered installations where you
weren't allowed to write to the root of C either due to permissions or
antivirus/antispyware apps. So you should pick a place that should be able
to be written to, like the user's Documents folder
(specialFolderPath("documents")) or the system's Temp folder
(specialFolderPath("temporary")).

4) Finally, keep in mind that unlike on Mac, where you can activate the
application "TextEdit", on Windows you need to either pass a process ID or
provide the *title of the window* (like "Untitled - Notepad") for it to
activate.

Just my 2 cents,

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





More information about the use-livecode mailing list