How to get a return value from a vbs file?

SparkOut SparkOutYNY at gmail.com
Fri Sep 25 03:21:19 EDT 2009




Tiemo Hollmann TB wrote:
> 
> Hello,
> 
> following Jim B's advice I want to change the user rights of my program
> (-sub) dir to be able to write a file with rev to that dir. Creating the
> dir
> at setup with the correct rights s one thing. Now I want to change the
> rights with icacls at an existing dir.
> 
> When calling icacls from rev directly in the shell I get a return value
> from
> icacls, but a standard user may not change the priviliges. But as far as I
> know, I can't give a parameter "runas" (Admin) to the shell. So I decided
> to
> create a small vbs file (without actually knowing vbs), where I could run
> the vbs file with "runas" to be able to change the rights of the program
> sub
> dir.
> 
> Where I now stuck is, that I don't know how to get back any return value
> from the vbs script file back into my rev, e.g the result of calling
> icacls.
> I can't just say "return" in vbs.
> 
> Any hint very welcome (Rev 3.5, Vista)
> 
> Tiemo
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 
If you are using "do <theScript> as vbscript" from RunRev, then in the
vbscript just make sure that you set a variable named "result" and that
value will be returned to RunRev in, um, the result.
If you are using shell to kick off a script externally, such as :
get shell("cscript.exe //nologo" && quote & tVBSfile & quote)
then the data that is returned to the console window by the vbscript is what
you will "get" in the "it" variable in RunRev. 
The //nologo switches suppress the usual MS text that would normally appear
in the console. So that you don't get the console actually displayed on
screen, "set the hideConsoleWindows to true" before calling the script.
Finally, to get the data to return into the console in the first place
(whether hidden or not) in the vbscript, then put the return value into a
variable (for convenience/coherence in this case) called "result" and use:
WScript.Echo result

-- 
View this message in context: http://www.nabble.com/How-to-get-a-return-value-from-a-vbs-file--tp25595048p25607565.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list