ReDFlaG Posted January 15, 2006 Share Posted January 15, 2006 Hi, i've almost finished a GUI for a dos32 appz and i've found a bug in my code. $path='"'&$path&'"' $temp='' $foo = Run("app.exe /param1="&$num&" /param2="&$path, "", @SW_HIDE, 7) it's working with path that does not contain space. but if path looks like "c:\program files\test.sav" then it hangs complaining that it can't find the specified files (Unable to execute the external program). I've tried to add the " using $path=' " ' &$path& ' " ' but doesn't work. Can someone help? thanks! Link to comment Share on other sites More sharing options...
Laine Posted January 15, 2006 Share Posted January 15, 2006 Dos chokes on spaces. It interprets the space as end of path and all that follows as additional parameters. You'll notice in shortcuts the path is enclosed in quotes and interpreted correctly. I'd experiment with creating a shortcut and manipulating that instead. I'd have to research whether it is com spec or rundll or what you use to launch a shortcut. Link to comment Share on other sites More sharing options...
ReDFlaG Posted January 15, 2006 Author Share Posted January 15, 2006 (edited) Right, it's space that make it hangs, that's why i've added quote at the begining and at the end of my $path var, but even with that it hangs. When i check into a msgbox, the syntax is correct! When i run it into a dos box to verify it's ok. But when i use autoit run command it hangs. strange. PS i could use FileGetShortName but i don't think it's a good idea since the user may have multiple directories begining with the same name Edited January 15, 2006 by ReDFlaG Link to comment Share on other sites More sharing options...
Laine Posted January 15, 2006 Share Posted January 15, 2006 Another avenue that I myself will have to explore shortly. It will work if you can use the 8.3 format. Thus c:\progra~1\test.sav I need to find an efficient way to collect the short file paths . Link to comment Share on other sites More sharing options...
Laine Posted January 15, 2006 Share Posted January 15, 2006 Just saw your edit. I'll have to remember FileGetShortName. I don't understand "multiple directories begining with the same name" problem since there is only 1 finite path to a particular file. I'm not familiar with your interface but I assume you envision a problem there. Perhaps an array of long and short paths would solve the problem Link to comment Share on other sites More sharing options...
ReDFlaG Posted January 15, 2006 Author Share Posted January 15, 2006 program files toto program files tutu program files titi will give progra~1 progra~2 progra~3 I'm afraid that this will be much more confusing for the end user of my GUI. And anyway i don't want to use 8.3 names since i'm afraid of issues that can "comes" with it. On top of that i really don't understand why my code is not working even when i add the quote to my path. PS sorry if it's not very clear, my english is quite rusty and it's not my native language. Link to comment Share on other sites More sharing options...
ChrisL Posted January 15, 2006 Share Posted January 15, 2006 I'm afraid that this will be much more confusing for the end user of my GUI. And anyway i don't want to use 8.3 names since i'm afraid of issues that can "comes" with it.Why will it be more confusing for the user and why will it cause problems? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ReDFlaG Posted January 15, 2006 Author Share Posted January 15, 2006 (edited) it can cause problem if 8.3 support is disable on (in? for?) a system for example more confusing.. well "program files" is more clear than progra~1. All user are not aware of this kind of "spelling" And like i was saying, anyway (forget confusing stuff, forget issue) why is not my code working even when adding ""? Edited January 15, 2006 by ReDFlaG Link to comment Share on other sites More sharing options...
ChrisL Posted January 15, 2006 Share Posted January 15, 2006 well "program files" is more clear than progra~1.the user can still put in "program files" or browse to it and you can then get the shortname purely for your run command.Have you tried using Run (@Comspec etc....) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ReDFlaG Posted January 15, 2006 Author Share Posted January 15, 2006 tryed @comspec without success. i've made a filesavedialog box so that user browse, and that's the way i got the full path and the name of the file ex: $path=c:\program files\test.dat i'll then have to add more code to split the string into $path to then convert it to 8.3 have you an idea why the code is not working even with ""? Link to comment Share on other sites More sharing options...
ChrisL Posted January 15, 2006 Share Posted January 15, 2006 (edited) tryed @comspec without success.i've made a filesavedialog box so that user browse, and that's the way i got the full path and the name of the file ex: $path=c:\program files\test.dati'll then have to add more code to split the string into $path to then convert it to 8.3have you an idea why the code is not working even with ""?You've tried $path = """c:\program files\test.sav""" yes?What about using single ' quotes at the begining and end and double " to specify a path$path = '"c:\program files\test.sav"'Run ('app.exe /param1='&$num&' /param2='&$path,"")and also have you specified the run command with specifying the working directory Edited January 15, 2006 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Stumpii Posted January 15, 2006 Share Posted January 15, 2006 Have you made sure that the string you want to put together works in a command window? I always make sure it works in the cmd window first, then when I convert to code, it is easier to debug. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
ReDFlaG Posted January 15, 2006 Author Share Posted January 15, 2006 (edited) i've tried so much things... here are some that do not work Run ('app.exe /param1='&$num&' /param2='&$path,"") Run ("app.exe /param1="&$num&" /param2="&$path,"") Run(@ComSpec & " /c " & '.\app.exe /param1='&$num&' /param2="'&$path&'"', "", @SW_HIDE,7) $path='"'&$path&'"' $foo = Run(@ComSpec & " /c " & '.\app.exe /param1='&$num&' /param2='&$path, "", @SW_HIDE,7) in a message box i output the syntax and it is correct!!!! (msgbox says: app.exe /param1=12 /param2="c:\program files\temp\test.dat") with no space in the path it works! and of course i've tested the syntax in a pure dos box, typing it myself, and it works. (with space or whithout space in path) that's why i'm getting mad... i really have tried so much things. i do not understand!!! Edited January 15, 2006 by ReDFlaG Link to comment Share on other sites More sharing options...
Stumpii Posted January 15, 2006 Share Posted January 15, 2006 I remember having this problem with a dos program. In a dos box it worked, but in script it did not (with the exact same text). I could not find anyway around it, or why it did it. I eventually had the program write the command to a .bat file and executed the .bat file and it worked. It was not pretty, but it was the only way I could get it to work. Might be worth trying. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
ReDFlaG Posted January 16, 2006 Author Share Posted January 16, 2006 (edited) I FOUND IT!!!!! here is the working code $path='"'&$path&'"' $foo = Run(@ScriptDir &'\app.exe /param1='&$num&' /param2='&$path, '', @SW_HIDE, 7) Edited January 16, 2006 by ReDFlaG Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now