hiddenlink Posted August 29, 2008 Share Posted August 29, 2008 How to launch external apps with the use of buttons. Link to comment Share on other sites More sharing options...
2words4uready Posted August 29, 2008 Share Posted August 29, 2008 What code do you have so far? Link to comment Share on other sites More sharing options...
2words4uready Posted August 29, 2008 Share Posted August 29, 2008 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 141, 53, 193, 125) $Button1 = GUICtrlCreateButton("Button1", 16, 8, 113, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 run("notepad.exe") EndSwitch WEnd Link to comment Share on other sites More sharing options...
hiddenlink Posted August 29, 2008 Author Share Posted August 29, 2008 What code do you have so far?I use the run but it says it cannot execute the application.run(".exe" , "C:Windows/System32/Restore/mstrui.exe" , 0) Link to comment Share on other sites More sharing options...
hiddenlink Posted August 29, 2008 Author Share Posted August 29, 2008 ;==================================================== ;================= Example of a GUI ================= ;==================================================== ; AutoIt version: 3.0.103 ; Language: English ; Author: "SlimShady111" ; ; ---------------------------------------------------------------------------- ; Script Start ; ---------------------------------------------------------------------------- ;Include constants #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() ;Initialize variables Local $GUIWidth = 300, $GUIHeight = 250 Local $Edit_1, $OK_Btn, $Cancel_Btn, $Def_Btn, $msg #forceref $Edit_1 ;Create window GUICreate("Cockpit", $GUIWidth, $GUIHeight) GuiCtrlCreateLabel("Optimize your Windows", 10, 10) ;Create an "OK" button $OK_Btn = GUICtrlCreateButton("System Restore", 10, 50, 90, 25) ;Create a "CANCEL" button $Cancel_Btn = GUICtrlCreateButton("Registry Editor", 200, 50, 90, 25) $Def_Btn = GUICtrlCreateButton("Defragmenter", 105, 50, 90, 25) ;Show window/Make the window visible GUISetState(@SW_SHOW) ;Loop until: ;- user presses Esc ;- user presses Alt+F4 ;- user clicks the close button While 1 ;After every loop check if the user clicked something in the GUI window $msg = GUIGetMsg() Select ;Check if user clicked on the close button Case $msg = $GUI_EVENT_CLOSE ;Destroy the GUI including the controls GUIDelete() ;Exit the script Exit ;Check if user clicked on the "OK" button Case $msg = $OK_Btn run("rstrui.exe" ,"C:Windows/system32/restore/rstrui.exe") ;Check if user clicked on the "CANCEL" button Case $msg = $Def_Btn Run("rstrui.exe" ,"c:/windows/system32/restore",1,1) EndSelect WEnd EndFunc ;==>_Main Link to comment Share on other sites More sharing options...
MerkurAlex Posted August 29, 2008 Share Posted August 29, 2008 Hey guys use [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
hiddenlink Posted August 29, 2008 Author Share Posted August 29, 2008 thid doesnt run: Case $Button7 run("iTunes.exe" , "C:\Program Files\iTunes") Link to comment Share on other sites More sharing options...
Nahuel Posted August 29, 2008 Share Posted August 29, 2008 You are using it wrong. Run("C:\Program files\iTunes\iTunes.exe") The first parameter of Run() is the full path to the application you want to run. The second parameter is the working directory. Link to comment Share on other sites More sharing options...
hiddenlink Posted August 29, 2008 Author Share Posted August 29, 2008 You are using it wrong. Run("C:\Program files\iTunes\iTunes.exe") The first parameter of Run() is the full path to the application you want to run. The second parameter is the working directory. Ahh, ok Thanks a lot. 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