Jump to content

Whats wrong in my code?


qixx
 Share

Recommended Posts

What is wrong in my Script?

This have to press the Key: $Input11

and give out the Text: $Input1

But it doesn't do this. >_<

Why?

If you find other mistakes, too, please

let me know. :(

Thank you for Help!

Complete Code:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>





$Form1_1 = GUICreate("GTA-Suchtis Keybinder", 984, 436, 200, 136)
$Input1 = GUICtrlCreateInput("", 8, 24, 153, 21)
$Input11 = GUICtrlCreateCombo("", 176, 24, 115, 21)
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|0|ß|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}|q|w|e|r|t|z|u|i|o|p|ü|a|s|d|f|g|h|j|k|l|ö|ä|y|x|c|v|b|n|m|,|.|-|#|+|{TAB}|{LSHIFT}|{RSHIFT}|{RCTRL}|{LCTRL}|{LALT}|{RALT}|{SPACE}|{NUMPAD0}|{NUMPAD2}|{NUMPAD3}|{NUMPAD4}|{NUMPAD5}|{NUMPAD6}|{NUMPAD7}|{NUMPAD8}|{NUMPAD9}|{NUMPADMULT}|{NUMPADADD}|{NUMPADSUB}|{NUMPADDIV}|{NUMPADDOT}|{NUMPADENTER}")



$MenuItem1 = GUICtrlCreateMenu("&Datei")
$MenuItem2 = GUICtrlCreateMenuItem("Speichern unter..", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Laden..", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Schließen", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenu("&Credits")
$MenuItem6 = GUICtrlCreateMenuItem("About", $MenuItem5)
GUISetState(@SW_SHOW)



HotKeySet(GUICtrlRead($Input11), "_start1")


Func _start1()
    Send("T")
    Sleep(100)
    Send(GUICtrlRead($Input1))
    Send("{ENTER}")
EndFunc


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $MenuItem4
            Exit
            
        Case $MenuItem6
            MsgBox(0, "About", "Dieses Tool wurde von qixx für die GTA-Suchtis geskriptet! Vielen Dank auch an Hann_Clammon, der mir sehr weitergeholfen hat!")
            
            
            
            
        
        Case $MenuItem2
            $inisave = FileSaveDialog("Datei Speichern...",@ScriptDir,"Ini-Datei (*.ini)",16,".ini")
            
            If @error Then
            
        Else
            $save1 = GUICtrlRead($Input1)
            IniWrite($inisave, "Text", "Command1", $save1)
            $save11 = GUICtrlRead($Input11)
            IniWrite($inisave, "Taste", "Taste1", $save11)
            EndIf
            
            
            
            
            
            
        Case $MenuItem3
            $iniopen = FileOpenDialog("Datei laden...",@ScriptDir,"Ini-Datei (*.ini)")
            
            If @error Then
            
        Else
            
            $edit1 = IniRead($iniopen, "Text", "Command1", "")
            ControlSetText("GTA-Suchtis Keybinder", "", $Input1, $edit1)
            $edit11 =IniRead($iniopen, "Taste", "Taste1", "")
            ControlSetText("GTA-Suchtis Keybinder", "", $Input11, $edit11)
            
            

            EndIf



            
    EndSwitch
WEnd
Link to comment
Share on other sites

If i add this into my script, the $input1 is

the same as $input11 and it doesn't work by

pressing the key. >_<

I'm not completely sure on what you are trying to do, but are you looking for _GUICtrlComboBox_AutoComplete() by any chance?
Link to comment
Share on other sites

I'm not completely sure on what you are trying to do

In $Input1 you type a Text

In §Inpot11 you change the key, you have to press to lets typing the text. >_<

e.g.:

$Input1 = EXAMPLE

$Input11 = {F12}

You press "F12" and the text "EXAMPLE" is writing in the document. :(

MfG

qixx

Link to comment
Share on other sites

I am wondering why you set the HotKey before running the loop, and I also don't know what the default HotKey is in $Input11. I suggest that you place message boxes in your code, and try to step through each stage until you find something you didn't expect. That way you should be able to hunt down the problem. I hope this helps you to solve it.

Link to comment
Share on other sites

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


Global $CurrentHotkey


$Form1_1 = GUICreate("GTA-Suchtis Keybinder", 984, 436, 200, 136)
$Input1 = GUICtrlCreateInput("", 8, 24, 153, 21)
$Input11 = GUICtrlCreateCombo("", 176, 24, 115, 21)
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|0|?|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}|q|w|e|r|t|z|u|i|o|p|?|a|s|d|f|g|h|j|k|l|?|?|y|x|c|v|b|n|m|,|.|-|#|+|{TAB}|{LSHIFT}|{RSHIFT}|{RCTRL}|{LCTRL}|{LALT}|{RALT}|{SPACE}|{NUMPAD0}|{NUMPAD2}|{NUMPAD3}|{NUMPAD4}|{NUMPAD5}|{NUMPAD6}|{NUMPAD7}|{NUMPAD8}|{NUMPAD9}|{NUMPADMULT}|{NUMPADADD}|{NUMPADSUB}|{NUMPADDIV}|{NUMPADDOT}|{NUMPADENTER}")



$MenuItem1 = GUICtrlCreateMenu("&Datei")
$MenuItem2 = GUICtrlCreateMenuItem("Speichern unter..", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Laden..", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Schlie?en", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenu("&Credits")
$MenuItem6 = GUICtrlCreateMenuItem("About", $MenuItem5)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $MenuItem4
            Exit
            
        Case $MenuItem6
            MsgBox(0, "About", "Dieses Tool wurde von qixx f?r die GTA-Suchtis geskriptet! Vielen Dank auch an Hann_Clammon, der mir sehr weitergeholfen hat!")
            
            
            
            
        
        Case $MenuItem2
            $inisave = FileSaveDialog("Datei Speichern...",@ScriptDir,"Ini-Datei (*.ini)",16,".ini")
            
            If @error Then
            
        Else
            $save1 = GUICtrlRead($Input1)
            IniWrite($inisave, "Text", "Command1", $save1)
            $save11 = GUICtrlRead($Input11)
            IniWrite($inisave, "Taste", "Taste1", $save11)
            EndIf
            
            
            
            
            
            
        Case $MenuItem3
            $iniopen = FileOpenDialog("Datei laden...",@ScriptDir,"Ini-Datei (*.ini)")
            
            If @error Then
            
        Else
            
            $edit1 = IniRead($iniopen, "Text", "Command1", "")
            ControlSetText("GTA-Suchtis Keybinder", "", $Input1, $edit1)
            $edit11 =IniRead($iniopen, "Taste", "Taste1", "")
            ControlSetText("GTA-Suchtis Keybinder", "", $Input11, $edit11)
            
            

            EndIf



        Case $Input11
            HotKeySet($CurrentHotkey)
            HotKeySet(GUICtrlRead($Input11),"_ComboSend")
            $CurrentHotkey = GUICtrlRead($Input11)
    EndSwitch
WEnd

Func _ComboSend()
    Send("T")
    Send(GUICtrlRead($Input1))
    Send("{Enter}")
EndFunc

Edited by Info
Link to comment
Share on other sites

Could you help me again, pls? >_<

My question:

If I use _SendMes1() the functions

_SendMes2() and _SendMes3() should

be deaktivated.

Func _SendMes1()
    ;DEACTIVATE _SendMes2() and _SendMes3()
    If WinActive("GTA:SA:MP") Then
    Send(GUICtrlRead($Input1))
    ;ACTIVATE _SendMes2() and _SendMes3()
    EndIf
EndFunc

Original part of the code:

Func _SendMes1()
    
    If WinActive("GTA:SA:MP") Then
    Send(GUICtrlRead($Input1))
    EndIf
EndFunc

Func _SendMes2()
    If WinActive("GTA:SA:MP") Then
    Send(GUICtrlRead($Input2))
    EndIf
EndFunc

Func _SendMes3()
    If WinActive("GTA:SA:MP") Then
    Send(GUICtrlRead($Input3))
    EndIf
EndFunc
Link to comment
Share on other sites

not sure if this is what you mean by "deactivating"

Global fl=0
Func _SendMes1()
    
    $fl=1
If WinActive("GTA:SA:MP") Then
    Send(GUICtrlRead($Input1))
    EndIf
$fl=0
EndFunc

Func _SendMes2()
if $fl==1 Then Return
    If WinActive("GTA:SA:MP") Then
    Send(GUICtrlRead($Input2))
    EndIf
EndFunc

Func _SendMes3()
if $fl==1 Then Return
    If WinActive("GTA:SA:MP") Then
    Send(GUICtrlRead($Input3))
    EndIf
EndFunc
Edited by muhmuuh

I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...