eri Posted February 5, 2010 Share Posted February 5, 2010 Please Corect My Script.. expandcollapse popup#include <GUIConstants.au3> #include <GuiComboBoxEx.au3> #include <Constants.au3> Opt('MustDeclareVars', 1) $Debug_CB = False Local $hGUI, $Location, $Locate, $delete, $msg, $path, $open $hGUI = GUICreate("Test Script AutoIt", 275, 80) $Location = _GUICtrlComboBoxEx_Create ($hGUI, "", 4, 7, 100, 100) _GUICtrlComboBoxEx_AddDir ($Location, "", $DDL_DRIVES, False) GUICtrlCreateLabel("<<< Where Is File Location", 120, 5, 268, 20) GUICtrlSetFont(-1, 10, 800, 4, "Pristina") GUICtrlSetColor(-1, 0xFF0000) GUISetState(@SW_SHOW) $open = GUICtrlCreateButton("Open", 10, 40, 75, 25, 0) $delete = GUICtrlCreateButton("Delete", 100, 40, 80, 25, 0) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $open $path = GUICtrlRead($Location) If $path = '' Then MsgBox(64, "Warning", "You need to select a drive") ElseIf DirCreate($path) Then ShellExecute ($path &"\test.jpg") Else MsgBox(64, "Warning", "Install failed.") EndIf Case $delete FileDelete ($path &"\test.jpg") EndSwitch WEnd Although I have select drive in Combolist.. then Click Button Open Allways get messege MsgBox(64, "Warning", "You need to select a drive") please correct my script.. Please.. Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 5, 2010 Share Posted February 5, 2010 might change ElseIf DirCreate($path) Then to something like ElseIf $path<>'' Then DirCreate($path) ShellExecute ($path &"\test.jpg") 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
DustinBowers Posted February 5, 2010 Share Posted February 5, 2010 REPLACE THIS: $path = GUICtrlRead($Location) WITH THIS: _GUICtrlComboBoxEx_GetItemText ($Location, 0, $path) In your script and you should get the results you are looking for. Link to comment Share on other sites More sharing options...
eri Posted February 5, 2010 Author Share Posted February 5, 2010 REPLACE THIS:$path = GUICtrlRead($Location) WITH THIS:_GUICtrlComboBoxEx_GetItemText ($Location, 0, $path)In your script and you should get the results you are looking for.Hi.. I have change it`s and get message windows cannot find '2\test.jpg' i want open but why get message search file..?? Link to comment Share on other sites More sharing options...
DustinBowers Posted February 5, 2010 Share Posted February 5, 2010 it works fine for me, make sure you have a Test.jpg in your c:\ or d:\ or make sure you type the name properly. also make sure your computer has a default program which opens jpgs, mine uses microsoft office picture manager as the default program that displays the image files on my comp. Link to comment Share on other sites More sharing options...
eri Posted February 5, 2010 Author Share Posted February 5, 2010 it works fine for me, make sure you have a Test.jpg in your c:\ or d:\ or make sure you type the name properly. also make sure your computer has a default program which opens jpgs, mine uses microsoft office picture manager as the default program that displays the image files on my comp.Hi.. I have it for All.. But still get error.. Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 5, 2010 Share Posted February 5, 2010 when I can't figure out why a program isn't working, I add a MsgBox right before a variable to see what the script sees. In your case, before the shellexicute I would add a line: MsgBox(0,"",$path) that will show you what is in the variable path and might help you figure out why it isn't working. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 6, 2010 Moderators Share Posted February 6, 2010 eri,If you read the Help file for the GuiComboBoxEx UDF, you will see that you need to retrieve the index of the selected item with _GetCurSel before you can use _GetItemText. If you replace the $path = GUICtrlRead($Location) line in you original script with:_GUICtrlComboBoxEx_GetItemText ($Location, _GUICtrlComboBoxEx_GetCurSel($Location), $path)you will get the selected drive in your $path variable.Moral: do not mix the UDF functions with the built-in ones. If you use a UDF to create a control, check if you have to use the other functions within the UDF to work with it. The built-in functions will often only work with controls created by other built-in functions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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