I would like to use CREATEFILE multiple times in an action

(imported topic written by amagewick91)

I have a task that I am current writing, and in part of that task I would like to create multiple VBS files within the action and then run them based on what member group the client is in. I would like to know how to properly create, move, run and delete them in the action.

Here is one example of a VBS file. Each file name and “shell.run” line will be a little different.

intAnswer = Msgbox("Message", vbOKCancel)
 
If intAnswer = vbOK Then
    dim shell
    set shell=createobject("wscript.shell")
    shell.run "\\domain\netlogon\SAPINSTALL_61.vbs"
    set shell=nothing
Else
End If

How can this be done?

Thanks!

(imported comment written by SystemAdmin)

This is how I do it…

//------------------------------------------------------------------------
delete __createfile
createfile until endoffile
 
intAnswer = Msgbox("Message", vbOKCancel)
If intAnswer = vbOK Then
dim shell
set shell=createobject("wscript.shell")
shell.run "\\domain\netlogon\SAPINSTALL_61.vbs"
set shell=nothing
Else
End If
 
endoffile
dos move __createfile __Download\INSTALL1.vbs
dos cmd.exe /c __Download\INSTALL1.vbs
 
//------------------------------------------------------------------------
 
delete __createfile
createfile until endoffile
 
//... next vbs file
 
 
endoffile
dos move __createfile __Download\INSTALL2.vbs
dos cmd.exe /c __Download\INSTALL2.vbs
//------------------------------------------------------------------------

the issue with running a file off of a unc share is that you running as local system and there may be auth issues

(imported comment written by amagewick91)

Yes true as far as the UNC goes. I have another version of this action that I am calling from another unc path and it is working fine, so I believe that share will be accessable and will be the one I use. Thank you for your help, I will try this and see what happens.

(imported comment written by SystemAdmin)

Other wise just create the SAPINSTALL_61.vbs instead of creating the files that calls it

(imported comment written by amagewick91)

I get 2 dos boxes, one for the move and one for the calling of the vbs. Is there a way to hide the move command? I switched the vbs calling line to WAITHIDDEN CSCRIPT.EXE __Download\File.vbs and it works.

(imported comment written by SystemAdmin)

You can also use the internal move command

delete __createfile
createfile until endoffile
 
intAnswer = Msgbox("Message", vbOKCancel)
If intAnswer = vbOK Then
dim shell
set shell=createobject("wscript.shell")
shell.run "\\domain\netlogon\SAPINSTALL_61.vbs"
set shell=nothing
Else
End If
 
endoffile
move  __createfile __Download\INSTALL1.vbs
waithidden cmd.exe /c __Download\INSTALL1.vbs

(imported comment written by amagewick91)

Failed move __createfile __Download\SAP00.vbs

(imported comment written by SystemAdmin)

The file already exists ?

put this at the top of your script…

delete __Download\SAP00.vbs

Moves the source file to the named destination file. This command also gives the action author the ability to rename a file. An action script with the move command terminates if the destination already exists, if the source file doesn’t exist, or if the move fails for any other reason.
 
Syntax
 
move <Source_FileName> <Destination_FileName>