Sign in to follow this  
Followers 0
Gerald

how can i replace ^

14 posts in this topic

my problem is wen i type the symbol of ^ and wen i press my hot key to send info the symbol is not = ^ there is no simbol plss help me :)

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=D:\Form2.kxf
$Form2 = GUICreate("Dota Hotkey + V.1.2 By: Gerald Catague", 416, 295, 279, 240)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("Msg Setting", 32, 136, 177, 121)
$Input1 = GUICtrlCreateInput("ala hero d2", 72, 160, 121, 21)
$Input2 = GUICtrlCreateInput("Push tayo d2", 72, 184, 121, 21)
$Input3 = GUICtrlCreateInput("back n sir", 72, 208, 121, 21)
$Input4 = GUICtrlCreateInput("hahaha", 72, 232, 121, 21)
$Label1 = GUICtrlCreateLabel("F2", 48, 160, 16, 17)
$Label2 = GUICtrlCreateLabel("F3", 48, 184, 16, 17)
$Label3 = GUICtrlCreateLabel("F4", 48, 208, 16, 17)
$Label4 = GUICtrlCreateLabel("F5", 48, 232, 16, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Skill Settings", 224, 136, 161, 121)
$Label5 = GUICtrlCreateLabel("q = ", 248, 152, 18, 17)
$Label6 = GUICtrlCreateLabel("w =", 248, 176, 20, 17)
$Label7 = GUICtrlCreateLabel("e =", 248, 200, 18, 17)
$Label8 = GUICtrlCreateLabel("r  =", 248, 224, 15, 17)
$Combo1 = GUICtrlCreateCombo("", 272, 152, 105, 25)
GUICtrlSetData(-1, "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|w|x|y|z","a")
$Combo2 = GUICtrlCreateCombo("", 272, 176, 105, 25)
GUICtrlSetData(-1, "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|w|x|y|z","b")
$Combo3 = GUICtrlCreateCombo("", 272, 200, 105, 25)
GUICtrlSetData(-1, "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|w|x|y|z","d")
$Combo4 = GUICtrlCreateCombo("", 272, 224, 105, 25)
GUICtrlSetData(-1, "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|w|x|y|z","d")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("OK", 144, 264, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Exit", 232, 264, 75, 25, 0)
$Button3 = GUICtrlCreateButton("Help", 320, 264, 75, 25, 0)
$Pic1 = GUICtrlCreatePic("3.jpg", 112, 16, 188, 100)
GUISetState(@SW_SHOW)
Global $hotkeysset = False
HotKeySet("{Home}", "TogglePause")
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $Button2
            Exit
        case $Button1
            TogglePause()
            
    EndSwitch
WEnd
Func TogglePause()
    $hotkeysset = Not $hotkeysset
    If $hotkeysset = True Then
        _enablehotkeys()
        skillset()  
    Else
        _disablehotkeys()
        stopskill()
    EndIf

    
EndFunc ;==>TogglePause

Func skillset() 

HotKeySet("q", "skillcombo1") ;Shift-Alt-d
HotKeySet("w", "skillcombo2") ;Shift-Alt-d
HotKeySet("e", "skillcombo3") ;Shift-Alt-d
HotKeySet("r", "skillcombo4") ;Shift-Alt-d

 ;Shift-Alt-d
TrayTip("Dota Hotkey and Auto Send msg", "hotkey Runing to Disable Press End", 5, 1)
EndFunc
Func stopskill()    
HotKeySet("q") ;Shift-Alt-d
HotKeySet("w") ;Shift-Alt-d
HotKeySet("e") ;Shift-Alt-d
HotKeySet("r") ;Shift-Alt-d

 ;Shift-Alt-d
TrayTip("Dota Hotkey and Auto Send msg", "hotkey Runing to Disable Press End", 5, 1)
EndFunc
func _enablehotkeys()
    
GUICtrlSetState($Combo1, $GUI_DISABLE)
GUICtrlSetState($Combo2, $GUI_DISABLE)
GUICtrlSetState($Combo3, $GUI_DISABLE)
GUICtrlSetState($Combo4, $GUI_DISABLE)
    
GUICtrlSetState($Input1, $GUI_DISABLE)
GUICtrlSetState($Input2, $GUI_DISABLE)
GUICtrlSetState($Input3, $GUI_DISABLE)
GUICtrlSetState($Input4, $GUI_DISABLE)
GUICtrlSetData($Button1, "Stop")
EndFunc
func _disablehotkeys()
GUICtrlSetData($Button1, "OK")
GUICtrlSetState($Combo1, $GUI_ENABLE)
GUICtrlSetState($Combo2, $GUI_ENABLE)
GUICtrlSetState($Combo3, $GUI_ENABLE)
GUICtrlSetState($Combo4, $GUI_ENABLE)
GUICtrlSetState($Input1, $GUI_ENABLE)
GUICtrlSetState($Input2, $GUI_ENABLE)
GUICtrlSetState($Input3, $GUI_ENABLE)
GUICtrlSetState($Input4, $GUI_ENABLE)

EndFunc


Func skillcombo1()
    

    Send(StringReplace(GUICtrlRead($Input1), "^", "/*^"))
    
    
EndFunc
Func skillcombo2()
        
    Send(GUICtrlRead($Combo2))
    
    
EndFunc
Func skillcombo3()
        
    Send(GUICtrlRead($Combo3))
    
    
EndFunc
Func skillcombo4()
        
    Send(GUICtrlRead($Combo4))
    
    
EndFunc

Share this post


Link to post
Share on other sites



'^' has a special meaning to the Send function (and for ControlSend) which means it send a ctrl click. Use {^} instead.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

'^' has a special meaning to the Send function (and for ControlSend) which means it send a ctrl click. Use {^} instead.

thank you bro my code is ok now thank you very much thank for you suggestion

Edited by Gerald

Share this post


Link to post
Share on other sites

i have a second problem about this code

why if i type ! and + there are no symbol appear in my notepad wen i press the key please help me ASAp

thank you :)

Share this post


Link to post
Share on other sites

Send(StringReplace(GUICtrlRead($Input1), "!", "{!}"))

how can code more stringreplace in one line code plss help

Share this post


Link to post
Share on other sites

i have a second problem about this code

why if i type ! and + there are no symbol appear in my notepad wen i press the key please help me ASAp

thank you :)

Make sure you're sending "raw" keystrokes to notepad.

From the help file for the Send() function:

Send ( "keys" [, flag] )
-----
Parameters:
keys = The sequence of keys to send. 
flag [optional] = Changes how "keys" is processed:
                        flag = 0 (default), Text contains special characters like + and ! to indicate SHIFT and ALT key-presses.
                        flag = 1, keys are sent raw.

Share this post


Link to post
Share on other sites

Make sure you're sending "raw" keystrokes to notepad.

From the help file for the Send() function:

Send ( "keys" [, flag] )
-----
Parameters:
keys = The sequence of keys to send. 
flag [optional] = Changes how "keys" is processed:
                        flag = 0 (default), Text contains special characters like + and ! to indicate SHIFT and ALT key-presses.
                        flag = 1, keys are sent raw.

can i set the code in one line and add more string replace

thank you for you suggestion

Share this post


Link to post
Share on other sites

can i set the code in one line and add more string replace

thank you for you suggestion

You can either just keep doing StringReplaces on the same line, or you can keep offloading the result to the same variable and calling it again. (tends to be neater).

Example:

$string = "12345!?#@$"
MsgBox (0, "", StringReplace (StringReplace (StringReplace (StringReplace (StringReplace($string, "1", ""), "2", ""), "!", ""), "@", ""), "$", ""))

$string = StringReplace ($string, "1", "")
$string = StringReplace ($string, "2", "")
$string = StringReplace ($string, "!", "")
$string = StringReplace ($string, "@", "")
$string = StringReplace ($string, "$", "")

MsgBox (0, "", $string)

Share this post


Link to post
Share on other sites

You can either just keep doing StringReplaces on the same line, or you can keep offloading the result to the same variable and calling it again. (tends to be neater).

Example:

$string = "12345!?#@$"
MsgBox (0, "", StringReplace (StringReplace (StringReplace (StringReplace (StringReplace($string, "1", ""), "2", ""), "!", ""), "@", ""), "$", ""))

$string = StringReplace ($string, "1", "")
$string = StringReplace ($string, "2", "")
$string = StringReplace ($string, "!", "")
$string = StringReplace ($string, "@", "")
$string = StringReplace ($string, "$", "")

MsgBox (0, "", $string)
thanks for the code can you set this in inputbox

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

can i set the code in one line and add more string replace

thank you for you suggestion

Yes. You can nest StringReplace() functions. So you can:

StringReplace(StringReplace("name{at}host{dot}com", "{at}, "@"), "{dot}", ".")

Edit: Yeah, what he said. :)

Edited by Envoi

Share this post


Link to post
Share on other sites

Func skillcombo1()
    $string = StringReplace ($string, "1", "222")
$string = StringReplace ($string, "2", "ww")
$string = StringReplace ($string, "!", "s")
$string = StringReplace ($string, "@", "s")
$string = StringReplace ($string, "$", "ss")

    Send($string)
    
    
EndFunc

error why i got error can some one fix this

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Func skillcombo1()
    $string = StringReplace ($string, "1", "222")
$string = StringReplace ($string, "2", "ww")
$string = StringReplace ($string, "!", "s")
$string = StringReplace ($string, "@", "s")
$string = StringReplace ($string, "$", "ss")

    Send($string)
    
    
EndFunc

error why i got error can some one fix this

Did you declare $string? Because I don't see it being passed in this function. Edited by Envoi

Share this post


Link to post
Share on other sites

error why i got error can some one fix this

And for future reference, the error almost always tells you exactly what's wrong with your code, one of the nice things about AutoIt...

Share this post


Link to post
Share on other sites

And for future reference, the error almost always tells you exactly what's wrong with your code, one of the nice things about AutoIt...

thank you for the tips now my function is work properly

i will post my script if i have done :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0