Page 1 of 1
Launching .bat problem
Posted: Thu May 21, 2009 3:03 am
by bidgeeman
Hello again.
I am having intermittent trouble with launching a .bat file from a standalone exe created in Runrev. It's strange as most time the bat file will launch but sometimes not correctly as it does not perform it's fnction and has to be double clicked via mouse to launch it properly. I am using this code:
on mouseUp
rename file "C:\data2.txt" to "C:\merge.bat"
set the hideConsoleWindows to true
launch "C:\merge.bat"
end mouseUp
Is there anything I am missing?
ny help would much appreciated please.
Bidge
Posted: Thu May 21, 2009 7:12 am
by Janschenkel
While testing, you may want to set the
hideConsoleWindows to false to see if this offers any clue about the failure. Does it make a difference if you replace the launch command with a call to the
shell function?
Code: Select all
on mouseUp
rename file "C:\data2.txt" to "C:\merge.bat"
set the hideConsoleWindows to false -- true
get shell("C:\merge.bat")
if it is not empty then answer it
end mouseUp
Jan Schenkel.
Posted: Thu May 21, 2009 7:15 am
by larryh
Hi Bidge,
You might want to try using the shell function instead of launch and output the results to the msg box so that you can see what errors might be happening:
on mouseUp
rename file "C:\data2.txt" to "C:\merge.bat"
put "C:\merge.bat" into tBatchCommand
put shell(tBatchCommand) into msg
-- or use: get shell(tBatchCommand)
-- to run merge.bat without output to msg
end mouseUp
Larry
Posted: Thu May 21, 2009 7:18 am
by bidgeeman
Thaks for the reply Janschenkel.
I'll give that a shot and see if it works any better. I don't know why it is'nt working sometimes but not others though? I'll let you know the results.
EDIT: oh...and thanks too larryh. Just missed your post as I replied to Janschenkel.
Many thanks
Bidge
Posted: Thu May 21, 2009 9:21 am
by bidgeeman
Hi Janschenkel and larryh.
Thank you both for your suggestions and to Janschenkel for the code.
It works perfectly everytime!!! I would really like to know why the launch command does not work properly though. Maybe it is a bit buggy when it comes to .bat files?
Thank you both again very much.
Cheers
Bidge
Posted: Fri May 22, 2009 1:54 am
by bidgeeman
Hi.
I'm having troubleexecuting the bat file fro windows shel. It worked fine when it was placed in the C: dirctory but now I want it to run from
C:\\Program Files\mp3tool
For some reson the shell is not executing the bat file? I've tried a number of combinations of backslashes but still won't work. Anyone know what i'm missing here?
Many thanks again.
Bidge
Posted: Sat May 23, 2009 12:33 pm
by alemrantareq
Hi Bidge,
You may try it with "specialFolderPath" function. For example, you have a batch file named "Test.bat" which is located in "C:\Program Files\mp3tool" directory. Now you can apply the following code to run that batch file:
Code: Select all
on mouseUp
put specialfolderpath(38) & "/mp3tool/Test.bat" into tfile
launch document tfile
end mouseUp
I've tested this code with Revolution Studio 2.8.1 and it works prefect.
Here, "38" is the code of "Program Files" directory. To know more about "specialFolderPath" codes, click below:
http://www.sonsothunder.com/devres/revo ... ile010.htm
Hope it might be helpful.
Posted: Sat May 23, 2009 12:39 pm
by bidgeeman
Wow...Thanks alemrantareq!
That is very helpfull.
Thank you!!!
Bidge