meows Posted July 8, 2012 Share Posted July 8, 2012 can't get the program to run from the Play icon, #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiButton.au3> #Region ### START Koda GUI section ### Form=C:\Program Files (x86)\AutoIt3\TroubleInHeaven\TIHa.kxf $Form1 = GUICreate("Trouble In Heaven", 613, 431, 192, 132) GUISetIcon("C:\Play.ico", -1) $Pic1 = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 612, 428) $Icon1 = GUICtrlCreateIcon("C:\Play1.ico", -1, 48, 80, 120, 80) GUICtrlSetTip(-1, "Play Trouble in Heaven") $Icon1context = GUICtrlCreateContextMenu($Icon1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Select Case $Form1 Case $Icon1 $Icon1= ShellExecuteWait("C:\0aTest\lvl3.exe", "","C:\0aTest", "") ShellExecuteWait("C:\0aTest\China2a.exe", "","C:\0aTest", "") EndSelect EndSwitch WEnd Link to comment Share on other sites More sharing options...
Skitty Posted July 8, 2012 Share Posted July 8, 2012 (edited) Yes, these select and swith statments can be a little confusing. For example, I judt found out that this works~ #AutoIt3Wrapper_Run_AU3Check=n GUICreate("test", 225, 100) $Button = GUICtrlCreateButton("register", 50, 10, 130, 75) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $Button HotKeySet("{F2}", "test") Func test() Send("It works, what did you think would happen?!?! but as a side effect, autoit will self destruct in 10 seconds") EndFunc EndSwitch WEnd Anyway, it appears that you're interacting with a game of some kind, that isn't allowed on these forums and obviously you lack the courtesy to respect these forums by reading the rules for insight on what is acceptable and what is not. But no bad, someone will eventually come in and lock the topic so as to make the event memorable to you that this is not allowed.... Also, try not to be one of those people who makes a secondary topic about the same thing but with a different pitch, most people on here are not as stupid as you might perceive them to be. But if it's not a game you're automating and I am incorrect about my allegations, then damn me. Edited July 8, 2012 by ApudAngelorum Link to comment Share on other sites More sharing options...
meows Posted July 8, 2012 Author Share Posted July 8, 2012 (edited) Anyway, it appears that you're interacting with a game of some kind, that isn't allowed on these forums and obviously you lack the courtesy to respect these forums by reading the rules for insight on what is acceptable and what is not. Sir I make games, This is my game I made, I am trying to make A opening screen for Trouble in Heaven that will run all 21 levels of the game one after the other, please see my web site 78ez.comNow how do I let the user click the play button so they can play the game please?here try it for your self, first click http://www.filefactory.com/file/6d2euojy7c6t/n/TestComputer.exeto see if your computer can play my games.then click here to play a couple levels of the game.http://www.filefactory.com/file/c5ac001/n/TroubleInHeaven.exe Edited July 8, 2012 by meows Link to comment Share on other sites More sharing options...
meows Posted July 9, 2012 Author Share Posted July 9, 2012 EDIT new code. I can't get it to run by the user pressing a button. I can't figure out how to get $iMsgBoxAnswer = MsgBox(36,"Play Trouble in Heaven","Trouble in Heaven by Reardon Studios") Select Case $iMsgBoxAnswer = 6 ;Yes into a graphic the player presses to play the game. ;ShellExecute("C:Program Files (x86)The Game CreatorsFPS CreatorMyGames", @ScriptDir & "China4a.exe", "", "OPEN") ;ShellExecute("C:0GameLink000Gamelaunchcreate_004data1", @ScriptDir & "1.exe", "", "run") ;Run("C:0GameLink000Gamelaunchcreate_004data1", @ScriptDir & "1.exe", "", "run") ;Run(@WindowsDir & "notepad.exe", "", @SW_MAXIMIZE) ;ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] ) ; ShellExecuteWait("C:0aTestlvl3.exe", "","C:0aTest", "") ;ShellExecuteWait("C:0aTestChina2a.exe", "","C:0aTest", "") #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(36,"Play Trouble in Heaven","Trouble in Heaven by Reardon Studios") Select Case $iMsgBoxAnswer = 6 ;Yes ShellExecuteWait("C:0aTestlvl3.exe", "","C:0aTest", "") ShellExecuteWait("C:0aTestChina2a.exe", "","C:0aTest", "") Case $iMsgBoxAnswer = 7 ;No EndSelect #EndRegion --- CodeWizard generated code End --- Link to comment Share on other sites More sharing options...
Skitty Posted July 9, 2012 Share Posted July 9, 2012 Alright, my bad, I read about the game over at the place you're developing it. Since you decided to use the shell execution method to run the program instead of the RunWait() command, I believe you need to enter the verb thing to tell it what type of execution to perform. Try adding "open" to the "verb" parameter, which is the last empty parameter in the shellexecutewait() function. Link to comment Share on other sites More sharing options...
meows Posted July 9, 2012 Author Share Posted July 9, 2012 (edited) Alright, my bad, I read about the game over at the place you're developing it. Since you decided to use the shell execution method to run the program instead of the RunWait() command, I believe you need to enter the verb thing to tell it what type of execution to perform. Try adding "open" to the "verb" parameter, which is the last empty parameter in the shellexecutewait() function. Thank you ApudAngelorum for trying to help. Adding open just crashed the whole thing as I am using the Actually I changed it all around, New Code and it runs but really want the start button towork and add a Quit Game button on the splash screen. I will be adding ini files to track games won so they can restart at any game they have won instead of having to play them from game one. Many Thanks. expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region --- CodeWizard generated code Start --- If Not IsDeclared('Navy') Then Local $Navy = 0x000080 GUICtrlSetColor("controlID",$Navy) #EndRegion --- CodeWizard generated code End --- #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("test", 613, 431, 192, 132) $Pic1 = GUICtrlCreatePic("C:Splash.bmp", 0, 0, 612, 428) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 ; $nMsg = GUIGetMsg() ; Switch $nMsg ; Case $GUI_EVENT_CLOSE ; Exit ; EndSwitch ;WEnd ;;;;;;;;;;;;;; GAME ONE ;;;;;;;;;;;;;; #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(36,"play game","play level one") Select Case $iMsgBoxAnswer = 6 ;Yes ShellExecuteWait("C:0aTestChina1a.exe", "","C:0aTest", "") Case $iMsgBoxAnswer = 7 ;No Exit EndSelect #EndRegion --- CodeWizard generated code End --- ;;;;;;;;;;;;;;; GAME TWO ;;;;;;;;;;;;;;;;;;;;;;; #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Default Button=Second, Icon=Question If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(292,"play 2","play 2") Select Case $iMsgBoxAnswer = 6 ;Yes ShellExecuteWait("C:0aTestChina2a.exe", "","C:0aTest", "") Case $iMsgBoxAnswer = 7 ;No Exit EndSelect #EndRegion --- CodeWizard generated code End --- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GAME THREE ;;;;;;;;;;;;;;;;;;;;;;; #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Default Button=Second, Icon=None If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(260,"Play Level 3","Play Level 3") Select Case $iMsgBoxAnswer = 6 ;Yes ShellExecuteWait("C:0aTestChina3a.exe", "","C:0aTest", "") Case $iMsgBoxAnswer = 7 ;No EndSelect Exit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GAME FOUR ;;;;;;;;;;;;;;;;;;;;;;; #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Default Button=Second, Icon=None If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(260,"Play Level 4","Play Level 4") Select Case $iMsgBoxAnswer = 6 ;Yes ShellExecuteWait("C:0aTestChina4a.exe", "","C:0aTest", "") Case $iMsgBoxAnswer = 7 ;No Exit EndSelect WEnd #EndRegion --- CodeWizard generated code End --- will repeat to China21a.exe Edited July 9, 2012 by meows Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 9, 2012 Moderators Share Posted July 9, 2012 meows,Regardless of whether you wrote the game or not, the Forum Rules prohibit the discussion of any script which interacts with or launches a game. Your script does exactly that and so is not permitted here - this thread is now locked. Please make sure your future posts are within the rules. 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