botanic Posted February 19, 2008 Share Posted February 19, 2008 So for some reason the Run command wont open the program when i tell it to.... Yes there is an exe at that location and yes it does work when i normal click on it. No im not on Vista. I included the ini in the attachment expandcollapse popup#include <C:\Program Files\AutoIt3\Include\GUIConstants.au3> #include <C:\Program Files\AutoIt3\Include\GuiComboBoxEx.au3> #include <C:\Program Files\AutoIt3\Include\GuiImageList.au3> #Include <C:\Program Files\AutoIt3\Include\String.au3> #Include <C:\Program Files\AutoIt3\Include\WinAPI.au3> global $1, $call, $ini, $file, $hGUI, $tmp, $iIndex $file = "C:\Documents and Settings\Matthew\My Documents\My Games\Gamelist.ini" func _run() Local $hGUI, $hImage, $hCombo, $tmm $tmp = "" ; Create GUI $hGUI = GUICreate("Games", 400, 130) $b1 = GUICtrlCreateButton("Run Game",5,103) $b2 = GUICtrlCreateButton("Add/Edit Game",70,103) $b3 = GUICtrlCreateButton("Remove Game",155, 103) $hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER)) GUISetState() $ini = IniReadSectionNames($file) if $ini <> @error then For $1 = 1 to $ini[0] _GUICtrlComboBoxex_AddString ($hCombo, $ini[$1]) Next EndIf While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $b1 $tmp = _GUICtrlComboBoxEx_GetCurSel($hCombo) $tmp = IniRead($file, $ini[$tmp+1], "Path","") Run($tmp) Exit Case $msg = $b2 $tmp = _GUICtrlComboBoxEx_GetCurSel($hCombo) $ini = IniReadSectionNames($file) if $ini <> @error then $tmp = IniRead($file, $ini[$tmp+1], "Path","") Else $tmp = "" EndIf GUIDelete($hGUI) _add($tmp) Case $msg = $b3 $tmp = _GUICtrlComboBoxEx_GetCurSel($hCombo) IniWriteSection($file, $ini[$tmp+1], "") IniDelete($file, $ini[$tmp+1]) GUIDelete($hGUI) _run() EndSelect Wend EndFunc func _choose($xxxxc) if $xxxxc = "" Then $var = FileOpenDialog("Browse for the EXE", @DesktopDir, "Executable (*.exe)", 1 ) if @error Then Else $tmp = StringSplit(_StringReverse(StringTrimRight(FileGetLongName($var,1),4)),"\") $tmp = InputBox("Game Name", "Please type the game name", _StringReverse($tmp[1])) IniWrite($file,$tmp,"Path", $var) EndIf Else $var = FileOpenDialog("Browse for the EXE", $xxxxc, "Executable (*.exe)", 1 ) if @error Then Else $tmp = StringSplit(_StringReverse(StringTrimRight(FileGetLongName($var,1),4)),"\") $tmp = InputBox("Game Name", "Please type the game name", _StringReverse($tmp[1])) IniWrite($file,$tmp,"Path", $var) IniWriteSection($file, $ini[$tmp+1], "") IniDelete($file, $ini[$tmp+1]) EndIf EndIf _run() EndFunc func _add($tmp) local $file2, $tpm, $tmpp, $xxxxc, $ink , $ico $xxxc = GUICreate("Add a game", 300,60, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, $WS_EX_ACCEPTFILES); WS_EX_ACCEPTFILES $var = GUICtrlCreateInput ( $tmp, 10, 5, 220, 20) GUICtrlSetState(-1,$GUI_DROPACCEPTED) $btn = GUICtrlCreateButton ("Browse", 230, 5, 60, 20) $ok = GUICtrlCreateButton ("Add", 10, 35, 60, 20) $ccl = GUICtrlCreateButton ("Cancel", 75, 35, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn GUIDelete($hGUI) _choose($tmp) Case $msg = $ok $var = GUICtrlRead($var) if $var = "" or $var = " " then MsgBox(0, "Opps!", "This cannot be blank") exitloop Else $ink = FileGetShortcut($var) if @error <> 1 then $var = $ink[0] $tmpp = StringSplit(_StringReverse(StringTrimRight(FileGetLongName($var,1),4)),"\") $tmpp = InputBox("Game Name", "Please type the game name", _StringReverse($tmpp[1])) IniWrite($file,$tmpp,"Path", $var) if $tmp <> $tmpp and $tmp <> "" Then IniWriteSection($file, $ini[$tmp+1], "") IniDelete($file, $ini[$tmp+1]) EndIf exitloop EndIf Case $msg = $ccl exitloop EndSelect Wend GUIDelete($hGUI) _run() EndFunc _run() Link to comment Share on other sites More sharing options...
DaveF Posted February 19, 2008 Share Posted February 19, 2008 First simple step in troubleshooting would be inserting a MsgBox before the call to Run and see what the value of $tmp is. Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
botanic Posted February 20, 2008 Author Share Posted February 20, 2008 (edited) I did that it is the correct exe path Edited February 20, 2008 by botanic Link to comment Share on other sites More sharing options...
Swift Posted February 20, 2008 Share Posted February 20, 2008 You dont need to put your full path for the #Includes...Just Put #Include <String.au3> Link to comment Share on other sites More sharing options...
botanic Posted February 20, 2008 Author Share Posted February 20, 2008 ok I got it working I had to use shellexecute to make it use the correct directory @swift I do that because I dont like to move those scripts and I use theh desktop for works in progress 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