 
 sleep_minute(minute)
 {
-    Sleep, %minute% * 60 * 1000
+    Sleep % minute * 60 * 1000
 }
 
 
-configs := [["30u", ".5Hz", "u", 18]
-                 , ["10u", ".5Hz", "d", 18]
-                 , ["3u",   "1Hz", "u", 9]
-                 , ["1u",   "1Hz", "d", 9]
-                 , ["300n", "1Hz", "u", 9]]
-
-;~ for size, rate, u_or_d, run_minute in config
-;~ for config in configs
-;~ {
-    ;~ msgbox % config[0]
-    ;~ config(%size%, %rate%, 1000)
-    ;~ capture(%u_or_d%)
-    ;~ sleep_minute(run_minute)
-;~ }

        }
    }
    
    config(size, rate, sleep_ms)
    {
        Send, !p  ; panel
        Sleep, %sleep_ms%
        Send, s   ; scan?
        Sleep, %sleep_ms%
        
        ;; throw if "Scan size" not activated
        
        SendInput, %size%
        Sleep, %sleep_ms%
        Loop, 4
        {
            SendInput, {Down}
            Sleep, %sleep_ms%
        }
        ;; throw if not addapted
        SendInput, %rate%
        Loop, 4
        {
            SendInput, {Up}
            Sleep, %sleep_ms%
        }
    }
        
    capture(u_or_d)
    {
        ;; throw if u_or_d not in ["u", "d"]
        Send, ^c  ; capture
        Sleep, %sleep_ms%
        Send, !f  ; frame
        Sleep, %sleep_ms%
        SendInput, %u_or_d%
        ;; throw if not started
        Sleep, %sleep_ms%
    }

    static dbg_cnt = 0
    dbg()


execute()
{
    ;~ AFM.export_jpg(1, "d:\ashihara\img", 178, 207)
    
    configs := [["30u", ".5Hz", "u", 18]
                 , ["10u",  "1Hz", "d", 18]
                 , ["3u",   "1Hz", "u", 9]
                 , ["1u",   "1Hz", "d", 9]
                 , ["300n", "1Hz", "u", 9]]
    for index, config in configs
    {
        AFM.config_capture(config[1]
            , config[2], config[3], config[4])
    }
}


