I have the below script where the sequence is very important as the 1st Script generates a log file and then the 2nd Script uses the value from the log file as the loop counter.
Here is the what I want and the sequence
Script 1
1- Send("S*D/<The value here should come from cell A1 of excel workbook data.xlsx>/17AUG/US") so the keystrokes sent would be e.g. S*D/321/17AUG/US (321 was the value in excel cell A1)
Script 2
2- After Script 1 is complete, Script 2 performs its actions which is sending formats in a loop a certain number of times
3- Once Script 2 completes its actions, I want to go back to Script 1 and this time pick data from Cell A2 of the excel workbook and perform its actions
4- This loop continues till there is no more cells with a value in column A of Excel workbook
;Script 1
#include <MsgBoxConstants.au3>
WinActivate("Application")
WinWaitActive("Application")
Send("S*D/$Value from Excel$/17AUG/US")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("MB")
Sleep(1000)
Send("{ENTER}")
Sleep(3000)
Script2()
Func Script2()
Local $iPID = Run("Script2.exe")
EndFunc
;Script2
#include <MsgBoxConstants.au3>
$file = @ScriptDir & "\T.log"
$iNum = StringRegExp(FileRead($file), "(?sm).*^\h*(\d{1,3})", 1)[0]
ConsoleWrite($iNum & @CRLF)
WinActivate("Application")
Local $hWnd = WinWaitActive("Application", "", 5)
If $hWnd Then
For $i = 1 To $iNum
Send("GTIM"& $i &"/OVR")
;Send("GTIM"& $i &"/OVR "{ENTER}"")
Sleep(1000)
;Send("/OVR")
Send("{ENTER}")
Sleep(1000)
Next
Else
MsgBox(0, "", '"Application" window not found.')
EndIf