 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
kumpel100
Joined: 22 Mar 2008 Posts: 7
|
Posted: Fri Aug 08, 2008 8:18 pm Post subject: EnvSub, End, Start, Millisecond ?? |
|
|
can i display start/End time in millisecond ??
second / minute work but not millisecond
thx |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Fri Aug 08, 2008 8:50 pm Post subject: |
|
|
code?
multiply by 1000? _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
kumpel100
Joined: 22 Mar 2008 Posts: 7
|
Posted: Fri Aug 08, 2008 9:35 pm Post subject: |
|
|
soemthing like:
| Code: |
main:
version_Name = Find optimum Timers for Pixelsearch
ScriptName = OptimumTimers
TrayTip, %ScriptName%, Hotkeys & Hotstrings activated, , 1
count := 0
count2 := 0
guis:
Gosub LoadSaved
gosub updatehotkeys
Gui +alwaysontop
gui, font, s8, Arial
Gui, Color, BBFF00 ;00FF00 ;FF0000 ;%CustomColor%
Gui, Add, Text, ,`n
gui, font, s8, Arial Black
Gui, Add, Tab, x0 y0 w578 h678 , CheckYourPC
gui, font, s8, Arial
Gui, Show, x131 y91 h130 w385, %version_Name%
Gui, Tab, CheckYourPC
Gui, Add, Button, x6 y100 w60 h20 ggetid, GetID
Gui, Add, Button, x255 y100 w60 h20 gstart, Start
Gui, Add, Button, x320 y100 w60 h20 gbuttonpause, Pause
Gui, Add, Button, x320 y75 w60 h18 gExits, SaveExit
Gui, Add, Text, x70 y103 w180 h17 , <<<FIRST set the ID then Start>>>
Gui, Add, Text, x6 y25 w290 h17 , How often search for Pixel (Recomented 5):
Gui, Add, Button, x290 y25 w30 h18 gSuche_Pixelx, Set
Gui, Add, Edit, x326 y25 w40 h17 vSuche_Pixel, %Suche_Pixel%
Gui, Add, Text, x6 y50 w290 h17 , How fast search for Pixel in "ms" (Recomented 10):
Gui, Add, Button, x290 y50 w30 h18 gTimerx, Set
Gui, Add, Edit, x326 y50 w40 h17 vTimer, %Timer%
Gui, Add, Text, x6 y75 w250 h17 , Set any Color Pixel in SB:
Gui, Add, Button, x130 y73 w80 h18 gGetPixel_Position, GET COLOR
Return
GetID:
sleep 1000
Send, {SHIFTDOWN}2{SHIFTUP}
WinGet, sb_id, ID, A
sleep 1000
msgbox,,, your SB id is %sb_id% Now GET the Color ,5
Return
shift & 1::
pause
ButtonPause:
if IsPaused
{
Pause off
IsPaused := false
GuiControl,, PauseButton, Pause
}
else
SetTimer, Pause, 10
return
Pause:
SetTimer, Pause, off
IsPaused := true
GuiControl,, PauseButton, Unpause
Pause, on
return
Exits:
Gosub Save
GuiClose:
Exitapp
return
Start:
Gosub GuiControlGet_1
if %sb_id% = -1
{
msgbox,,, No SB ID found !!! ,5
sleep 1000
Return
}
gosub updatehotkeys
msgbox,,, test start in 3 seconds ,3
Start := A_Now
loop
{
sleep %Timer%
If a_Index >=%Suche_Pixel%
break
PixelSearch, Px, Py, %xwin30%, %ywin30%, %xwin31%, %ywin31%, %JunkPosition_color% , 1, Fast
If Errorlevel = 0 ; 0 ~= color found OK, 1 ~= color not found , 2 ~= something FÜ¢Ked up
{
Count = %A_Index%
; count ++
}
If ErrorLevel > 0
{
Count2 = %A_Index%
;count2 ++
}
}
End := A_Now ; i need the Exact time in milliseconds
EnvSub, End, Start, seconds
num := (end * 1000)
msgbox,,, to Search %Suche_Pixel% Times the Pixel we have need %num% milliseconds ,5
msgbox,,, succefull found : %count% Failor : %count2% ,10
count := 0
count2 := 0
gosub save
Return
GetPixel_Position:
msgbox,,, place your cursor on any color in you screen 5sek left ,5
;msgbox,,, YOU HAVE 5 SEK. TO PLACE YOUR CURSOR ON RIGHT POINT TO GET THE COLOR ,5
CoordMode, Mouse, screen
MouseGetPos, xJunkPosition1, yJunkPosition1
;**********NEW****************
xwin30 := (xJunkPosition1 - 2) ; hier musst du die breite angeben
ywin30 := (yJunkPosition1 - 2) ; hier musst du die höhe angeben
;******************************
;**********NEW****************
xwin31 := (xJunkPosition1 + 2) ; hier musst du die breite angeben
ywin31 := (yJunkPosition1 + 2) ; hier musst du die höhe angeben
;******************************
MouseMove, 50, 0, 10, R
;msgbox,,, add this in X1: %xwin1% Y1: %ywin1% /// X: %xwin% Y: %ywin% /// X2: %xwin2% Y2: %ywin2%
sleep 100
JunkPosition_colorC:
PixelGetColor, JunkPosition_color, %xJunkPosition1%, %yJunkPosition1%
sleep 50
PixelGetColor, JunkPosition_color1, %xJunkPosition1%, %yJunkPosition1%
if not %JunkPosition_color% = %JunkPosition_color1%
{
goto JunkPosition_colorC
}
;ProgressOnStatusBar(1, 1, 1000, 0x0000ff, "!Color succefull Saved!", 400)
Gosub Save
sleep 500
msgbox,,, the Color we looking is: %JunkPosition_color% Now hit START ,2
return
Suche_Pixelx:
Gui, Submit , NoHide
Gosub Save
; Gosub LoadSaved
Return
Timerx:
Gui, Submit , NoHide
Gosub Save
; Gosub LoadSaved
Return
LoadSaved:
Gui, Submit, NoHide
IniRead, xwin30, filex.ini, Savedx, xwin30
IniRead, ywin30, filex.ini, Savedx, ywin30
IniRead, xwin31, filex.ini, Savedx, xwin31
IniRead, ywin31, filex.ini, Savedx, ywin31
IniRead, Suche_Pixel, filex.ini, Savedx, Suche_Pixel
IniRead, Timer, filex.ini, Savedx, Timer
IniRead, JunkPosition_color, filex.ini, Savedx, JunkPosition_color
return
updatehotkeys:
Gui, Submit, NoHide
GuiControlget %Suche_Pixel%
GuiControlget %Timer%
return
Save:
Gui, Submit, NoHide
IniWrite, %xwin30%, filex.ini, Savedx, xwin30
IniWrite, %ywin30%, filex.ini, Savedx, ywin30
IniWrite, %xwin31%, filex.ini, Savedx, xwin31
IniWrite, %ywin31%, filex.ini, Savedx, ywin31
IniWrite, %Suche_Pixel%, filex.ini, Savedx, Suche_Pixel
IniWrite, %Timer%, filex.ini, Savedx, Timer
IniWrite, %JunkPosition_color%, file.ini, Savedx, JunkPosition_color
return
GuiControlGet_1:
Gui, Submit, NoHide
GuiControlget %Suche_Pixel%
GuiControlget %Timer%
return
|
i want see the Start End time exactly in milliseconds
this script is to check how good my PC reads pixel if you didnt know the backround its a bit confused
this display me not the exact number: num := (end * 1000) |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Sat Aug 09, 2008 12:58 am Post subject: |
|
|
| Code: | main:
version_Name = Find optimum Timers for Pixelsearch
ScriptName = OptimumTimers
TrayTip, %ScriptName%, Hotkeys & Hotstrings activated, , 1
count := 0
count2 := 0
guis:
Gosub LoadSaved
gosub updatehotkeys
Gui +alwaysontop
gui, font, s8, Arial
Gui, Color, BBFF00 ;00FF00 ;FF0000 ;%CustomColor%
Gui, Add, Text, ,`n
gui, font, s8, Arial Black
Gui, Add, Tab, x0 y0 w578 h678 , CheckYourPC
gui, font, s8, Arial
Gui, Show, x131 y91 h130 w385, %version_Name%
Gui, Tab, CheckYourPC
Gui, Add, Button, x6 y100 w60 h20 ggetid, GetID
Gui, Add, Button, x255 y100 w60 h20 gstart, Start
Gui, Add, Button, x320 y100 w60 h20 gbuttonpause, Pause
Gui, Add, Button, x320 y75 w60 h18 gExits, SaveExit
Gui, Add, Text, x70 y103 w180 h17 , <<<FIRST set the ID then Start>>>
Gui, Add, Text, x6 y25 w290 h17 , How often search for Pixel (Recomented 5):
Gui, Add, Button, x290 y25 w30 h18 gSuche_Pixelx, Set
Gui, Add, Edit, x326 y25 w40 h17 vSuche_Pixel, %Suche_Pixel%
Gui, Add, Text, x6 y50 w290 h17 , How fast search for Pixel in "ms" (Recomented 10):
Gui, Add, Button, x290 y50 w30 h18 gTimerx, Set
Gui, Add, Edit, x326 y50 w40 h17 vTimer, %Timer%
Gui, Add, Text, x6 y75 w250 h17 , Set any Color Pixel in SB:
Gui, Add, Button, x130 y73 w80 h18 gGetPixel_Position, GET COLOR
Return
GetID:
sleep 1000
Send, {SHIFTDOWN}2{SHIFTUP}
WinGet, sb_id, ID, A
sleep 1000
msgbox,,, your SB id is %sb_id% Now GET the Color ,5
Return
shift & 1::
pause
ButtonPause:
if IsPaused
{
Pause off
IsPaused := false
GuiControl,, PauseButton, Pause
}
else
SetTimer, Pause, 10
return
Pause:
SetTimer, Pause, off
IsPaused := true
GuiControl,, PauseButton, Unpause
Pause, on
return
Exits:
Gosub Save
GuiClose:
Exitapp
return
Start:
Gosub GuiControlGet_1
if %sb_id% = -1
{
msgbox,,, No SB ID found !!! ,5
sleep 1000
Return
}
gosub updatehotkeys
msgbox,,, test start in 3 seconds ,3
Start := A_TickCount
loop
{
sleep %Timer%
If a_Index >=%Suche_Pixel%
break
PixelSearch, Px, Py, %xwin30%, %ywin30%, %xwin31%, %ywin31%, %JunkPosition_color% , 1, Fast
If Errorlevel = 0 ; 0 ~= color found OK, 1 ~= color not found , 2 ~= something FÜ¢Ked up
{
Count = %A_Index%
; count ++
}
If ErrorLevel > 0
{
Count2 = %A_Index%
;count2 ++
}
}
num := A_TickCount - Start ; i need the Exact time in milliseconds
msgbox,,, to Search %Suche_Pixel% Times the Pixel we have need %num% milliseconds ,5
msgbox,,, succefull found : %count% Failor : %count2% ,10
count := 0
count2 := 0
gosub save
Return
GetPixel_Position:
msgbox,,, place your cursor on any color in you screen 5sek left ,5
;msgbox,,, YOU HAVE 5 SEK. TO PLACE YOUR CURSOR ON RIGHT POINT TO GET THE COLOR ,5
CoordMode, Mouse, screen
MouseGetPos, xJunkPosition1, yJunkPosition1
;**********NEW****************
xwin30 := (xJunkPosition1 - 2) ; hier musst du die breite angeben
ywin30 := (yJunkPosition1 - 2) ; hier musst du die höhe angeben
;******************************
;**********NEW****************
xwin31 := (xJunkPosition1 + 2) ; hier musst du die breite angeben
ywin31 := (yJunkPosition1 + 2) ; hier musst du die höhe angeben
;******************************
MouseMove, 50, 0, 10, R
;msgbox,,, add this in X1: %xwin1% Y1: %ywin1% /// X: %xwin% Y: %ywin% /// X2: %xwin2% Y2: %ywin2%
sleep 100
JunkPosition_colorC:
PixelGetColor, JunkPosition_color, %xJunkPosition1%, %yJunkPosition1%
sleep 50
PixelGetColor, JunkPosition_color1, %xJunkPosition1%, %yJunkPosition1%
if not %JunkPosition_color% = %JunkPosition_color1%
{
goto JunkPosition_colorC
}
;ProgressOnStatusBar(1, 1, 1000, 0x0000ff, "!Color succefull Saved!", 400)
Gosub Save
sleep 500
msgbox,,, the Color we looking is: %JunkPosition_color% Now hit START ,2
return
Suche_Pixelx:
Gui, Submit , NoHide
Gosub Save
; Gosub LoadSaved
Return
Timerx:
Gui, Submit , NoHide
Gosub Save
; Gosub LoadSaved
Return
LoadSaved:
Gui, Submit, NoHide
IniRead, xwin30, filex.ini, Savedx, xwin30
IniRead, ywin30, filex.ini, Savedx, ywin30
IniRead, xwin31, filex.ini, Savedx, xwin31
IniRead, ywin31, filex.ini, Savedx, ywin31
IniRead, Suche_Pixel, filex.ini, Savedx, Suche_Pixel
IniRead, Timer, filex.ini, Savedx, Timer
IniRead, JunkPosition_color, filex.ini, Savedx, JunkPosition_color
return
updatehotkeys:
Gui, Submit, NoHide
GuiControlget %Suche_Pixel%
GuiControlget %Timer%
return
Save:
Gui, Submit, NoHide
IniWrite, %xwin30%, filex.ini, Savedx, xwin30
IniWrite, %ywin30%, filex.ini, Savedx, ywin30
IniWrite, %xwin31%, filex.ini, Savedx, xwin31
IniWrite, %ywin31%, filex.ini, Savedx, ywin31
IniWrite, %Suche_Pixel%, filex.ini, Savedx, Suche_Pixel
IniWrite, %Timer%, filex.ini, Savedx, Timer
IniWrite, %JunkPosition_color%, file.ini, Savedx, JunkPosition_color
return
GuiControlGet_1:
Gui, Submit, NoHide
GuiControlget %Suche_Pixel%
GuiControlget %Timer%
return |
 |
|
| Back to top |
|
 |
kumpel100
Joined: 22 Mar 2008 Posts: 7
|
Posted: Sat Aug 09, 2008 3:56 pm Post subject: |
|
|
thx  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|