Jump to content

wan

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by wan

  1. This one works for me, but after several days. The script fail to paste the value to the date box
  2. Update on my problem . I have figure on how to change the date based on system current date and get the value (NewDate) . But how I want to copy the date value and paste it in my application to change the date in the date box? Because I use clipget , it copied something else Local $sDate = _DateAdd('d', -2, _NowCalcDate()) ;Local $sDate = StringFormat("%02u/%02u/", @YEAR, @MON) & StringRight(@MDAY, 4) ; Format = MM/DD/YYYY local $sNewDate = StringRegExpReplace($sDate, "[/]", "-") MsgBox($MB_SYSTEMMODAL, "", "The following data is now stored in the clipboard: " & @CRLF & $sNewDate) Local $sDate = ClipGet() MsgBox($MB_SYSTEMMODAL, "", "The following data is now stored in the clipboard: " & @CRLF & $sDate)
  3. Yes but this mean i need to do 30 times as the text to set is not the same value . This is why i try figure on how auto it can recognized what value in the date field and change it accordingly
  4. Hello, I have create a script to change the date and time value . It just send a mouseclick to adjust the value using the arrow up and down from the application interface. It is possible for me to to change the date based on current date in the box ? For example if the date is 1 Nov , change it to 31 October , if it is 2 Nov change to 1 Nov instead of send arrow down to reduce the date . I have see replace string function but i not know how to script it. ;Click "Time Box" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 407, 142 ) Sleep(1000) ;Send UP Click 23x Send("{UP} 23") Sleep(100) ;Click "Date Box" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 344, 140 ) Sleep(1000) ;Send DOWN Click Send("{DOWN}") Sleep(1000)
  5. Hello, I want to ask why my scripts sometimes stuck and never end ? It only happen once a while . My script will open an app and automate the process to export Excel File from four Face Recognition devices. Somehow the script will stop running / move to the next line and the exe (with gui) still open and never close. On the next run it just working fine
  6. @Jos Thank You . The email script working perfectly . But I want to ask how I want to include duration of script running time and send it also through email.
  7. I have a script that run hourly through Task Scheduler. The problem is when I want to run it even when user is not login and have tick/untick all required radio box eg, Run with high privilege but it shows the script running in Task Manager but no GUI (My script need to run interactively) . So, I discovered to run the script using Pstool. But the script stop running and stuck when the process is to export the excel file into local directory. This is my batch file : C:\PSTools\PsExec.exe psexec -i -s "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "E:\TMGAD0001\TMGAD0001 - Backup.au3"
  8. @Zedna The sVMS2000.exe start in multiple window thus error box message appear Abnormalities Runtime. Can you check my script? #include <Date.au3> #include <MsgBoxConstants.au3> #RequireAdmin Global $sPath = "\\10.174.10.9\SPOON\TMGAD0001\INPUT\" Global $tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime(_Date_Time_GetSystemTime()) Global $sFileName1 = "FR_IP_79_" & _WinAPI_GetDateFormat(0, $tLocal, 0, 'yyyyMMdd') & _WinAPI_GetTimeFormat(0, $tLocal, $TIME_FORCE24HOURFORMAT, 'HHmm') Global $sFileName2 = "FR_IP_82_" & _WinAPI_GetDateFormat(0, $tLocal, 0, 'yyyyMMdd') & _WinAPI_GetTimeFormat(0, $tLocal, $TIME_FORCE24HOURFORMAT, 'HHmm') Global $sFileName3 = "FR_IP_47_" & _WinAPI_GetDateFormat(0, $tLocal, 0, 'yyyyMMdd') & _WinAPI_GetTimeFormat(0, $tLocal, $TIME_FORCE24HOURFORMAT, 'HHmm') Global $sFileName4 = "FR_IP_49_" & _WinAPI_GetDateFormat(0, $tLocal, 0, 'yyyyMMdd') & _WinAPI_GetTimeFormat(0, $tLocal, $TIME_FORCE24HOURFORMAT, 'HHmm') Global $sWindow1 = "[TITLE:" & $sFileName1 & ".xlsx - Excel; CLASS:XLMAIN]" Global $sWindow2 = "[TITLE:" & $sFileName2 & ".xlsx - Excel; CLASS:XLMAIN]" Global $sWindow3 = "[TITLE:" & $sFileName3 & ".xlsx - Excel; CLASS:XLMAIN]" Global $sWindow4 = "[TITLE:" & $sFileName4 & ".xlsx - Excel; CLASS:XLMAIN]" Sleep (1000) run("E:\sVMS2000\sVMS2000.exe") Local $hWnd = WinWait("[TITLE:Login; CLASS:Qt5QWindowIcon]", "") Sleep(1000) ; Click "Login" ControlClick( "Login", "", $hWnd ,"left", 1, 277, 490 ) Local $hWnd = WinWait("[TITLE:sVMS2000; CLASS:Qt5QWindowIcon]", "") $WinPos = WinGetPos($hWnd) Sleep(1000) ; *************************************************************** ; Perform Face Recognition Device 10.174.120.79 (Terminal A) ; *************************************************************** ; Click "Face Manage" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 667, 195 ) Sleep(1000) ; Click "Default Group" ControlClick( "sVMS2000", "", $hWnd, "left", 2, 37, 119 ) Sleep(1000) ; Click 10.174.10.79 "Terminal A" Device ControlClick( "sVMS2000", "", $hWnd, "left", 1, 80, 141 ) Sleep(1000) ; Click "Search" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1455, 145 ) Sleep(10000) If WinActive ("MessBox") Then ; Close the Excel file. WinClose("MessBox") ; Activate the sVMS2000 window. Local $hWnd = WinWait("[TITLE:sVMS2000; CLASS:Qt5QWindowIcon]", "") ; Uncheck "Export Picture" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 245, 838 ) Sleep(1000) Else ; Click "Export" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1530, 145 ) Sleep(2000) ; Wait for Explorer Window Local $hWnd1 = WinWait("[TITLE:Save; CLASS:#32770]", "") ; Click on the text box ControlClick ( $hWnd1, "", 1001 ) Sleep(10000) ; Enter file saved name. ControlSetText( $hWnd1, "", 1001, $sPath & $sFileName1 ) Sleep(10000) ; Click SAVE ControlClick ( $hWnd1, "", 1 ) Sleep(10000) ; Wait for the Excel File to Appear WinWait($sWindow1, "") Sleep(2000) ; Close the Excel file. WinClose($sWindow1, "") Sleep(500) EndIf MyLog('start of section two ...') Sleep(500) ; *************************************************************** ; Perform Face Recognition Device 10.174.120.82 (Terminal ; *************************************************************** ; Activate the sVMS2000 window. Local $hWnd = WinWait("[TITLE:sVMS2000; CLASS:Qt5QWindowIcon]", "") ; Click 10.174.10.82 "Terminal B" Device ControlClick( "sVMS2000", "", $hWnd, "left", 1, 80, 162 ) Sleep(1000) ; Click "Search" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1455, 145 ) Sleep(10000) If WinActive ("MessBox") Then ; Close the error box. WinClose("MessBox") Sleep(500) Else ;WinWaitClose("MessBox") ; Wait until the window is closed ;ProcessWaitClose("") ; Wait until the window is closed via Process Close ;MsgBox(0, "MessBox", "MessBox has been closed", 5) ;ElseIf WinExists("MessBox") = "0" Then ;ElseIf ProcessExists("") = "0" Then ;MsgBox(0, "MessBox", "That window doesn't exist!", 5) ; Click "Export" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1530, 145 ) Sleep(2000) ; Wait for Explorer Window Local $hWnd1 = WinWait("[TITLE:Save; CLASS:#32770]", "") ; Click on the text box ControlClick ( $hWnd1, "", 1001 ) Sleep(10000) ; Enter file saved name. ControlSetText( $hWnd1, "", 1001, $sPath & $sFileName2 ) Sleep(10000) ; Click SAVE ControlClick ( $hWnd1, "", 1 ) Sleep(60000) ; Wait for the Excel File to Appear. WinWait($sWindow2, "") Sleep(2000) ; Close the Excel file. WinClose($sWindow2, "") Sleep(500) EndIf Sleep(500) MyLog('start of section 3 ...') Sleep(500) ; *************************************************************** ; Perform Face Recognition Device 10.174.120.47 (Terminal C) ; *************************************************************** ; Activate the sVMS2000 window. Local $hWnd = WinWait("[TITLE:sVMS2000; CLASS:Qt5QWindowIcon]", "") ; Click 10.174.10.47 "Terminal C" Device ControlClick( "sVMS2000", "", $hWnd, "left", 1, 80, 183 ) Sleep(1000) ; Click "Search" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1455, 145 ) Sleep(60000) If WinActive ("MessBox") Then ; Close the error box WinClose("MessBox") Sleep(500) ;WinWaitClose("MessBox") ; Wait until the window is closed ;ProcessWaitClose("") ; Wait until the window is closed via Process Close ;MsgBox(0, "MessBox", "MessBox has been closed", 5) ;ElseIf WinExists("MessBox") = "0" Then ;ElseIf ProcessExists("") = "0" Then ;MsgBox(0, "MessBox", "That window doesn't exist!", 5) Else ; Click "Export" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1530, 145 ) Sleep(2000) ; Wait for Explorer Window Local $hWnd1 = WinWait("[TITLE:Save; CLASS:#32770]", "") ; Click on the text box ControlClick ( $hWnd1, "", 1001 ) Sleep(10000) ; Enter file saved name. ControlSetText( $hWnd1, "", 1001, $sPath & $sFileName3 ) Sleep(10000) ; Click SAVE ControlClick ( $hWnd1, "", 1 ) Sleep(60000) ; Wait for the Excel File to Appear. WinWait($sWindow3, "") Sleep(2000) ; Close the Excel file. WinClose($sWindow3, "") Sleep(500) _WriteErrorLog("3") EndIf Sleep(500) MyLog('start of section 4 ...') Sleep(500) ; *************************************************************** ; Perform Face Recognition Device 10.174.120.49 (Terminal D) ; *************************************************************** ; Activate the sVMS2000 window. Local $hWnd = WinWait("[TITLE:sVMS2000; CLASS:Qt5QWindowIcon]", "") ; Click 10.174.10.49 "Terminal D" Device ControlClick( "sVMS2000", "", $hWnd, "left", 1, 80, 204 ) Sleep(1000) ; Click "Search" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1455, 145 ) Sleep(60000) If WinActive ("MessBox") Then ; Close the error box. WinClose("MessBox") Sleep(500) ;WinWaitClose("MessBox") ; Wait until the window is closed ;ProcessWaitClose("") ; Wait until the window is closed via Process Close ;MsgBox(0, "MessBox", "MessBox has been closed", 5) ;ElseIf WinExists("MessBox") = "0" Then ;ElseIf ProcessExists("") = "0" Then ;MsgBox(0, "MessBox", "That window doesn't exist!", 5) Else ; Click "Export" ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1530, 145 ) Sleep(2000) ; Wait for Explorer Window Local $hWnd1 = WinWait("[TITLE:Save; CLASS:#32770]", "") ; Click on the text box ControlClick ( $hWnd1, "", 1001 ) Sleep(10000) ; Enter file saved name. ControlSetText( $hWnd1, "", 1001, $sPath & $sFileName4 ) Sleep(10000) ; Click SAVE ControlClick ( $hWnd1, "", 1 ) Sleep(60000) ; Wait for the Excel File to Appear. WinWait($sWindow4, "") Sleep(2000) ; Close the Excel file. WinClose($sWindow4, "") Sleep(500) EndIf Sleep(500) MyLog('start of section 5 ...') Sleep(500) ; *************************************************************** ; Close/Exit the sVMS2000 Application. ; *************************************************************** ; Activate the sVMS2000 window. Local $hWnd = WinWait("[TITLE:sVMS2000; CLASS:Qt5QWindowIcon]", "") ; Click EXIT. ControlClick( "sVMS2000", "", $hWnd, "left", 1, 1580, 20 ) ; Wait for the Exit Confirmation window. Local $hWnd1 = WinWait("[TITLE:MessBox; CLASS:Qt5QWindowIcon]", "") ; Confirm to exit. ControlClick( "sVMS2000", "", $hWnd1, "left", 1, 370, 210 ) Sleep(500) Func MyLog($text) FileWrite('E:\TMGAD0001\mylog.txt', @YEAR&'-'&@MON&'-'&@MDAY&' '&@HOUR&':'&@MIN&':'&@SEC & ' ' & $text & @CRLF) ; append EndFunc exit 0
  9. @Zedna where did I need to put the function for log? At the beginning or end of script ? Sorry im newbie
  10. Hello. I want to ask on how Autoit exe can send a log after every time my program running ? It is for debug purpose to easily know whic line does not execute correctly. For a better, I want Autoit to send the log to me through email. Below is my scripts. Thank You TMGAD0001.au3
×
×
  • Create New...