Jump to content

Recommended Posts

Posted

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 game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Posted

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).

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...