Launching .bat problem
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Launching .bat problem
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
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
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
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?
Jan Schenkel.
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
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
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
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
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
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
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
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
-
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
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:
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.
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
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.