Deleted
Sie benötigen ein Programm, einige Programme laufen, AutoIT 3.3.8.1
-
- [ neu ]
-
meows -
14. Juli 2012 um 17:13 -
Erledigt
-
-
Bitte auf Englisch und/oder deiner Muttersprache, ich denke das niemand den Sinn hinter den Wörtern versteht.
Oder benutz im Notfall Google Translator (Wenn der nicht schon grade benutzt wurde...)Oder benutz Bilder, irgendwas was jeder versteht...
Wenn ich den letzten Abschnitt richtig verstanden hab, dann hast du schon das Grundgerüst. Wie wäre es wenn du das schonmal posten würdest, wäre sicherlich auch praktisch um zu verstehen was du möchtest.
Gruß
-
das ist leider google translator
-
Please post it in your motherlanguage or in english...
-
Problem is I do not know How to use Autoit to allow a user to click a button GUICtrlCreatePic and have a file run.
This is the opening Screen
[Blockierte Grafik: http://78ez.com/images/open1.jpg]
But no matter what I do I can't get a click on a picture to open a file.
I need it to [Blockierte Grafik: http://78ez.com/images/open2.jpg]
have a open message for each of the levels in the game.Please How do I code a simple user click on a picture to open a file?
Code that is useless.
C
Alles anzeigen#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=c:\program files (x86)\autoit3\tihgame1\julymenu.kxf $Form1_1 = GUICreate("Trouble In Heaven", 1030, 772, 234, 21) GUISetIcon("C:\Play.ico", -1) $background = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 1024, 768, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $EXIT = GUICtrlCreateButton("EXIT", 936, 40, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetTip(-1, "EXIT") $EXITcontext = GUICtrlCreateContextMenu($EXIT) $MenuItem1 = GUICtrlCreateMenuItem("EXIT", $EXITcontext) $MenuItem2 = GUICtrlCreateMenuItem("On the Run", $EXITcontext) GUICtrlSetState(-1, $GUI_CHECKED) $MenuItem3 = GUICtrlCreateMenuItem("Devils Slide", $EXITcontext) $MenuItem4 = GUICtrlCreateMenuItem("Traitorous Dungeon", $EXITcontext) $MenuItem5 = GUICtrlCreateMenuItem("Into The Dungon", $EXITcontext) $help1 = GUICtrlCreateLabel("Hints and Help", 824, 80, 198, 36) GUICtrlSetFont(-1, 16, 800, 0, "Arial") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x008080) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlSetTip(-1, "Help") $ontherun = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\ONTHERUN.jpg", 16, 144, 292, 68, BitOR($GUI_SS_DEFAULT_PIC,$SS_SUNKEN)) GUICtrlSetTip(-1, "exit") $devilSlide = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\devilSlide.jpg", 336, 168, 332, 52, BitOR($GUI_SS_DEFAULT_PIC,$SS_SUNKEN)) GUICtrlSetTip(-1, "level2") $demonhalls = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\demonhalls.jpg", 344, 224, 332, 52) GUICtrlSetTip(-1, "level 3") $hadies = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\16hadiesexpress.jpg", 688, 168, 332, 52) GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "level 4") $runningpits = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\runningpits.jpg", 680, 360, 348, 44) GUICtrlSetTip(-1, "level 5") $templepain = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\templepain.jpg", 680, 224, 340, 76) $Underworld = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Underworld.jpg", 696, 304, 324, 52) $devilSlide2 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\devilSlide2.jpg", 8, 224, 300, 52) $Traitor2 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitorousdungeon2.jpg", 8, 288, 300, 52) GUICtrlSetTip(-1, "Traitorous dungeon") $Traitor1 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitorousdungeon1.jpg", 8, 288, 300, 52, BitOR($GUI_SS_DEFAULT_PIC,$SS_SUNKEN)) GUICtrlSetTip(-1, "Traitorous dungeon") $sewer1 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\sewer1.jpg", 8, 344, 300, 44) GUICtrlSetTip(-1, "In to the sewer") $Traitor9 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitor9.jpg", 344, 368, 332, 52) GUICtrlSetTip(-1, "Dead Reborn") Dim $Form1_1_AccelTable[1][2] = [["^q", $EXIT]] GUISetAccelerators($Form1_1_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GuiCreate("Menu", 400, 150) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 Case $MenuItem2 Case $MenuItem3 Case $MenuItem4 Case $MenuItem5 Case $EXIT $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Case $help1 Case $ontherun Case $devilSlide Case $demonhalls Case $runningpits Case $templepain Case $Underworld Case $devilSlide2 Case $Traitor2 Case $Traitor1 Case $sewer1 Case $Traitor9 EndSwitch WEnd Func MenuItem1Click() EndFunc Func MenuItem2Click() EndFunc Func MenuItem3Click() EndFunc Func MenuItem4Click() EndFunc Func ontherunClick() EndIf EndFunc Func runningpitsClick() EndFunc Func sewer1Click() MsgBox(0, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle) EndFunc Func templepainClick() EndFunc Func Traitor1Click() EndFunc Func Traitor2Click() EndFunc Func Traitor9Click() EndFunc Func UnderworldClick() EndFunc
I tried to get this to work and it did but you never have access to the main form only the popup boxes.
See they have to complete each level before they can play the next level.
C
Alles anzeigen#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <Misc.au3> If _Singleton("Trouble In Heaven", 1) = 0 Then ; We know the script is already running. Let the user know. MsgBox(0, "Script Name", "This script is already running. Using multiple copies of this script at the same time is unsupported!") Exit EndIf #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_1 = GUICreate("Trouble In Heaven", 1030, 772, 234, 21) GUISetIcon("C:\Play.ico", -1) $Pic1 = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 1024, 768, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) ;$Pic1 = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 612, 428) $Button1 = GUICtrlCreateButton("Button1", 256, 380, 256, 32, $BS_ICON) GUICtrlSetImage(-1, "C:\play1.ico", -1) ;GUICtrlSetColor(-1,0xFF0000) ; Makes instructions Red GUICtrlSetTip(-1, "exit") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg ; Case $GUI_EVENT_CLOSE ; Exit Case $Button1 Exit EndSwitch ; $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,"Start your escape","Start your escape 'On the Run'") If $iMsgBoxAnswer = 6 Then;Yes FileChangeDir ( "C:\0TIH\1a" ) $file = "C:\0TIH\1a\1a.exe" ShellExecuteWait($file) EndIf ;ShellExecuteWait("C:\0aTest\China1a.exe", "","C:\0aTest", "") If $iMsgBoxAnswer = 7 Then ;No Exit EndIf #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 FileExists("C:\0aTest\level1.txt") Then If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(292,"Play Level 2","Play On the Run") ; Select Case $iMsgBoxAnswer = 6 ;Yes FileChangeDir ( "C:\0TIH\2a" ) $file = "C:\0TIH\2a\2a.exe" ShellExecuteWait($file) Case $iMsgBoxAnswer = 7 ;No Exit EndSelect Else MsgBox(4096, "C:\0TIH", "You did not complete last level") EndIf ;EndSelect ;Wend #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,"Trouble In Heaven","Enter Devils Slide") Select Case $iMsgBoxAnswer = 6 ;Yes FileChangeDir ( "C:\0TIH\3a" ) $file = "C:\0TIH\3a\3a.exe" ShellExecuteWait($file) Case $iMsgBoxAnswer = 7 ;No Exit EndSelect ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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(60,"Play Level 4","Play Level 4") Select Case $iMsgBoxAnswer = 6 ;Yes ShellExecuteWait("C:\0aTest\China4a.exe", "","C:\0aTest", "") Case $iMsgBoxAnswer = 7 ;No Exit EndSelect WEnd #EndRegion --- CodeWizard generated code End --- will repeat to China21a.exe
-
Please How do I code a simple user click on a picture to open a file?
[autoit]
You havr a backgroundimage in your gui, do you can't click on any Control. Disable it:$background = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 1024, 768, BitOR($GUI_SS_DEFAULT_PIC,$SS_CENTERIMAGE))
[/autoit]
GuiCtrlSetState(-1,$GUI_DISABLE)and the controls get the messages. To execute a file have a look on
[autoit]Shellexecute
[/autoit]Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\program files (x86)\autoit3\tihgame1\julymenu.kxf
$Form1_1 = GUICreate("Trouble In Heaven", 1030, 772, 234, 21)
GUISetIcon("C:\Play.ico", -1)
$background = GUICtrlCreatePic("C:\Splash.bmp", 0, 0, 1024, 768, BitOR($GUI_SS_DEFAULT_PIC, $SS_CENTERIMAGE))
GuiCtrlSetState(-1,$GUI_DISABLE)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$EXIT = GUICtrlCreateButton("EXIT", 936, 40, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetTip(-1, "EXIT")
$EXITcontext = GUICtrlCreateContextMenu($EXIT)
$MenuItem1 = GUICtrlCreateMenuItem("EXIT", $EXITcontext)
$MenuItem2 = GUICtrlCreateMenuItem("On the Run", $EXITcontext)
GUICtrlSetState(-1, $GUI_CHECKED)
$MenuItem3 = GUICtrlCreateMenuItem("Devils Slide", $EXITcontext)
$MenuItem4 = GUICtrlCreateMenuItem("Traitorous Dungeon", $EXITcontext)
$MenuItem5 = GUICtrlCreateMenuItem("Into The Dungon", $EXITcontext)
$help1 = GUICtrlCreateLabel("Hints and Help", 824, 80, 198, 36)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0x008080)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlSetTip(-1, "Help")
$ontherun = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\ONTHERUN.jpg", 16, 144, 292, 68, BitOR($GUI_SS_DEFAULT_PIC, $SS_SUNKEN))
GUICtrlSetTip(-1, "exit")
$devilSlide = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\devilSlide.jpg", 336, 168, 332, 52, BitOR($GUI_SS_DEFAULT_PIC, $SS_SUNKEN))
GUICtrlSetTip(-1, "level2")
$demonhalls = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\demonhalls.jpg", 344, 224, 332, 52)
GUICtrlSetTip(-1, "level 3")
$hadies = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\16hadiesexpress.jpg", 688, 168, 332, 52)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "level 4")
$runningpits = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\runningpits.jpg", 680, 360, 348, 44)
GUICtrlSetTip(-1, "level 5")
$templepain = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\templepain.jpg", 680, 224, 340, 76)
$Underworld = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Underworld.jpg", 696, 304, 324, 52)
$devilSlide2 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\devilSlide2.jpg", 8, 224, 300, 52)
$Traitor2 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitorousdungeon2.jpg", 8, 288, 300, 52)
GUICtrlSetTip(-1, "Traitorous dungeon")
$Traitor1 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitorousdungeon1.jpg", 8, 288, 300, 52, BitOR($GUI_SS_DEFAULT_PIC, $SS_SUNKEN))
GUICtrlSetTip(-1, "Traitorous dungeon")
$sewer1 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\sewer1.jpg", 8, 344, 300, 44)
GUICtrlSetTip(-1, "In to the sewer")
$Traitor9 = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\TIHGame1\Traitor9.jpg", 344, 368, 332, 52)
GUICtrlSetTip(-1, "Dead Reborn")
Dim $Form1_1_AccelTable[1][2] = [["^q", $EXIT]]
GUISetAccelerators($Form1_1_AccelTable)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICreate("Menu", 400, 150)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $EXIT
ExitCase $MenuItem1
[/autoit] [autoit][/autoit] [autoit]
Case $MenuItem2
Case $MenuItem3
Case $MenuItem4
Case $MenuItem5
Case $help1
Case $ontherun
Case $devilSlide
Case $demonhalls
Case $runningpits
Case $templepain
Case $Underworld
Case $devilSlide2
Case $Traitor2
Case $Traitor1
Case $sewer1
sewer1Click()
MsgBox(0, "sewer1", "ID=" & $nMsg)
ShellExecute("YoirFile")
Case $Traitor9
EndSwitch
WEnd
Func MenuItem1Click()EndFunc ;==>MenuItem1Click
[/autoit] [autoit][/autoit] [autoit]
Func MenuItem2Click()EndFunc ;==>MenuItem2Click
[/autoit] [autoit][/autoit] [autoit]
Func MenuItem3Click()EndFunc ;==>MenuItem3Click
[/autoit] [autoit][/autoit] [autoit]
Func MenuItem4Click()EndFunc ;==>MenuItem4Click
[/autoit] [autoit][/autoit] [autoit]
Func ontherunClick()EndFunc ;==>ontherunClick
[/autoit] [autoit][/autoit] [autoit]
Func runningpitsClick()EndFunc ;==>runningpitsClick
[/autoit] [autoit][/autoit] [autoit]
Func sewer1Click()
MsgBox(0, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle)
;@GUI_CtrlId, @GUI_CtrlId, @GUI_WinHandle only available in OnEvent.Mode
EndFunc ;==>sewer1Click
Func templepainClick()EndFunc ;==>templepainClick
[/autoit] [autoit][/autoit] [autoit]
Func Traitor1Click()EndFunc ;==>Traitor1Click
[/autoit] [autoit][/autoit] [autoit]
Func Traitor2Click()EndFunc ;==>Traitor2Click
[/autoit] [autoit][/autoit] [autoit]
Func Traitor9Click()EndFunc ;==>Traitor9Click
[/autoit] [autoit][/autoit] [autoit]
Func UnderworldClick()EndFunc ;==>UnderworldClick
[/autoit]mfg autoBert
-
- Offizieller Beitrag
This is an crosspost!
In this case please link the crossed posts.