0

私はバージョン AHL_L 32Bit 1.1.05.06 を使用しています

ピクセルがx時間稼働している場合にAutoHotkeyで検出する論理的な方法を探しています。15秒後、クラッシュしたと仮定してリフレッシュします。

私の現在のコードは次のようなものです:

CrashCheck:
if stuckinbonus = 0x1D001A
{

    if(FoundCrash = 0) {   
     FirstFound := A_Tickcount
     FoundCrash = 1
        } else {
 CrashCheckTime := A_Tickcount - FirstFound
    }




if(CrashCheckTime >= 15000){
SetTimer,CrashCheck,off
 MsgBox,Refreshing page (Pseudo Code)
}
}
return

スクリプトの開始時にこのように変数をグローバルに配置しようとしましたが、CrashCheckTime が 0 になるだけで問題が発生しています:/何かアイデアはありますか?

Global FoundCrash := ""
Global FirstFound := "0"
Global CrashCheckTime:= ""
4

2 に答える 2

0

目的の座標で目的のピクセルの色が表示されるまで、ループし、待機し、ループし続ける小さな関数を作成しました。多分これは役に立ちますか?

;This function checks the Pixel at the provided coordinates and waits until the colour matches the provided parameter 
WaitForLoad(PixelColorX,PixelColorY,PixelColorValue)
{
CycleCount = 0
  PixelGetColor SearchPixel, PixelColorX, PixelColorY
  ;msgbox "Found Pixel %SearchPixel% at %PixelColorX%, %PixelColorY%, Looking for %PixelColorValue%" ;DEBUGG ASSISTANT
  While (SearchPixel != PixelColorValue)
          {
    CycleCount = CycleCount + 1
    sleep 100
    ; Tooltip Waiting to detect pixels HERE!, PixelColorX, PixelColorY     ; Doesn't work
    PixelGetColor SearchPixel, PixelColorX, PixelColorY
  }
  sleep 500
;Debug
;msgbox Exiting Function with %PixelColorValue% at %PixelColorX%, %PixelColorY% after %CycleCount% Cycles.
SearchPixel = 0
PixelColorValue = 1
于 2013-09-06T19:08:51.603 に答える
0

これでうまくいきますか?

#SingleInstance Force
#installKeybdHook
#Persistent
SetTimer, CrashCheck, 1000 ; run CrashCheck every second
MyAlert := 0
Return

CrashCheck:
PixelGetColor, Color, 100, 100
If (Color = 0x1D001A)
{
    MyAlert++
}
Else
{
    MyAlert := 0
}
If (MyAlert > 15)
{
    MyAlert := 0
    Refresh Page
}
Return

独自のコードに関して。FoundCrash := 0CrashCheck を実行する前に を設定していない可能性がありますか? このようにして、あなたは決して真実にならないIf (FoundCrash = 0)ので、常に選択にジャンプしElseます.

例:

#SingleInstance Force
#installKeybdHook
#Persistent
;FoundCrash := 0 ; Script fails when this line is commented out!
stuckinbonus = 0x1D001A

!t:: ; [Alt]+t to simulate CrashCheck
If (stuckinbonus = 0x1D001A)
{
    If (FoundCrash = 0)
    {   
        SoundBeep, 500, 500 ;(Low beep)
                FirstFound := A_Tickcount
        FoundCrash := 1
    }
    Else
    {
        SoundBeep, 1500, 500 ;(High beep)
        CrashCheckTime := A_Tickcount - FirstFound
    }
    If (CrashCheckTime >= 15000)
    {
    ;SetTimer,CrashCheck,off
    FoundCrash := 0
    MsgBox,Refreshing page (Pseudo Code)
    }
}
Return

これを SciTE4AutoHotKey 内でデバッグ モードで実行して、ステップごとの実行中にどの分岐が行われ、変数の値が何であるかを確認することをお勧めします。

于 2013-03-31T08:17:06.727 に答える