Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Guild Wars
You last visited: Today at 15:52

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Button mit Funktion belegen

Discussion on Button mit Funktion belegen within the Guild Wars forum part of the MMORPGs category.

Reply
 
Old   #1
 
Gorn92's Avatar
 
elite*gold: 0
Join Date: Oct 2007
Posts: 78
Received Thanks: 9
Button mit Funktion belegen

Hi,

Ich stehe bei der Programierung eines Botes vor einem Problem. Ich habe eine einfache GUI erstellt, und möchte einen Button mit einer Funktion belegen.
Hier mal eine Bsp-GUI:
Code:
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 511, 235, 193, 125)
$Input1 = GUICtrlCreateInput("Message", 64, 80, 385, 21)
$Button1 = GUICtrlCreateButton("Send", 200, 144, 97, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

	EndSwitch
WEnd
Wie ihr seht habe ich dort ein Input-Feld und einen Button. Der Button soll jetzt den Inhalt des Input-Feldes senden. z.B.:
Code:
	Run("notepad.exe")
	WinWait("Unbenannt")
	Controlsend("Unbenannt", "", "", $Input1)
Ich habe jetzt schon einiges darüber gelesen, es aber noch nicht geschafft, diese Funktion an den Button zu binden.

Wie macht man das?

MfG,

Gorn
Gorn92 is offline  
Old 01/03/2009, 14:39   #2
 
aLasca's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 614
Received Thanks: 164
PHP Code:
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Form1"511235193125)
$Input1 GUICtrlCreateInput("Message"648038521)
$Button1 GUICtrlCreateButton("Send"20014497330)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg $Button1
        
Case $GUI_EVENT_CLOSE
            
Exit

    EndSwitch
WEnd

Func _x
()

Run("notepad.exe")
    
WinWait("Unbenannt")
    
Controlsend("Unbenannt"""""$Input1)
EndFunc

$Button1 
Call("_x"
so müsste es gehen
aLasca is offline  
Thanks
1 User
Old 01/03/2009, 14:54   #3
 
Gorn92's Avatar
 
elite*gold: 0
Join Date: Oct 2007
Posts: 78
Received Thanks: 9
Danke für die schnelle Antwort, aber leider will es nohc nicht so. Wenn ich jetzt auf den Button klicke, beendet sich das Script und macht nichts... leider
Gorn92 is offline  
Old 01/03/2009, 15:02   #4
 
NBA's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,874
Received Thanks: 213
Wenn du das Input auslesen willst, kannst du das mit GuiCtrlRead($Input1) machen.

z.B.
Code:
#include <GuiConstants.au3>
GuiCreate("Fernlehrgang")
$input1 = GuiCtrlCreateInput("Hier den Text",10,10)
$button1 = GUICtrlCreateButton("Auslesen",10,40)
GuiSetState(@SW_SHOW)

Func _x()

Run("notepad.exe")
    WinWait("Unbenannt")
    Controlsend("Unbenannt", "", "", $Auslesen)
EndFunc 

While 1
	$msg = GUIGetMsg()
	If $msg = $GUI_EVENT_CLOSE Then ExitLoop
	If $msg	= $button1 Then
		$Auslesen =  GUICtrlRead($input1)
		_x()
	EndIf
WEnd
Schoen ist es zwar nicht, aber es funzt!
NBA is offline  
Thanks
1 User
Old 01/03/2009, 15:07   #5
 
Gorn92's Avatar
 
elite*gold: 0
Join Date: Oct 2007
Posts: 78
Received Thanks: 9
So gehts Danke!
Gorn92 is offline  
Old 01/03/2009, 15:08   #6
 
NBA's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,874
Received Thanks: 213
Kein Problem. Man muss nur kreativ sein
NBA is offline  
Old 01/03/2009, 15:08   #7
 
elite*gold: 0
Join Date: May 2008
Posts: 238
Received Thanks: 19
So mach ichs immer:

PHP Code:
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Form1"511235193125)
$Input1 GUICtrlCreateInput("Message"648038521)
$Button1 GUICtrlCreateButton("Send"20014497330)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
                Case 
$Button1
                        _blabla
()
    EndSwitch

Func _blabla()
    
Run("notepad.exe")
    
WinWait("Unbenannt")
    
Controlsend("Unbenannt"""""$Input1)
EndFunc
WEnd 
lox.0r is offline  
Old 01/03/2009, 15:12   #8
 
Gorn92's Avatar
 
elite*gold: 0
Join Date: Oct 2007
Posts: 78
Received Thanks: 9
Quote:
Originally Posted by O,...,O View Post
So mach ichs immer:
Mhm. da bekomm ich nur eine Fehlermeldung ^^

Edit: Mhm. ich hab das jetzt mal mit $Button1=Call("Funktion") probiert, aber wenn ich dann auf den Button drücke, wird die Funktion einfach nicht aufgerufen... aber das Skript wird beendet. Was habe ich falsch gemacht?

PHP Code:
 #include <GUIConstants.au3> 

#Region ### START Koda GUI section ### Form= 
$Form1 GUICreate("Form1"493349193125)
$input1 GUICtrlCreateInput("Message"9610432121)
$input2 GUICtrlCreateInput("Window"9616032121)
$Button1 GUICtrlCreateButton("Send"160232185490)
GUISetState(@SW_SHOW
#EndRegion ### END Koda GUI section ### 

While 
    $nMsg 
GUIGetMsg() 
    Switch 
$nMsg $Button1 
        
Case $GUI_EVENT_CLOSE 
            
Exit 

    EndSwitch 
WEnd 

$Button1 
Call("_x")  

Func _x() 

While 
1
ControlSend 
($input2""""$input1) ;~ Sende Input1 an Input2
ControlSend 
($input2"""""{enter down}")
Sleep(200)
ControlSend ($input2"""""{enter up}")
WEnd
   
EndFunc 
Gorn92 is offline  
Old 01/06/2009, 13:21   #9
 
elite*gold: 0
Join Date: May 2008
Posts: 145
Received Thanks: 23
Das geht so:
Code:
 #include <GUIConstants.au3> 

$Form1 = GUICreate("Input1 zu Input2", 220, 100, 193, 125)
$input1 = GUICtrlCreateInput("Message", 10, 10, 200, 21)
$input2 = GUICtrlCreateInput("Window", 10, 35, 200, 21)
$Button1 = GUICtrlCreateButton("Send", 10, 65, 200,30)
GUISetState(@SW_SHOW) 

While 1 
    $nMsg = GUIGetMsg() 
    Switch $nMsg
        Case $GUI_EVENT_CLOSE 
            Exit 
        Case $Button1
	    _Weitergeben()
    EndSwitch 
WEnd 

Func _Weitergeben() 
	$read=GUICtrlRead($input1,1) ;input1 auslesen
	GUICtrlSetData($input2,$read);Data aus input1 auf input2 übertragen
EndFunc
Read Me is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Q] Funktion in Button machen
06/01/2010 - AutoIt - 2 Replies
Hey ! Ich habe mir ein kleines Programm mit KODA bzw. AutoIT gemacht, möchte jetzt aber das wenn ich den "Abbrechen"-Button benutze das sich das Programm dann schließt. Wie geht das ? Hier mein Code : #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Z", 122, 56, 303, 219) $Abbrechen = GUICtrlCreateButton("Abbrechen", 24, 16, 75, 25, 0)
WarRock statt KOREANISCHE BUTTON --> Englische BUTTON
02/26/2010 - WarRock - 6 Replies
Bin mir nicht sicher ob es diesen Thread schon gibt aber hab bis jetzt nichts gesehen hier. Funktionen Für WarRock Korea Koreanische Schriften (Button) weg und englische Schriften (Button) hin Anleitung
Button mit Func belegen
04/07/2009 - General Coding - 2 Replies
Hi Leute Ich habe hier ein Gui fenster mit koda gemacht und weiß aber nicht wie ich den Button mit einer Fuction belege kann mit das mal jmd sagen pls. Hier der skript: ; Script Start - Add your code below here #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=
Autoit3 Button Funktion
04/14/2008 - General Coding - 3 Replies
ICh suche hillfe will in autoit ein programm erstellen das z.B. auf klick "button" mause bewegt "mousemove(200, 200) habe biss jetzt kein richtigen code gefunden:D kann wer mir mal helfen?? #include <GUIConstants.au3> GUICreate("My GUI") $Button1 = GUICtrlCreateButton( "noob", 75, 75 ,75 ,75, $BS_ICON) GUISetState (@SW_SHOW)
Andere Tasten belegen?
11/17/2005 - World of Warcraft - 2 Replies
Hi @ all! Ich hab auf nem Screenshot gesehn, dass der ne Leiste gehabt hat unten, die auch durch andere Hotkeys aktiviert werden können. Also wenn ich zum beispiel A und 2 drücke, dass mein Mage mir dann nen Feuerball macht. Hoffe, ihr versteht was ich meine! mfg Fireblade



All times are GMT +1. The time now is 15:58.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.