Autoit Problem *Anfänger*

07/25/2009 15:54 .MrBurns#1
Hi Leute, ich habe ein problem ^^
Ich möchte eine Einfache Form erstellen mit einem Button .
So weit so gut..habs halt mit Koda gemacht und so sieht es bis jetz aus
Quote:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Yannik\Desktop\Form10.kxf
$Form1 = GUICreate("Close", 231, 215, 188, 140)
GUISetIcon("C:\Users\Yannik\Desktop\oO.ico")
$Button1 = GUICtrlCreateButton("Herunterfahren", 0, 8, 225, 201, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

EndSwitch
WEnd
Schön schön, nur ich möchte jetz, dass wenn ich auf den Button Klicke er den Pc herunterfährt [shutdown(0)]
Ich habe es so ausprobiert
Quote:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Yannik\Desktop\Form10.kxf
$Form1 = GUICreate("Close", 231, 215, 188, 140)
GUISetIcon("C:\Users\Yannik\Desktop\oO.ico")
$Button1 = GUICtrlCreateButton("Herunterfahren", 0, 8, 225, 201, $WS_GROUP)
GUISetState(@SW_SHOW)
if $Button1 Then
Shutdown(0)
EndIf
#EndRegion ### END Koda GUI section ###

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

EndSwitch
WEnd
Mir fiel nichts anderen ein als
Quote:
if $Button1 Then
Shutdown(0)
EndIf
das soll halt heissen falls man den button 1 klickt, soll er herunterfahren .
Also als ich es getestet habe(F5) ist der pc direkt heruntergefahren.. :confused::confused:
könnte mir jemand den code sagen, dass wenn ich auf den button klicke er herunter fährt? Wäre super

lg euer Autoit anfänger xP
07/25/2009 15:58 bUTL9R#2
Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Yannik\Desktop\Form10.kxf
$Form1 = GUICreate("Close", 231, 215, 188, 140)
GUISetIcon("C:\Users\Yannik\Desktop\oO.ico")
$Button1 = GUICtrlCreateButton("Herunterfahren", 0, 8, 225, 201, $WS_GROUP)
GUISetState(@SW_SHOW)
if $Button1 Then
Shutdown(0)
EndIf
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
;hier die änderung
Case Button1
       Shutdown(0)
EndSwitch
WEnd
Bitte lerne den Umgang mit der Tabulator Taste
07/25/2009 18:40 .MrBurns#3
Danke dir, so ein neues Problem, will das wenn man button 1 drückt er aus der Inputbox1 den text entnimmt und ihn in einer msgbox wieder gibt.
Bei mir zeigt er aber immer "6" an, anstatt den Inhalt der Inputbox oO
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 445, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 64, 176, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 296, 96, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Button3", 408, 240, 75, 25, $WS_GROUP)
$Input1 = GUICtrlCreateInput("Input1", 56, 152, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 296, 72, 121, 21)
$Input3 = GUICtrlCreateInput("Input3", 392, 216, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		[COLOR="Red"]case $Button1
		msgbox(0,"der Inhalt ist", $Input1)[/COLOR]

	EndSwitch
WEnd
07/26/2009 19:25 Adroxxx#4
#Falsches Forum
#moved
07/26/2009 19:36 AllesVergeben#5
Quote:
Originally Posted by gamerfreddie View Post
Danke dir, so ein neues Problem, will das wenn man button 1 drückt er aus der Inputbox1 den text entnimmt und ihn in einer msgbox wieder gibt.
Bei mir zeigt er aber immer "6" an, anstatt den Inhalt der Inputbox oO
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 445, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 64, 176, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 296, 96, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Button3", 408, 240, 75, 25, $WS_GROUP)
$Input1 = GUICtrlCreateInput("Input1", 56, 152, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 296, 72, 121, 21)
$Input3 = GUICtrlCreateInput("Input3", 392, 216, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		case $Button1
		msgbox(0,"Der Inhalt ist", GUIctrlread($Input1))

	EndSwitch
WEnd
GUIctrlread($Input1) ist es, habs reingebaut.