I am trying to use the following code to save files with a timestamp in its name, but I get a "This variable has not been assigned a value" error due to the line: file :="D:\RUN_"+%A_Index%+"_"+showTime(A_now)
Thanks in advance!
Cheers
Code: Select all
proc := "C:\InterWinner\BIN\InterWinner.exe", wTitle := "InterWinner"
time=10000; Time of measurement
#v::
If WinExist(wTitle)
WinActivate
Else Run, %proc%
WinWaitActive, %wTitle%,, 20
Loop
{
if (A_Index < 4)
Send !fa
WinWaitActive, %wTitle%,, 5
file :="D:\RUN_"+%A_Index%+"_"+showTime(A_now)
Send %file%
Send {Enter}
WinWaitActive, %wTitle%,, 5
Send {F4} ; Erase spectrum
WinWaitActive, %wTitle%,, 5
Send {F2} ; Start measurement
Sleep, %time% ; Exposure for %time% miliseconds.
Send {F3} ; Stop measurement
WinWaitActive, %wTitle%,, 5
if (A_Index > 3)
break ; Terminate the loop
}
showTime(ts) {
FormatTime, formatted, %ts%, dddd MMMM d, yyyy hh:mm:ss tt
Return formatted
}
Return