XZ3R0 Posted October 2, 2008 Posted October 2, 2008 (edited) I have a script. I dont want anything to happen till you press "s" then i want it to draw a red box on the screen for 5 seconds, after i want the box to end and then continue with the rest of the script. Earlier i had the box working but it wouldn't move on, and so now i tried like 20 things and im all confused expandcollapse popup#include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> HotKeySet("s", "ToggleTick"); s key starts and stops HotKeySet("q", "Quit"); q key shuts down the script Dim $start[2] $start[0] = 475 $start[1] = 280 Dim $current[2] $current[0] = 1030 $current[1] = 630 Dim $TickTimer = "false" AdlibEnable("ToggleTick", 60000) Dim $box = "false" sleep(1000) $endbox=TimerInit() If TimerDiff($endbox)<5000 Then $box = "true" Else $box = "false" EndIf While 1=1 If $box = "true" then targetframe($start,$current,$box) sleep(5010) Else WinActivate("Gamevance"); browser title here MouseClick( "left", 760, 440, 1, 0); auto start Sleep(500) While 1 While $TickTimer = "True" $coor = PixelSearch( 475, 280, 1030, 630, 0xfcfcfc, 5, 8 ) While Not @error MouseClick ( "left", ($Coor[0]), ($Coor[1]), 1, 3 ) $coor = PixelSearch( 475, 280, 1030, 630, 0xfcfcfc, 5, 8 ) WEnd WEnd WEnd EndIf WEnd Func ToggleTick() If $TickTimer = "True" Then $TickTimer = "False" AdlibDisable() Else $TickTimer = "True" AdlibDisable() AdlibEnable("Toggletick", 60000) EndIf EndFunc Func Quit() Exit EndFunc Func targetframe($start,$current,$box) While $box = "true" $hd = DllCall("user32.dll", "int", "GetDC", "hwnd",0 ) $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", 2, "int", 0x0000ff) DllCall("gdi32.dll", "int", "SelectObject", "int", $hd[0], "int", $pen[0]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hd[0], "int",$start[0], "int", $start[1], "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $start[0], "int", $current[1]) ;DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $current[0], "int", $start[1]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hd[0], "int",$current[0], "int", $start[1], "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $current[0], "int", $current[1]) ;DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $start[0], "int", $start[1]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hd[0], "int",$current[0], "int", $current[1], "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $start[0], "int", $current[1]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hd[0], "int",$start[0], "int", $start[1], "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $current[0], "int", $start[1]) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $hd[0]) WEnd EndFunc any suggestions on how i should do a timed function (start/stop it after certain amount of time)? anything else wrong with this script? any ways to compress this scripted? thx in advance edit: almost got it, i cant get it to exit out of making a box and switch into running the rest of the script though. what am i doing wrong? Edited October 2, 2008 by XZ3R0
spudw2k Posted October 2, 2008 Posted October 2, 2008 (edited) Check out the TimerInit() and TimerDiff() functions in the Helpfile. They are exactly what you need. Also, if you're ever in the need of checking idle time there's a great func here.edit: whoops I see you already know of them since they are in your script. Edited October 2, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
XZ3R0 Posted October 2, 2008 Author Posted October 2, 2008 (edited) grr im so close heres the newest one i got. edit: i figured it out! the problem was that the targerframe kept looping with while 1=1. not allowing the first loop to end. changed to while TimerDiff($endbox)<5000. works fine now! expandcollapse popup#include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> HotKeySet("s", "ToggleTick"); s key starts and stops HotKeySet("q", "Quit"); q key shuts down the script Dim $start[2] $start[0] = 470 $start[1] = 470 Dim $current[2] $current[0] = 1020 $current[1] = 815 Dim $TickTimer = "false" AdlibEnable("ToggleTick", 60000) Dim $box = "false" sleep(1000) WinActivate("Gamevance"); browser title here $endbox=TimerInit() While 1 If TimerDiff($endbox)<5000 Then $box = "true" while 1 If $box = "true" then targetframe($start,$current,$box) ExitLoop EndIf WEnd Else $box = "false" WinActivate("Gamevance"); browser title here Sleep(500) MouseClick( "left", ($start[0]+(($current[0]-$start[0])/2)), ($start[1]+(($current[1]-$start[1])/2)), 1, 0); auto start Sleep(100) While 1 While $TickTimer = "True" $coor = PixelSearch( $start[0], $start[1], [$current[0], $current[1], 0xfcfcfc, 5, 8 ) While Not @error MouseClick ( "left", ($Coor[0]), ($Coor[1]), 1, 3 ) $coor = PixelSearch( $start[0], $start[1], [$current[0], $current[1], 0xfcfcfc, 5, 8 ) WEnd WEnd WEnd EndIf WEnd Func ToggleTick() If $TickTimer = "True" Then $TickTimer = "False" AdlibDisable() Else $TickTimer = "True" AdlibDisable() AdlibEnable("Toggletick", 60000) EndIf EndFunc Func Quit() Exit EndFunc Func targetframe($start,$current,$box) While TimerDiff($endbox)<5000 $hd = DllCall("user32.dll", "int", "GetDC", "hwnd",0 ) $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", 2, "int", 0x0000ff) DllCall("gdi32.dll", "int", "SelectObject", "int", $hd[0], "int", $pen[0]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hd[0], "int",$start[0], "int", $start[1], "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $start[0], "int", $current[1]) ;DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $current[0], "int", $start[1]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hd[0], "int",$current[0], "int", $start[1], "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $current[0], "int", $current[1]) ;DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $start[0], "int", $start[1]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hd[0], "int",$current[0], "int", $current[1], "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $start[0], "int", $current[1]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hd[0], "int",$start[0], "int", $start[1], "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hd[0], "int", $current[0], "int", $start[1]) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $hd[0]) WEnd EndFunc Edited October 2, 2008 by XZ3R0
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now