kaotkbliss Posted December 4, 2009 Posted December 4, 2009 I'm creating a gui (my first) that as of right now will open a file in excel. However, if there is a space in the path name, excel thinks it is a new file. Example "C:\Documents and settings" would come out as "C:\Documents.xls" "and.xls" and "setting.xls" GUICreate("AFIB Strip Search",250,60) $path_input=GUICtrlCreateInput("enter path",10,3,200,20) $browse_button=GUICtrlCreateButton ("...",210,0) $go_button=GUICtrlCreateButton("GO",150,30,40,25) $exit_button=GUICtrlCreateButton("Exit",50,30,40,25) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $go_button Then $path = GUICtrlRead($path_input) Run("C:\Program Files\Microsoft Office\Office10\EXCEL.EXE "&$path) ElseIf $msg = $browse_button Then $browse = FileOpenDialog("Open","C:\","(*.dbf)",1) GUICtrlDelete($path_input) $path_input=GUICtrlCreateInput($browse,10,3,200,20) ElseIf $msg = $exit_button Then Exit(1) EndIf WEnd this is the beginning of a much larger program and I am already stuck. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
wraithdu Posted December 4, 2009 Posted December 4, 2009 Umm, have you tried quoting the target file path? Run('"C:\Program Files\Microsoft Office\Office10\EXCEL.EXE" "' & $path & '"')
kaotkbliss Posted December 4, 2009 Author Posted December 4, 2009 thank you, that worked. I did not try that because in other scripts I have written the spaces didn't affect the open file procedure. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
wraithdu Posted December 4, 2009 Posted December 4, 2009 That is entirely dependent on the program to which you are feeding the command line. Don't make assumptions. A good rule of thumb is to quote the path to the executable you are running, and quote any paths or parameters that have spaces in them (ie a single parameter that has a space, like the name of a service passed to sc.exe that has a space in it).
DarkBoost Posted December 4, 2009 Posted December 4, 2009 Another way would be to use Short Path+Names 8.3 Run(FileGetShortName("C:\Program Files\Microsoft Office\Office10\EXCEL.EXE") & " " & $path) ;will result c:\progra~1\micros~1\... etc.
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