Jump to content
Sign in to follow this  
royco

[almost solved] need help

Recommended Posts

royco

almost done

the only problem i m having is when

i changing name ((title name)) and trying to change name for another window its changeing the name of the first window

any idea

thanks

hi

im kinda stuck with my sctipt

the idea is like that

i choose key from 0 to 9 and the program start looping pressing that key,

also i added time between for exemple i want key 1 press every 5 sec

and key 3 every 8 sec

and the final thing is that i wanted to stop all looping after some time

please help by orgenize this script

here's my script

thanks

* the stop time still not working

* pressing in order not simultaneously, i need that every press count is own time

#include <GUIConstants.au3>
    #include <TreeViewConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #Include <Misc.au3>


    Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode


    $mainwindow = GUICreate("Royco Auto Clicker" ,290, 270)
    GUISetBkColor(0xE0F0FE)


    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

    GUICtrlCreateLabel("Just press to begin mouse" & @CRLF & "or Keyboard Clicking", 15, 10, 150)
    GUICtrlCreateLabel("Made By RoyCo",209,255)
    GUICtrlCreateLabel("How much time to run?",15 ,220)

    $group_1 = GUICtrlCreateGroup ("Choose", 5, 47,140, 110)
    GUICtrlSetBkColor(-1,0X44bbcc)
    GUICtrlCreateLabel("* Mouse Left click =  F9", 15, 65)
    GUICtrlCreateLabel("* Mouse Right click= F10",15, 85)
    GUICtrlCreateLabel("* Stop All actions = F11", 15, 105)
    GUICtrlCreateLabel("* Start Buff = F8", 15,125, 85)


    GUISetState(@SW_SHOW)


    $go = GUICtrlCreateButton("go", 175, 215, 30)

    $countdown = GUICtrlCreateInput("", 130,218, 40, 20)

    $title = wingettitle ('[active]','')


    HotKeySet("{F9}", "startclick")
    Hotkeyset("{F10}",  "Rightclick")
    HotkeySet("{F11}", "HK_STOP")
    HotKeySet("{F8}", "Buff")


    ; gui create check box
    $item1 = GUICtrlCreateCheckbox("1", 165,4, 40, 20)
    $input1 = GUICtrlCreateInput("1000", 210,2, 40, 20)
                GUICtrlCreateLabel("MSec", 252,3,40,20)
    $item2 = GUICtrlCreateCheckbox("2", 165,23, 40,20)
    $input2 = GUICtrlCreateInput("1000", 210,22, 40, 20)
                GUICtrlCreateLabel("MSec", 252,22,40,20)
    $item3 = GUICtrlCreateCheckbox("3", 165,43 ,40, 20)
    $input3 = GUICtrlCreateInput("1000", 210,42, 40, 20)
                GUICtrlCreateLabel("MSec", 252,42,40,20)
    $item4 = GUICtrlCreateCheckbox("4", 165,63, 40, 20)
    $input4 = GUICtrlCreateInput("1000", 210,62, 40, 20)
                GUICtrlCreateLabel("MSec", 252,62,40,20)
    $item5 = GUICtrlCreateCheckbox("5", 165,83, 40, 20)
    $input5 = GUICtrlCreateInput("1000", 210,82, 40, 20)
                GUICtrlCreateLabel("MSec", 252,82,40,20)
    $item6 = GUICtrlCreateCheckbox("6", 165,103, 40, 20)
    $input6 = GUICtrlCreateInput("1000", 210,102, 40, 20)
                GUICtrlCreateLabel("MSec", 252,102,40,20)
    $item7 = GUICtrlCreateCheckbox("7", 165,123, 40, 20)
    $input7 = GUICtrlCreateInput("1000", 210,122, 40, 20)
                GUICtrlCreateLabel("MSec", 252,122,40,20)
    $item8 = GUICtrlCreateCheckbox("8", 165,143, 40, 20)
    $input8 = GUICtrlCreateInput("1000", 210,142, 40, 20)
                GUICtrlCreateLabel("MSec", 252,142,40,20)
    $item9 = GUICtrlCreateCheckbox("9", 165,163, 40, 20)
    $input9 = GUICtrlCreateInput("1000", 210,162, 40, 20)
                GUICtrlCreateLabel("MSec", 252,162,40,20)
    $item0 = GUICtrlCreateCheckbox("0", 165,183, 40, 20)
    $input0 = GUICtrlCreateInput("1000", 210,182, 40, 20)
                GUICtrlCreateLabel("mSec", 252,182,40,20)

    While 1
        Sleep(100)
    WEnd

    Func Buff()
    While 1
            If (GUICtrlRead ($item1) = "1") Then
                ControlSend ("","","","{1}")
                Sleep (GUICtrlRead($input1))
            EndIf
            If (GUICtrlRead ($item2) = "1") Then
                ControlSend ("","","","{2}")
                Sleep(GUICtrlRead($input2))
            EndIf
            If (GUICtrlRead ($item3) = "1") Then
                ControlSend ("","","","{3}")
                Sleep(GUICtrlRead($input3))
            EndIf
            If (GUICtrlRead ($item4) = "1") Then
                ControlSend ("","","","{4}")
                Sleep(GUICtrlRead($input4))
            EndIf
            If (GUICtrlRead ($item5) = "1") Then
                ControlSend ("","","","{5}")
                Sleep(GUICtrlRead($input5))
            EndIf
            If (GUICtrlRead ($item6) = "1") Then
                ControlSend ("","","","{6}")
                Sleep(GUICtrlRead($input6))
            EndIf
            If (GUICtrlRead ($item7) = "1") Then
                ControlSend ("","","","{7}")
                Sleep(GUICtrlRead($input7))
            EndIf
            If (GUICtrlRead ($item8) = "1") Then
                ControlSend ("","","","{8}")
                Sleep(GUICtrlRead($input8))
            EndIf
            If (GUICtrlRead ($item9) = "1") Then
                ControlSend ("","","","{9}")
                Sleep(GUICtrlRead($input9))
            EndIf
            If (GUICtrlRead ($item0) = "1") Then
                ControlSend ("","","","{0}")
                Sleep(GUICtrlRead($input0))
            EndIf
    WEnd
    EndFunc



    Func go()

        For $time = GUICtrlRead($countdown) To 0 Step -1
        winsettitle (WinGetTitle ('[active]',''),'', $time & " second left")
        ToolTip($time ,800,0, "second left")
        Next
        winsettitle (WinGetTitle ('[active]',''),'', $title)

    EndFunc


    ; This is the clicking function
    Func startclick()
    ; Continuous loop
    while(1)
    MouseClick("left")
    Opt("MouseClickDelay", 100)
    WEnd
    EndFunc

    Func Rightclick()
    while(1)
    MouseClick("Right")
    OPT ("Mouseclickdelay", 100)

    WEnd
    EndFunc



    Func CLOSEClicked()
      Exit
    EndFunc

    ; Stops the program
    Func HK_STOP()
    while 1 = 1
        Sleep(1000)
    WEnd
    EndFunc

Edited by royco

Share this post


Link to post
Share on other sites
Melba23

royco,

I am having trouble understanding exactly what you are trying to do. I seem to understand that:

- You want F9 and F10 to simulate left and right mouseclicks whenever pressed.

- You want to select one or more of the number keys (0-9) to be pressed at individually defined intervals - starting when F8 is pressed.

- F11 should stop the key presses, or the script should stop itself after a preset time.

Have I got it right?

Are you running the Beta 3.3.1.1 or the standard 3.3.0.0?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
royco

you are correct

im using standard 3.3.0.0

Edited by royco

Share this post


Link to post
Share on other sites
Melba23

royco,

Here is how I would do what you want:

#include <GUIConstants.au3>
#include <TreeViewConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
#include <Misc.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
Opt("MouseClickDelay", 100) ; Set mouse click delay

; Set global variables
Global $fStop_Flag = False, $fTimer_Flag = False, $iTimer

; Set Hot keys
HotKeySet("{F9}", "Leftclick")
HotKeySet("{F10}", "Rightclick")
HotKeySet("{F11}", "HK_STOP")
HotKeySet("{F8}", "Buff")

; create GUI
$mainwindow = GUICreate("Royco Auto Clicker", 290, 270)
GUISetBkColor(0xE0F0FE)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUICtrlCreateLabel("Just press to begin mouse" & @CRLF & "or Keyboard Clicking", 15, 10, 150)
GUICtrlCreateLabel("Made By RoyCo", 209, 255)
GUICtrlCreateLabel("How much time to run?", 15, 220)

$group_1 = GUICtrlCreateGroup("Choose", 5, 47, 140, 110)
GUICtrlSetBkColor(-1, 0X44bbcc)
GUICtrlCreateLabel("* Mouse Left click =  F9", 15, 65)
GUICtrlCreateLabel("* Mouse Right click= F10", 15, 85)
GUICtrlCreateLabel("* Stop All actions = F11", 15, 105)
GUICtrlCreateLabel("* Start Buff = F8", 15, 125, 85)
GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group

$go = GUICtrlCreateButton("go", 175, 215, 30)
GUICtrlSetOnEvent($go, "on_go")

$countdown = GUICtrlCreateInput("", 130, 218, 40, 20)

$title = WinGetTitle('[active]', '')

; gui create check box
$item0 = GUICtrlCreateCheckbox("0", 165, 183, 40, 20)
$item1 = GUICtrlCreateCheckbox("1", 165, 4, 40, 20)
$item2 = GUICtrlCreateCheckbox("2", 165, 23, 40, 20)
$item3 = GUICtrlCreateCheckbox("3", 165, 43, 40, 20)
$item4 = GUICtrlCreateCheckbox("4", 165, 63, 40, 20)
$item5 = GUICtrlCreateCheckbox("5", 165, 83, 40, 20)
$item6 = GUICtrlCreateCheckbox("6", 165, 103, 40, 20)
$item7 = GUICtrlCreateCheckbox("7", 165, 123, 40, 20)
$item8 = GUICtrlCreateCheckbox("8", 165, 143, 40, 20)
$item9 = GUICtrlCreateCheckbox("9", 165, 163, 40, 20)

$input0 = GUICtrlCreateInput("1000", 210, 182, 40, 20)
$input1 = GUICtrlCreateInput("1000", 210, 2, 40, 20)
$input2 = GUICtrlCreateInput("1000", 210, 22, 40, 20)
$input3 = GUICtrlCreateInput("1000", 210, 42, 40, 20)
$input4 = GUICtrlCreateInput("1000", 210, 62, 40, 20)
$input5 = GUICtrlCreateInput("1000", 210, 82, 40, 20)
$input6 = GUICtrlCreateInput("1000", 210, 102, 40, 20)
$input7 = GUICtrlCreateInput("1000", 210, 122, 40, 20)
$input8 = GUICtrlCreateInput("1000", 210, 142, 40, 20)
$input9 = GUICtrlCreateInput("1000", 210, 162, 40, 20)

GUICtrlCreateLabel("mSec", 252, 182, 40, 20)
GUICtrlCreateLabel("MSec", 252, 3, 40, 20)
GUICtrlCreateLabel("MSec", 252, 22, 40, 20)
GUICtrlCreateLabel("MSec", 252, 42, 40, 20)
GUICtrlCreateLabel("MSec", 252, 62, 40, 20)
GUICtrlCreateLabel("MSec", 252, 82, 40, 20)
GUICtrlCreateLabel("MSec", 252, 102, 40, 20)
GUICtrlCreateLabel("MSec", 252, 122, 40, 20)
GUICtrlCreateLabel("MSec", 252, 142, 40, 20)
GUICtrlCreateLabel("MSec", 252, 162, 40, 20)

GUISetState(@SW_SHOW)

While 1
    Sleep(10)
WEnd

Func Buff()

    ; Create array to hold key/timer data
    Local $aKeys[10][3]

    ; Check required keys and delays
    For $i = 0 To 9
        If BitAND(GUICtrlRead($i + $item0), $GUI_CHECKED) = $GUI_CHECKED Then
            $aKeys[$i][0] = True
            $aKeys[$i][1] = GUICtrlRead($i + $input0)
        EndIf
    Next

    ; Set start time
    $iBegin = TimerInit()
    For $i = 0 To 9
        $aKeys[$i][2] = $iBegin
    Next

    ; Set timer countdown value
    $iCurr_Left = 0

    While 1
        ; Check if key press to be sent
        For $i = 0 To 9
            ; Send this key?
            If $aKeys[$i][0] = True Then
                ; Is it time to send this key?
                If TimerDiff($aKeys[$i][2]) > $aKeys[$i][1] Then
                    ; Send key
                    ConsoleWrite($i & @CRLF) ; You need to replace this with a ControlSend
                    ; Reset timer for this key
                    $aKeys[$i][2] = TimerInit()
                EndIf
            EndIf
        Next

        ; Check if Stop flag set
        If $fStop_Flag = True Then
            ; reset flag and exit loop
            $fStop_Flag = False
            ExitLoop
        EndIf

        ; Check if timer flag set
        If $fTimer_Flag = True Then
            ; have we timed out?
            If TimerDiff($iBegin) > $iTimer Then
                ; Reset timer, window title and tooltip and exit loop
                $fTimer_Flag = False
                WinSetTitle($mainwindow, "", "Royco Auto Clicker")
                ToolTip("")
                ExitLoop
            Else
                ; calculate time left
                $iLeft = Int(($iTimer - TimerDiff($iBegin)) / 1000)
                ; do we need to change title and tooltip (if we change every time they flicker!)
                If $iLeft <> $iCurr_Left Then
                    ; So change them
                    WinSetTitle($mainwindow, "", $iLeft & " seconds left")
                    ToolTip($iLeft, 800, 0, "seconds left")
                    $iCurr_Left = $iLeft
                EndIf
            EndIf
        EndIf

    WEnd

EndFunc   ;==>Buff

; This is the clicking function
Func Leftclick()
    ; Continuous loop
    While 1
        ConsoleWrite('MouseClick("left")' & @CRLF)  ; You will need to modify this line
        ; Check for stop flag
        If $fStop_Flag = True Then
            $fStop_Flag = False
            ExitLoop
        EndIf
        Sleep(10)
    WEnd
EndFunc   ;==>Leftclick

Func Rightclick()
    While 1
    ConsoleWrite('MouseClick("right")' & @CRLF)  ; You will need to modify this line
        ; Check for stop flag
        If $fStop_Flag = True Then
            $fStop_Flag = False
            ExitLoop
        EndIf
        Sleep(10)
    WEnd
EndFunc   ;==>Rightclick

Func on_go()
    ;Set timer and timer flag
    $iTimer = GUICtrlRead($countdown)
    $fTimer_Flag = True
EndFunc

Func CLOSEClicked()
    Exit
EndFunc   ;==>CLOSEClicked

; Stops the program
Func HK_STOP()
    ; Set the stop flag
    $fStop_Flag = True
EndFunc   ;==>HK_STOP

There are quite a few changes :P. A couple of explanatory notes:

1. I have reordered the creation of the key checkboxes and timing inputs. This allows the use of a loop to fill the $aKeys array - much tighter code! :)

2. The main loop then runs through the array and checks if a key is to be pressed and, if so, whether it is time to do it. I quite like that bit! :)

3. Each of the loops (mouse left/right and keys) checks for the stop hotkey and stops if it is pressed. The key loop also looks for the timeout set by the bottom input.

4. As I did not know what app you were trying to send the mouse clicks/keys to, I have changed the MouseClick and ControlSend lines to ConsoleWrites so that the events appear in the SciTE console. You will have to change them back....

I have commented the code fairly liberally so I hope you can see what is going on in the other areas.

Please ask if anything is not clear.

M23

P.S. The reason I asked about the version you are running is because with 3.3.1.1 you can use multiple Adlibs which will allow a different approach to the coding.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
royco

thanks a lot

could you help me do it in seconds instead of miliseconds

Edited by royco

Share this post


Link to post
Share on other sites
royco

still learning

i combine this clicker with list view i found in this forum (thanks to Moonshadow312 and AdmiralAlkex) heres the link

this is clicker to game called silkroad online is supposed to find the windows from the game, in case i open more then 1 client and then choose 1 client rename it then Control_Send to the specified window (client)

few changes i want to made is :

1. want to change the counting down to second instead of milisecond

2. the Control_Send not working properly

realy appreciate any help

here is my code

; made by royco thanks to melba23 for editing my script and make a lot better
; to Moonshadow312 and AdmiralAlkex for the winlist

#include <ListViewConstants.au3>
#include <GUIConstantsEx.au3>
#Include <GuiListView.au3>
;#include <Marquee.au3>



Global $Client[1][1], $Array[1], $fStop_Flag = False, $fTimer_Flag = False, $iTimer

$Form1 = GUICreate("Silkroad Buffer - Ver 1,         royco", 280, 440, 193, 90)
GUISetBkColor(0xE0F0FE)
$listview = GUICtrlCreateListView("Client Name", 5, 40, 270, 155, BitOR($LVS_SORTDESCENDING, $LVS_LIST, $LVS_SHOWSELALWAYS));The right way to have multiple styles is with BitOr()
$inputNewName = GUICtrlCreateInput("Sro_1",5,8,60,25)
$Button7 = GUICtrlCreateButton("Rename", 75, 8, 60, 25)
GUICtrlSetBkColor(-1,0X88dddd)
$Button6 = GUICtrlCreateButton("Refresh", 145, 8, 60, 25)
GUICtrlSetBkColor(-1,0X88dddd)
$get = GUICtrlCreateButton("Title (F7)", 215, 8, 60,25)
GUICtrlSetTip(-1 ,"to see if the window got the changes made")
GUICtrlSetBkColor(-1,0x44bbcc)

$countdown = GUICtrlCreateInput("Time_Left?", 5, 200, 60, 25)
$go = GUICtrlCreateButton("Set", 75, 200, 60,25)
GUICtrlSetTip(-1 ,"set the time, press this button, then Buff")
GUICtrlSetBkColor(-1,0Xff9900)
$Buff = GUICtrlCreateButton("Buff (F8)",145,200,60, 25) ;"{F8}", "Buff"
GUICtrlSetTip(-1 ,"Choose keys to press and start Buff")
GUICtrlSetBkColor(-1,0X00dd00)
$Stop = GUICtrlCreateButton("Stop (F11)",215 ,200,60,25) ;"{F11}", "HK_STOP"
GUICtrlSetTip(-1 ,"Stop all action")
GUICtrlSetBkColor(-1,0Xff1177)

GUICtrlCreateGroup("",130, 390,145,47)
GUICtrlSetBkColor(-1,0X44bbcc)
GUICtrlCreateLabel("Made by Royco" & @CRLF & "Thanks to Melba23",155,400)
GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group

;moving text
;_GUICtrlMarquee_SetScroll(0, Default, "up", 1)
;_GUICtrlMarquee_SetDisplay(2, "red", Default, 14, "comic sans ms")
;_GUICtrlMarquee_Create("Made by Royco Thanks to Melba23 AdmiralAlkex From  Autoit Forum",  130,395, 145, 30, "Vertical Scroll Up")

GUICtrlCreateGroup("Choose",130, 230, 145, 60)
GUICtrlCreateLabel("* Start Buff = F8" & @CRLF & "* Stop All actions = F11", 140, 249);, 85)
GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group

GUICtrlCreateGroup("",130, 290, 145, 100)
$font = GUICtrlCreateLabel("choose character then" & @CRLF & "change is name press rename" & @CRLF & "select key to press" & @CRLF & "select time press set" & @CRLF & "then BUFF",140,300,125,80)
GUICtrlSetFont($font,8,"","")
GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group


; check box to select what key to press
$item0 = GUICtrlCreateCheckbox("0", 5, 410, 40, 20)
$item1 = GUICtrlCreateCheckbox("1", 5, 230, 40, 20)
$item2 = GUICtrlCreateCheckbox("2", 5, 250, 40, 20)
$item3 = GUICtrlCreateCheckbox("3", 5, 270, 40, 20)
$item4 = GUICtrlCreateCheckbox("4", 5, 290, 40, 20)
$item5 = GUICtrlCreateCheckbox("5", 5, 310, 40, 20)
$item6 = GUICtrlCreateCheckbox("6", 5, 330, 40, 20)
$item7 = GUICtrlCreateCheckbox("7", 5, 350, 40, 20)
$item8 = GUICtrlCreateCheckbox("8", 5, 370, 40, 20)
$item9 = GUICtrlCreateCheckbox("9", 5, 390, 40, 20)

$input0 = GUICtrlCreateInput("1000", 45, 410, 40, 20)
$input1 = GUICtrlCreateInput("1000", 45, 230, 40, 20)
$input2 = GUICtrlCreateInput("1000", 45, 250, 40, 20)
$input3 = GUICtrlCreateInput("1000", 45, 270, 40, 20)
$input4 = GUICtrlCreateInput("1000", 45, 290, 40, 20)
$input5 = GUICtrlCreateInput("1000", 45, 310, 40, 20)
$input6 = GUICtrlCreateInput("1000", 45, 330, 40, 20)
$input7 = GUICtrlCreateInput("1000", 45, 350, 40, 20)
$input8 = GUICtrlCreateInput("1000", 45, 370, 40, 20)
$input9 = GUICtrlCreateInput("1000", 45, 390, 40, 20)

GUICtrlCreateLabel("mSec", 90, 410, 40, 20)
GUICtrlCreateLabel("mSec", 90, 230, 40, 20)
GUICtrlCreateLabel("mSec", 90, 250, 40, 20)
GUICtrlCreateLabel("mSec", 90, 270, 40, 20)
GUICtrlCreateLabel("mSec", 90, 290, 40, 20)
GUICtrlCreateLabel("mSec", 90, 310, 40, 20)
GUICtrlCreateLabel("mSec", 90, 330, 40, 20)
GUICtrlCreateLabel("mSec", 90, 350, 40, 20)
GUICtrlCreateLabel("mSec", 90, 370, 40, 20)
GUICtrlCreateLabel("mSec", 90, 390, 40, 20)


_Refresh()
GUISetState(@SW_SHOW)

;hotkeys
HotKeySet("{F8}","Buff")
HotKeySet("{F11}","HK_STOP")
HotKeySet("{F7}","GetTitle")
HotKeySet("{F6}","GetHandle")


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button6
            _Refresh()
        Case $Button7
            Rename()
        Case $Stop
            HK_STOP()
        Case $buff
            Buff()
        Case $go
            on_go()
        Case $get
            GetTitle()
    EndSwitch
WEnd


Func _SetState($State)
    $Array = _GUICtrlListView_GetSelectedIndices($listview, True)
    For $Y = 1 To $Array[0]
        WinSetState($Client[$Array[$Y]][1], "", $State)
    Next
EndFunc

Func _Refresh()
    _GUICtrlListView_BeginUpdate($listview)
    _GUICtrlListView_DeleteAllItems($listview)
    $Client = WinList("[CLASS:CLIENT]")
    If $Client[0][0] > 0 Then
        For $X = 1 To $Client[0][0]
            GUICtrlCreateListViewItem($Client[$X][0], $listview)
        Next
    Else
        GUICtrlCreateListViewItem("No Clients Found", $listview)
    EndIf
    _GUICtrlListView_EndUpdate($listview)
EndFunc  ;==>_Refresh

Func Rename()

    If  GUICtrlRead("[CLASS:CLIENT]") = "Default Name" Then
        WinSetTitle("[CLASS:CLIENT]","",GUICtrlRead($inputNewName))
        WinGetHandle($inputNewName)
        ;GUICtrlSetState($inputNewName, "")
        _Refresh()
    ;Else
     ;   WinSetTitle(GUICtrlRead("[CLASS:CLIENT]"), "", GUICtrlRead($inputNewName))
    EndIf
EndFunc

Func Buff()

    ; Create array to hold key/timer data
    Local $aKeys[10][3]

    ; Check required keys and delays
    For $i = 0 To 9
        If BitAND(GUICtrlRead($i + $item0), $GUI_CHECKED) = $GUI_CHECKED Then
            $aKeys[$i][0] = True
            $aKeys[$i][1] = GUICtrlRead($i + $input0)
        EndIf
    Next

    ; Set start time
    $iBegin = TimerInit()
    For $i = 0 To 9
        $aKeys[$i][2] = $iBegin
    Next

    ; Set timer countdown value
    $iCurr_Left = 0

    While 1
        ; Check if key press to be sent
        For $i = 0 To 9
            ; Send this key?
            If $aKeys[$i][0] = True Then
                ; Is it time to send this key?
                If TimerDiff($aKeys[$i][2]) > $aKeys[$i][1] Then
                    ;WinGetHandle(GUICtrlRead($inputNewName))
                    ; Send key
                    ;_WinAPI_LoadString($inputNewName,$i)
                    ;Do
                    ControlSend(GUICtrlRead($inputNewName), "", "Edit1",$i) ;  need to add value of what window to ControlSend
                    ;ControlSend("", "", "Edit1",$i) ;  need to add value of what window to ControlSend
                    ; Reset timer for this key
                    $aKeys[$i][2] = TimerInit()
                    ;Until $Stop = True
                EndIf
            EndIf
        Next

        ; Check if Stop flag set
        If $fStop_Flag = True Then
            ; reset flag and exit loop
            $fStop_Flag = False
            ExitLoop
        EndIf

        ; Check if timer flag set
        If $fTimer_Flag = True Then
            ; have we timed out?
            If TimerDiff($iBegin) > $iTimer Then
                ; Reset timer, window title and tooltip and exit loop
                $fTimer_Flag = False
                WinSetTitle($Form1, "", "Silkroad Client Manager")
                ToolTip("")
                ExitLoop
            Else
                ; calculate time left
                $iLeft = Int(($iTimer - TimerDiff($iBegin)) / 1000)
                ; do we need to change title and tooltip (if we change every time they flicker!)
                If $iLeft <> $iCurr_Left Then
                    ; So change them
                    WinSetTitle($Form1, "", $iLeft & " seconds left")
                    ToolTip($iLeft, 800, 0, "seconds left")
                    $iCurr_Left = $iLeft
                EndIf
            EndIf
        EndIf

    WEnd

EndFunc   ;==>Buff

Func on_go()
    ;Set timer and timer flag
    $iTimer = GUICtrlRead($countdown)
    $fTimer_Flag = True
EndFunc

; Stops the program
Func HK_STOP()
    ; Set the stop flag
    $fStop_Flag = True
EndFunc   ;==>HK_STOP

;win get title
Func GetTitle()
    $WGT = WinGetTitle("")
    MsgBox( 0, "The Title is" , $WGT )
EndFunc

;just to check what control ID , dont know how it work 
Func GetHandle()
    $WGH = WinGetHandle("")
    MsgBox( 0, "The Handle is" , $WGH )
EndFunc
Edited by royco

Share this post


Link to post
Share on other sites
somdcomputerguy

I probably can't help much with your ControlSend issue, but to change msecs to secs, just multiply by 1000's, ie. 3000 msec is 3 sec, 60000 msec is 1 minute (60 sec)


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.