|
You last visited: Today at 10:51
Advertisement
GUICtrlRead und WinSetState
Discussion on GUICtrlRead und WinSetState within the AutoIt forum part of the Coders Den category.
12/10/2009, 15:16
|
#1
|
elite*gold: 1
Join Date: Feb 2009
Posts: 1,726
Received Thanks: 729
|
GUICtrlRead und WinSetState
Hi, ich hätte da mal eine Frage. Und zwar programmier ich grade ein Programm (Script), das ein beliebiges Programm beendet, minimiert oder maximiert.
Mein Code:
PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Konfiguration", 447, 163, 192, 124)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("HotKey", 160, 16, 281, 137)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Fenster minimieren - Nummernfeld Minus", 176, 96, 251, 20)
$Label2 = GUICtrlCreateLabel("Anwendung Beenden - Ende", 176, 72, 167, 20)
$Label3 = GUICtrlCreateLabel("Programm Beenden - Escape", 176, 48, 188, 20)
$Label4 = GUICtrlCreateLabel("Fenster maximieren - Nummernfeld Plus", 176, 120, 246, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Programm Beenden", 8, 128, 123, 25, $WS_GROUP)
$Label5 = GUICtrlCreateLabel("Wie heißt das Programm?", 8, 24, 125, 17)
$Input1 = GUICtrlCreateInput("", 8, 48, 121, 21)
$Button2 = GUICtrlCreateButton("Speichern", 8, 80, 123, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
$read = INIRead ("C:\Settings.ini", "Main", "Value", "")
_GUICtrlEdit_SetText($Input1, $read)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Exit
Case $Button2
FileIniWrite()
EndSwitch
WEnd
$var = GUICtrlRead ($Input1)
Func FileIniWrite ()
$var = GUICtrlRead ($Input1)
IniWrite ("C:\Settings.ini", "Main", "Value", $var)
EndFunc
HotKeySet ("{ESC}", "Terminate")
HotKeySet ("{End}", "_CLOSE")
HotKeySet ("M", "MAx")
HotKeySet ("n", "Min")
Func Terminate ()
Exit 1
EndFunc
Func _CLOSE ()
WinKill ($var)
EndFunc
Func MAX ()
WinSetState ($var, "", @SW_SHOW)
EndFunc
Func Min ()
WinSetState ($var, "", @SW_HIDE)
EndFunc
Also Fehler enstehen keine (Syntaxfehler) aber es passiert einfach nix. Hab den Code mal an Solitär probiert, aber wenn ich M oder n drücke verkleinert noch vergrößert sich das fenster. Schließen kann ich es auch nicht. Woran liegt es?
mfg
|
|
|
12/10/2009, 15:55
|
#2
|
elite*gold: 1
Join Date: Oct 2008
Posts: 1,078
Received Thanks: 276
|
Die Hotkeys werden erst nach der Whileschleife eingestellt, funktionieren also nich
|
|
|
12/10/2009, 17:45
|
#3
|
elite*gold: 1
Join Date: Feb 2009
Posts: 1,726
Received Thanks: 729
|
Danke
|
|
|
12/10/2009, 18:04
|
#4
|
elite*gold: 1
Join Date: Oct 2008
Posts: 1,078
Received Thanks: 276
|
np
|
|
|
12/10/2009, 18:21
|
#5
|
elite*gold: 1
Join Date: Feb 2009
Posts: 1,726
Received Thanks: 729
|
Ich bin wohl bissel zu blöd dafür.
Das eigene Programm schließt sich, aber die Anwendung die geschlossen werden soll bleibt offen. Minimieren und maximieren geht erst gar nicht
|
|
|
12/10/2009, 19:18
|
#6
|
elite*gold: 0
Join Date: Apr 2009
Posts: 793
Received Thanks: 366
|
Quote:
Originally Posted by General Desert
Ich bin wohl bissel zu blöd dafür.
Das eigene Programm schließt sich, aber die Anwendung die geschlossen werden soll bleibt offen. Minimieren und maximieren geht erst gar nicht
|
Wenn sich dein Programm schließt, ist das meistens eine Folge von einen Runtime-Fehler. Guck mal in der Konsole, ob da was steht.
|
|
|
12/10/2009, 19:47
|
#7
|
elite*gold: 1371
Join Date: Dec 2007
Posts: 14,903
Received Thanks: 19,354
|
PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Konfiguration", 447, 163, 192, 124)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("HotKey", 160, 16, 281, 137)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Fenster minimieren - Nummernfeld Minus", 176, 96, 251, 20)
$Label2 = GUICtrlCreateLabel("Anwendung Beenden - Ende", 176, 72, 167, 20)
$Label3 = GUICtrlCreateLabel("Programm Beenden - Escape", 176, 48, 188, 20)
$Label4 = GUICtrlCreateLabel("Fenster maximieren - Nummernfeld Plus", 176, 120, 246, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Programm Beenden", 8, 128, 123, 25, $WS_GROUP)
$Label5 = GUICtrlCreateLabel("Wie heißt das Programm?", 8, 24, 125, 17)
$Input1 = GUICtrlCreateInput("", 8, 48, 121, 21)
$Button3 = GUICtrlCreateButton("Hotkey aktiviere", 8, 104, 123, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Speichern", 8, 80, 123, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
$read = INIRead ("C:\Settings.ini", "Main", "Value", "")
_GUICtrlEdit_SetText($Input1, $read)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Exit
Case $Button2
FileIniWrite()
Case $Button3
Hotkey()
EndSwitch
WEnd
Func FileIniWrite ()
$var = GUICtrlRead ($Input1)
IniWrite ("C:\Settings.ini", "Main", "Value", $var)
EndFunc
Func Hotkey ()
HotKeySet ("{ESC}", "Terminate")
HotKeySet ("{End}", "_CLOSE")
HotKeySet ("m", "Max")
HotKeySet ("n", "Min")
EndFunc
Func Terminate ()
Exit 1
EndFunc
Func _CLOSE ()
$var = GUICtrlRead($Input1)
WinKill ($var)
EndFunc
Func Max ()
$var = GUICtrlRead($Input1)
WinSetState ($var, "", @SW_MINIMIZE)
EndFunc
Func Min ()
$var = GUICtrlRead($Input1)
WinSetState ($var, "", @SW_RESTORE)
EndFunc
|
|
|
 |
Similar Threads
|
[Schnelle Hilfe]Guictrlread???
04/08/2010 - AutoIt - 2 Replies
Hallo
will mal schnell fragen mach grade nen script für mich in SciTe bzw. AutoIt...
also wie macht man das nochmal mit send, guictrlread under input?
also ich meins so ist falsch ich weiß... (glaub ich)
send(Guictrlread=$input1)
was hab ich da falsch gemacht?? hatte das mal im kopf doch dann hab ichs
vergessen thx für help.
|
Problem mit GUICtrlRead
11/26/2009 - AutoIt - 8 Replies
Wollte hier n Script machen welches ne eingegebene IP bzw Hostnamen pingen kann und auch nen anderen Rechner durchsuchen kann (das ist erstma zweitrangig).
Problem ist das das anpingen beim 1. mal funktioniert und beim 2. mal nur 0 gepingt wird.
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\hans\desktop\autoit test\lanchecker\w gui\lan checker v01a gui.kxf...
|
[HILFE] GuiCtrlRead funst nit
09/19/2009 - AutoIt - 10 Replies
Hey,
ich habe ein problem
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\admin\desktop\autoexpspender.kxf
$Auto = GUICreate("mouwMOUW", 633, 447, 193, 125)
GUISetBkColor(0x000080)
|
All times are GMT +1. The time now is 10:53.
|
|