I can't figure this one out. I have a script that will ask for the time off of a terminal emulator and then parse the result into the format the _DateDiff command uses. Then it should tell me how many seconds between the requested time and actual time.
I have the script written but FileReadLine always returns blanks to the $parsetime variable. If I remove FileReadLine and let the second script run by itself it works. The first script leaves everything blank: $parsetime, $smo, $sday, $shour, etc...
Any ideas? (I'm using beta)
This script works...
#include "File.au3"
#include "String.au3"
#include "Misc.au3"
#include "Date.au3"
$starttime = "2006/08/02 01:00:00"
$timefile = FileOpen("c:\time.txt", 0)
If $timefile = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
$parsetime = FileReadLine($timefile, 2)
FileClose($timefile)
$parsetime = StringStripWS ($parsetime, 1);strips leading white space // begin time parse
$parsetime = StringTrimLeft ($parsetime, 16)
$smo = StringLeft ($parsetime, 2)
$parsetime = StringTrimLeft ($parsetime, 3)
$sday = StringLeft ($parsetime, 2)
$parsetime = StringTrimLeft ($parsetime, 7)
$shour = StringLeft ($parsetime, 2)
$parsetime = StringTrimLeft ($parsetime, 2)
$smin = StringLeft ($parsetime, 2)
$parsetime = StringTrimLeft ($parsetime, 3)
$ssec = StringLeft ($parsetime, 2) ;end time parse
; $waitsec = _DateDiff( 's',@YEAR & "/08/01[ 23:18:[00]]",@YEAR & $smo & "/" & $sday "[ " & $shour & ":" & $smin & ":[" & $ssec & "]]" )
$waitsec = _DateDiff( 's',@YEAR & "/" & $smo & "/" & $sday & " " & $shour & ":" & $smin & ":" & $ssec,$starttime)
MsgBox(4096, "Result", "The time difference is: " & $waitsec)
This script returns blanks...
#include "File.au3"
#include "String.au3"
#include "Array.au3"
#include "Misc.au3"
#include "Date.au3"
Dim $line[5]
$starttime = "2006/08/02 10:30:00" ;enter time to find difference from
If NOT FileExists("C:\drop.txt") Then
MsgBox(4096, "", "c:\drop.txt data does not exist.")
Exit
EndIf
If WinExists("MyApp") Then
Opt("MouseCoordMode", 0)
Opt("SendKeyDelay", 1)
$countlines = _FileCountLines("C:\drop.txt")
$timefile = FileOpen("C:\time.txt", 2);begin time check from terminal
If $timefile = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
WinActivate("MyApp")
MouseClick ("left", 50, 240, 1, 0)
Send ("{BS}" & "'t" & "{ENTER}")
Sleep(1000)
Send ("^a")
Send ("^c")
$sabrecopy = ClipGet()
FileWrite($timefile, $sabrecopy) ; by this point in the script the file is successfully created
;I have also tried FileWriteLine for the above command.
$parsetime = FileReadLine($timefile, 2)
FileClose($timefile)
$parsetime = StringStripWS ($parsetime, 1);strips leading white space // begin time parse
$parsetime = StringTrimLeft ($parsetime, 16)
$smo = StringLeft ($parsetime, 2)
$parsetime = StringTrimLeft ($parsetime, 3)
$sday = StringLeft ($parsetime, 2)
$parsetime = StringTrimLeft ($parsetime, 7)
$shour = StringLeft ($parsetime, 2)
$parsetime = StringTrimLeft ($parsetime, 2)
$smin = StringLeft ($parsetime, 2)
$parsetime = StringTrimLeft ($parsetime, 3)
$ssec = StringLeft ($parsetime, 2) ;end time parse
$waitsec = _DateDiff( 's',@YEAR & "/" & $smo & "/" & $sday & " " & $shour & ":" & $smin & ":" & $ssec,$starttime)
MsgBox(4096, "Result", "The time difference is: " & $waitsec)
$file = FileOpen("C:\drop.txt", 0)
$log = FileOpen("C:\droplog.txt", 1)
For $I = 1 to $countlines
; looped commands go here
Next
FileClose($file)
FileClose($log)
else
MsgBox(4096, "", "Error: can't find MyApp window.")
EndIf
Exit
Here is the text file with the time that I'm parsing...
¥T«
CENTRAL TIME IS 08/02 214 1538.06¶
Any ideas/input are greatly appreciated.