Ejaz Posted November 17, 2008 Share Posted November 17, 2008 Hi, Can anybody tell me how to create listbox of programs i.e. ".exe" files and when pressing result in its execution. Regards, Ejaz Link to comment Share on other sites More sharing options...
GEOSoft Posted November 18, 2008 Share Posted November 18, 2008 (edited) Hi, Can anybody tell me how to create listbox of programs i.e. ".exe" files and when pressing result in its execution. Regards, Ejaz$Lb_1 = GUICtrlCreateList("", 10, 10, 100, 100)GUICtrlSetData($Lb_1,"C:\App1.exe|C:\App2.exe|C:\App3.exe")If GUIGetMsg() = $Lb_1 Then ShellExecute(GuiCtrlRead($Lb_1)) Edited November 18, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Ejaz Posted November 18, 2008 Author Share Posted November 18, 2008 $Lb_1 = GUICtrlCreateList("", 10, 10, 100, 100)GUICtrlSetData($Lb_1,"C:\App1.exe|C:\App2.exe|C:\App3.exe")If GUIGetMsg() = $Lb_1 Then ShellExecute(GuiCtrlRead($Lb_1))Thank you for your reply. I have this as followsGuiCtrlCreateList("", 5, 190, 100, 90)GuiCtrlSetData(-1, "C:\App1.exe|C:\App2.exe|C:\App2.exe")GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30)What I want to do is that when the item is selected in the list, and the button is pressed, it execute application via ShellExecute. Also is it possible that, instead of showing the full path of application "C:\App1.exe" can we show only "App1" which map to "C:\App1.exe". One more thing, instead of the file path, is it possible that the listbox item points to application in the folder where the script reside? I actually want this, this will look nice interface. I will appreciate your help. Regards, Ejaz Link to comment Share on other sites More sharing options...
GEOSoft Posted November 18, 2008 Share Posted November 18, 2008 (edited) Thank you for your reply. I have this as follows GuiCtrlCreateList("", 5, 190, 100, 90) GuiCtrlSetData(-1, "C:\App1.exe|C:\App2.exe|C:\App2.exe") GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) What I want to do is that when the item is selected in the list, and the button is pressed, it execute application via ShellExecute. Also is it possible that, instead of showing the full path of application "C:\App1.exe" can we show only "App1" which map to "C:\App1.exe". One more thing, instead of the file path, is it possible that the listbox item points to application in the folder where the script reside? I actually want this, this will look nice interface. I will appreciate your help. Regards, Ejaz$List = GuiCtrlCreateList("", 5, 190, 100, 90) GuiCtrlSetData($List, "App1|App2|App") $Btn = GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) While 1 Switch GUIGetMsg() Case -3 Exit Case $Btn Switch GUICtrlRead($List) Case "App1" $App = "C:\App1.exe" Case "App2" $App = "C:\my path\app2.exe" Case "App3" $App = @ProgramFilesDir & "\Program name folder\app3.exe" EndSwitch ShellExecute($App) EndSwitch Wend Edited November 18, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Ejaz Posted November 18, 2008 Author Share Posted November 18, 2008 $List = GuiCtrlCreateList("", 5, 190, 100, 90) GuiCtrlSetData($List, "App1|App2|App") $Btn = GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) While 1 Switch GUIGetMsg() Case -3 Exit Case $Btn Switch GUICtrlRead($List) Case "App1" $App = "C:\App1.exe" Case "App2" $App = "C:\my path\app2.exe" Case "App3" $App = @ProgramFilesDir & "\Program name folder\app3.exe" EndSwitch ShellExecute($App) EndSwitch Wend This is amazing help from you so quick. Now i have a little proble, the application is not running, following is complete code #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> GuiCreate("Test1", 600, 600) $List = GuiCtrlCreateList("", 5, 190, 100, 90) GuiCtrlSetData($List, "App1|App2|App") $Btn = GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) While 1 Switch GUIGetMsg() Case -3 Exit Case $Btn Switch GUICtrlRead($List) Case "App1" $App = "C:\App1.exe" Case "App2" $App = "C:\my path\app2.exe" Case "App3" $App = @ProgramFilesDir & "\Program name folder\app3.exe" EndSwitch ShellExecute($App) EndSwitch Wend GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Link to comment Share on other sites More sharing options...
GEOSoft Posted November 18, 2008 Share Posted November 18, 2008 This is amazing help from you so quick. Now i have a little proble, the application is not running, following is complete code #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> GuiCreate("Test1", 600, 600) $List = GuiCtrlCreateList("", 5, 190, 100, 90) GuiCtrlSetData($List, "App1|App2|App") $Btn = GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) While 1 Switch GUIGetMsg() Case -3 Exit Case $Btn Switch GUICtrlRead($List) Case "App1" $App = "C:\App1.exe" Case "App2" $App = "C:\my path\app2.exe" Case "App3" $App = @ProgramFilesDir & "\Program name folder\app3.exe" EndSwitch ShellExecute($App) EndSwitch Wend GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEndIt's the 2 While loops. #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> GuiCreate("Test1", 600, 600) $List = GuiCtrlCreateList("", 5, 190, 100, 90) GuiCtrlSetData($List, "App1|App2|App") $Btn = GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Btn Switch GUICtrlRead($List) Case "App1" $App = "C:\App1.exe" Case "App2" $App = "C:\my path\app2.exe" Case "App3" $App = @ProgramFilesDir & "\Program name folder\app3.exe" EndSwitch ShellExecute($App) EndSwitch Wend George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Ejaz Posted November 18, 2008 Author Share Posted November 18, 2008 It's the 2 While loops. #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> GuiCreate("Test1", 600, 600) $List = GuiCtrlCreateList("", 5, 190, 100, 90) GuiCtrlSetData($List, "App1|App2|App") $Btn = GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Btn Switch GUICtrlRead($List) Case "App1" $App = "C:\App1.exe" Case "App2" $App = "C:\my path\app2.exe" Case "App3" $App = @ProgramFilesDir & "\Program name folder\app3.exe" EndSwitch ShellExecute($App) EndSwitch Wend I already tried that, but the result is the same. When trying to open, interface never comes up, but i can see icon in the taskbar. Any help Regards, M. A. Ijaz Link to comment Share on other sites More sharing options...
DaRam Posted November 18, 2008 Share Posted November 18, 2008 You need the GUISetState() statement before the While Loop begins. I already tried that, but the result is the same. When trying to open, interface never comes up, but i can see icon in the taskbar. Any help Regards, M. A. Ijaz Link to comment Share on other sites More sharing options...
Ejaz Posted November 18, 2008 Author Share Posted November 18, 2008 You need the GUISetState() statement before the While Loop begins. Still the same results, its not running the GUI. Link to comment Share on other sites More sharing options...
Ejaz Posted November 18, 2008 Author Share Posted November 18, 2008 Still the same results, its not running the GUI.Sorry boss, u were excellent. Thanks much , the prob is resolved. N thanks for bearing with me, God bless u. Regards, Ejaz 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