Gurutz Posted November 14, 2006 Share Posted November 14, 2006 I don't understand how the runapp or run works propally because i want to make a few things run of a click of a button.. but can't think of how the runapp or run makes them work...Heres my code.#include <GUIConstants.au3>; == GUI generated with Koda ==$Form1 = GUICreate("Desktop", 589, 46, 192, 125)$Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29)$Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25)GUICtrlSetFont(-1, 10, 400, 0, "Verdana")$Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33)$Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25)GUICtrlSetFont(-1, 10, 400, 0, "Verdana")$Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33)$Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25)GUICtrlSetFont(-1, 10, 400, 0, "Verdana")$Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33)$Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25)GUICtrlSetFont(-1, 10, 400, 0, "Verdana")GUISetState(@SW_SHOW)While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelectWEndanyone able to get them to work? Link to comment Share on other sites More sharing options...
PaulIA Posted November 14, 2006 Share Posted November 14, 2006 This ought to get you a little farther down the road: #include <GUIConstants.au3> $Form1 = GUICreate("Desktop", 589, 46, 192, 125) $Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29) $Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33) $Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33) $Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33) $Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $Button1 MsgBox(0, "Button", "You pressed button 1") ; Run("Myapp.exe") EndSelect WEnd Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Gurutz Posted November 14, 2006 Author Share Posted November 14, 2006 This ought to get you a little farther down the road: #include <GUIConstants.au3> $Form1 = GUICreate("Desktop", 589, 46, 192, 125) $Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29) $Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33) $Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33) $Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33) $Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $Button1 MsgBox(0, "Button", "You pressed button 1") ; Run("Myapp.exe") EndSelect WEnd Thanks. I shall see what to do from here ^.^ Link to comment Share on other sites More sharing options...
Gurutz Posted November 14, 2006 Author Share Posted November 14, 2006 (edited) Okay thanks, im not sure if this code would work in the program.. is it possable? While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $Button1 MsgBox(0, "Opening", "Opening Microsoft Word") ; Run("Myapp.exe") Run("Microsoft Word.exe", "C:\Documents and Settings\All Users\Desktop\") EndSelect WEnd would it work? Edited November 14, 2006 by Gurutz Link to comment Share on other sites More sharing options...
BigDod Posted November 14, 2006 Share Posted November 14, 2006 If you try it you will see that it does not work. The exe for Microsoft Word is winword.exe and you would also need to supply the full path to it. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
PaulIA Posted November 14, 2006 Share Posted November 14, 2006 Okay thanks, im not sure if this code would work in the program.. is it possable? While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $Button1 MsgBox(0, "Opening", "Opening Microsoft Word") ; Run("Myapp.exe") Run("Microsoft Word.exe", "C:\Documents and Settings\All Users\Desktop\") EndSelect WEnd would it work?The syntax is correct, but the executable for Word is wrong. Run("WinWord.exe", "C:\Documents and Settings\All Users\Desktop\") Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Gurutz Posted November 14, 2006 Author Share Posted November 14, 2006 The syntax is correct, but the executable for Word is wrong. Run("WinWord.exe", "C:\Documents and Settings\All Users\Desktop\") What would the one be for msnmsgr.exe? i've tried opening that and it doesn't work Link to comment Share on other sites More sharing options...
PaulIA Posted November 14, 2006 Share Posted November 14, 2006 What would the one be for msnmsgr.exe? i've tried opening that and it doesn't workUh.. How about running this from a command prompt:Dir msnmsgr.exe /sIt will give you the path you need to the executable you already know. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Gurutz Posted November 14, 2006 Author Share Posted November 14, 2006 Line 42 Run("WinWord.exe", "C:\Documents and Settings\All Users\Desktop\") Error: Unable to execute the external program The system cannot find the file specified Even with this error it should open right? Since the Address to the program is optionial. Link to comment Share on other sites More sharing options...
MHz Posted November 14, 2006 Share Posted November 14, 2006 Since the Address to the program is optionial.I'm fairly certain that you need to specify the path. It is not in the systems path. The Run function does not search the registry as compared to the Run box of the OS. Link to comment Share on other sites More sharing options...
Gurutz Posted November 14, 2006 Author Share Posted November 14, 2006 Well it is going to be a tooltip for the desktop, and i need it to have it on so that its just like a quicklaunch, and only problem now is to get these things up and running . Anyone here able to edit the code i have now to get things to work. #include <GUIConstants.au3> ; == GUI generated with Koda == $Form1 = GUICreate("Desktop", 589, 46, 192, 125) $Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29) $Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33) $Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33) $Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33) $Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button4 MsgBox(0, "Opening", "Opening MSN Messenger", 2) Case $msg = $Button1 MsgBox(0, "Opening", "Opening Word", 2) Case $Msg = $Button2 MsgBox(0, "Opening", "Windows PowerPoint", 2) Case $Msg = $Button3 MsgBox(0, "Opening", "Windows Excel", 2) EndSelect WEnd Link to comment Share on other sites More sharing options...
MHz Posted November 14, 2006 Share Posted November 14, 2006 Try this. I have guessed some of the key names as I do not have MS Office or MSN Msg... installed. expandcollapse popup#include <GUIConstants.au3> ; == GUI generated with Koda == $Form1 = GUICreate("Desktop", 589, 46, 192, 125) $Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29) $Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33) $Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33) $Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33) $Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button4 MsgBox(0, "Opening", "Opening MSN Messenger", 2) $path = _AppPaths('msnmsgr.exe') If FileExists($path) Then Run($path) EndIf Case $msg = $Button1 MsgBox(0, "Opening", "Opening Word", 2) $path = _AppPaths('winword.exe') If FileExists($path) Then Run($path) EndIf Case $msg = $Button2 MsgBox(0, "Opening", "Windows PowerPoint", 2) $path = _AppPaths('pwrpoint.exe') If FileExists($path) Then Run($path) EndIf Case $msg = $Button3 MsgBox(0, "Opening", "Windows Excel", 2) $path = _AppPaths('excel.exe') If FileExists($path) Then Run($path) EndIf EndSelect WEnd Func _AppPaths($key) Local $value $value = RegRead('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\' & $key, '') If Not @error Then Return $value EndIf EndFunc Link to comment Share on other sites More sharing options...
Gurutz Posted November 14, 2006 Author Share Posted November 14, 2006 Thanks that worked perfectly. 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