Problem mit Macrotool(in Gui)

03/07/2011 17:55 Furkan#1
Was ist an dieser Source falsch?
PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet ("{F1}","F1")
HotKeySet ("{F2}","F2")
HotKeySet ("{F3}","F3")
HotKeySet ("{F4}","F4")
HotKeySet ("{F5}","F5")
HotKeySet ("{F6}","F6")
HotKeySet ("{F7}","F7")
HotKeySet ("{F8}","F8")
HotKeySet ("{F9}","F9")
HotKeySet ("{F10}","F10")
HotKeySet ("{F11}","F11")
HotKeySet ("{F12}","F12")

Func F1()
    
Send ($F1)
EndFunc

Func F2
()
    
Send ($F2)
EndFunc

Func F3
()
    
Send ($F3)
EndFunc

Func F4
()
    
Send ($F4)
EndFunc

Func F5
()
    
Send ($F5)
EndFunc

Func F6
()
    
Send ($F6)
EndFunc

Func F7
()
    
Send ($F7)
EndFunc

Func F8
()
    
Send ($F8)
EndFunc

Func F9
()
    
Send ($F9)
EndFunc

Func F10
()
    
Send ($F10)
EndFunc

Func F11
()
    
Send ($F11)
EndFunc

Func F12
()
    
Send ($F12)
EndFunc

#Region ### START Koda GUI section ### Form=
$MacroTool GUICreate("MacroTool"403517318227)
GUISetFont(84000"Comic Sans MS")
GUISetBkColor(0xFF0000)
$Label1 GUICtrlCreateLabel("MacroTool"24835871)
GUICtrlSetFont(-1354000"Comic Sans MS")
$F1 GUICtrlCreateInput("Text für F1"169637723)
$F2 GUICtrlCreateInput("Text für F2"1612737723)
$F3 GUICtrlCreateInput("Text für F3"1615837723)
$F4 GUICtrlCreateInput("Text für F4"1618937723)
$F5 GUICtrlCreateInput("Text für F5"1622037723)
$F6 GUICtrlCreateInput("Text für F6"1625137723)
$F7 GUICtrlCreateInput("Text für F7"1628237723)
$F8 GUICtrlCreateInput("Text für F8"1631337723)
$F9 GUICtrlCreateInput("Text für F9"1634337723)
$F10 GUICtrlCreateInput("Text für F10"1637537723)
$F11 GUICtrlCreateInput("Text für F11"1640637723)
$F12 GUICtrlCreateInput("Text für F12"1643737723)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
    EndSwitch
WEnd 
03/07/2011 18:03 PenGuin :O#2
Wie wärs, wenn du angibst WAS nicht geht?
03/07/2011 18:05 Furkan#3
Wenn ich nun zB. beim Editor F1 drücke kommt eine:4 raus. Bei F2 eine:5. Bei F3 eine:6 und die ganze Zahlenreihe weiter.. bis F12. Bei F12 kommt Nix
03/07/2011 18:18 PenGuin :O#4
Schau dir mal in der Hilfe "GUICtrlRead" an.
03/07/2011 18:26 Furkan#5
Quote:
Originally Posted by PenGuin :O View Post
Schau dir mal in der Hilfe "GUICtrlRead" an.
Danke es hat geklappt, aber nun noch eine Frage.. zB. wenn ich das jetzt machen will das man mit einer Checkbox wählen darf ob nun mit Enter oder ohne wie macht man es dann? ich habe es so gemacht, aber so klappt es nicht.(Ich hab das zum gucken nur mit F1 gemacht)

Script:
PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet ("{F1}","F1")
HotKeySet ("{F2}","F2")
HotKeySet ("{F3}","F3")
HotKeySet ("{F4}","F4")
HotKeySet ("{F5}","F5")
HotKeySet ("{F6}","F6")
HotKeySet ("{F7}","F7")
HotKeySet ("{F8}","F8")
HotKeySet ("{F9}","F9")
HotKeySet ("{F10}","F10")
HotKeySet ("{F11}","F11")

Func F1()
    $
GUICtrlRead ($F1)
    
Send ($1)
    If 
$Checkbox1 1 Then
        Send 
("{Enter}")
    ElseIf 
$Checkbox1 0 Then
        Sleep 
(1)
    EndIf
EndFunc

Func F2
()
    $
GUICtrlRead ($F2)
    
Send ($2)
EndFunc

Func F3
()
    $
GUICtrlRead ($F3)
    
Send ($3)
EndFunc

Func F4
()
    $
GUICtrlRead ($F4)
    
Send ($4)
EndFunc

Func F5
()
    $
GUICtrlRead ($F5)
    
Send ($5)
EndFunc

Func F6
()
    $
GUICtrlRead ($F6)
    
Send ($6)
EndFunc

Func F7
()
    $
GUICtrlRead ($F7)
    
Send ($7)
EndFunc

Func F8
()
    $
GUICtrlRead ($F8)
    
Send ($8)
EndFunc

Func F9
()
    $
GUICtrlRead ($F9)
    
Send ($9)
EndFunc

Func F10
()
    $
10 GUICtrlRead ($F10)
    
Send ($10)
EndFunc

Func F11
()
    $
11 GUICtrlRead ($F11)
    
Send ($11)
EndFunc

#Region ### START Koda GUI section ### Form=
$MacroTool GUICreate("MacroTool"477478318227)
GUISetFont(84000"Comic Sans MS")
GUISetBkColor(0xFF0000)
$Label1 GUICtrlCreateLabel("MacroTool"24835871)
GUICtrlSetFont(-1354000"Comic Sans MS")
$F1 GUICtrlCreateInput("Text für F1"169637723)
$F2 GUICtrlCreateInput("Text für F2"1612737723)
$F3 GUICtrlCreateInput("Text für F3"1615837723)
$F4 GUICtrlCreateInput("Text für F4"1618937723)
$F5 GUICtrlCreateInput("Text für F5"1622037723)
$F6 GUICtrlCreateInput("Text für F6"1625137723)
$F7 GUICtrlCreateInput("Text für F7"1628237723)
$F8 GUICtrlCreateInput("Text für F8"1631337723)
$F9 GUICtrlCreateInput("Text für F9"1634337723)
$F10 GUICtrlCreateInput("Text für F10"1637537723)
$F11 GUICtrlCreateInput("Text für F11"1640637723)
$Checkbox1 GUICtrlCreateCheckbox("Mit Enter"400967325)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
    EndSwitch
WEnd 
03/07/2011 19:10 derpo#6
$Checkbox1 ist ja die ID von der Checkbox, deswegen kann das ja nicht stimmen.
Wenn GUIGetMsg die ID der Checkbox zurückgibt, wurde dort entweder ein Haken gesetzt oder der Haken entfernt.
Dafür musst du eine Variable, die den Status zeigt, erstellen.
Du könntest theoretisch auch einfach in das Eingabefeld {Enter} an das Ende setzen.