Jump to content

robertocm

Active Members
  • Posts

    211
  • Joined

  • Last visited

Everything posted by robertocm

  1. Perhaps SQL Server Express Edition. Here an example without UDFs:
  2. The Function _WinGetHandleByPID does not work with explorer.exe returning 0 as the handle: $pid = ShellExecute("explorer.exe ", @DesktopDir) If Not ProcessExists($pid) Then ConsoleWrite("no matching process" & @CRLF) Explained here:
  3. Just to add this reference that seems to work: ;Xenobiologist, Oct 21, 2020 ;https://stackoverflow.com/questions/64417468/object-shell-application-open-folder-in-same-explorer-window
  4. Some ideas to check: https://www.autoitscript.com/forum/topic/209361-read-xlsx-with-ado-anomaly/?do=findComment&comment=1511561 https://www.autoitscript.com/forum/topic/209361-read-xlsx-with-ado-anomaly/?do=findComment&comment=1511588
  5. #include <File.au3> #include <Date.au3> #include <Timers.au3> #include <WinAPIFiles.au3> #include <Misc.au3> #include "\Include\HTTP\HTTP.au3" #include "\Include\OpenCV\OpenCV_Match\OpenCV-Match_UDF.au3" #include "\Include\Festivos.au3" ;_Singleton("Mayores_OpenCV", 0) If _Singleton("Mayores_OpenCV", 1) = 0 Then Msgbox(48,"Atención", "Ya se está ejecutando." & @LF & "Esta instancia se cerrará.", 5) Exit EndIf AutoItWinSetTitle("Mayores_OpenCV") ;Esperar ;https://www.autoitscript.com/forum/topic/182398-how-do-i-gracefully-close-an-autoit-script-that-is-running/ While 1 If Not WinExists("Diario") Then ExitLoop EndIf Sleep(1000) WEnd If _Festivos() Then ;ConsoleWrite("Festivo" & @CRLF) Exit EndIf Opt('WinWaitDelay', 250) Opt('WinDetectHiddenText', 1) Opt('MouseCoordMode', 0) Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("SendKeyDelay", 75) Opt("SendKeyDownDelay", Default) Opt("SendCapslockMode", 1) Opt("MustDeclareVars", 1) Opt("TrayIconDebug", 1) ;Be sure to register this to reenable power-saving, screensaver, etc OnAutoItExitRegister("OnAutoItExit") #===== CONFIG ===== Global $mouse, $offset, $iFileExists, $hWnd, $Found, $sFilePath, $sFilePath2, $sFilePath4, $sOpenCVDir, $hFile, $YearA3, $FromC, $ToC, $FromF, $ToF, $Puntear, $Saldos, $sms, $CleanLog, $CheckActive, $RestoreBreak $CheckActive = True ;~ $CheckActive = False $sms = False Global Const $Year = @YEAR Global Const $Mon = @MON ;StringFormat("%02i", @MON - 1) Global Const $Day = @MDAY If $CmdLine[0] = 1 Then $YearA3 = $Year - 1 Else $YearA3 = $Year EndIf $Puntear = True $Saldos = True $FromF = "01/01/" & $YearA3 $ToF = "31/12/" & $YearA3 $FromC = "4000000001" $ToC = "4300999999" $sOpenCVDir = "C:\.........\OpenCV\OpenCV_Match" $sFilePath = "\\...SERVERNAME...\...\EXP\switch" Global $sFilePathLog = @DesktopDir & "\Events.log" $hFile = FileOpen($sFilePathLog, 2) $sFilePath2 = "\\...SERVERNAME...\...\EXP\tmp.rtf" $sFilePath4 = "C:\Users\...\mayores.rtf" #===== OpenCV-Match_UDF ===== ;Desde tarea programada de Windows daba error: Failed loading DLLs FileChangeDir($sOpenCVDir) _OpenCV_Startup();loads opencv DLLs _OpenCV_EnableLogging(True, True, True) ;Logs matches, errors in a log file and autoit console output. If $CheckActive Then ;Comprobar que o usuario está inactivo ;https://stackoverflow.com/questions/3867584/autoit-how-to-get-system-idle-time-or-if-screensaver-is-active ;How to get system idle time, or if screensaver is active? ;The _Timer_GetIdleTime() function uses GetLastInputInfo from user32.dll. While 1 ;use infinite loop since ExitLoop will get called If _DateDiff('n', _NowCalc(), @YEAR & "/" & @MON & "/" & @MDAY & " 20:10:00") > 10 Then If _Timer_GetIdleTime() > 600000 Then ;600000 ExitLoop EndIf Else If _Timer_GetIdleTime() > 300000 Then ;300000 ExitLoop EndIf EndIf Sleep(10000) WEnd ;Otra forma ;Do ;Sleep(10000) ;Until _Timer_GetIdleTime() > 300000 EndIf If _DateDiff('n', _NowCalc(), $Year & "/" & $Mon & "/" & $Day & " 20:16:00") > 1 Then $ToC = "5230999999" ;Introducir pausa: conexión de rede pode tardar en restaurarse cando equipo estaba suspendido For $i = 0 To 30 If FileExists("\\...SERVERNAME...\...\EXP") Then ExitLoop Else If $i < 30 Then Sleep(5000) Else _FileWriteLog($hFile, "Error Acceso a carpeta ...\EXP") Exit EndIf EndIf Next If ProcessExists("thunderbird.exe") Then ; Check if the thunderbird process is running. ProcessClose("thunderbird.exe") EndIf If ProcessExists("EXCEL.exe") Then ; Check if the thunderbird process is running. ProcessClose("EXCEL.exe") EndIf If ProcessExists("mstsc.exe") Then ;Check if the process is running. ProcessClose("mstsc.exe") EndIf ;Pode estar suspendido MouseMove(@DesktopWidth - 100, @DesktopHeight - 100) Sleep(20000) Send("#d") ;https://www.autoitscript.com/forum/topic/97501-auto-mstsc/ ;RunWait('"' & @ComSpec & '" /c MSTSC.EXE C:/yourfile.rdp', '', @SW_HIDE) ;http://support.microsoft.com/kb/941641 Run("C:\windows\system32\mstsc.exe /v:" & "__._._._") $hWnd = WinWait("Conexión a Escritorio remoto", "Errores de certificado", 10) If WinExists($hWnd) Then If Not WinActive($hWnd, "") Then WinActivate($hWnd) WinWaitActive($hWnd, "", 5) ;WinSetState($hWnd, "", @SW_MAXIMIZE) Sleep(1000) EndIf If WinActive($hWnd, "") Then If ControlSend($hWnd, "", "", "s") = 1 Then _FileWriteLog($hFile, "OK ControlSend: s [Errores Certificado]") Else _FileWriteLog($hFile, "Error ControlSend: s [Errores Certificado]") Exit EndIf Sleep(5000) EndIf EndIf ;Wait 90 seconds for the window to appear. $hWnd = WinWait("__._._._ - Conexión a Escritorio remoto", "", 90) If WinExists($hWnd) Then If Not WinActive($hWnd, "") Then WinActivate($hWnd) WinWaitActive($hWnd, "", 60000) ;WinSetState($hWnd, "", @SW_MAXIMIZE) Sleep(1000) EndIf If WinActive($hWnd, "") Then _FileWriteLog($hFile, "OK Ventana Activa: Conexión a Escritorio") EndIf EndIf ;Test if the window is now activated ;You can use the WinActive() function to check if WinActivate() succeeded. If WinActive($hWnd, "") Then ;WinSetState($hWnd, "", @SW_MAXIMIZE) ;MsgBox(0, "", "Window NOW active") ;DirCreate($sFilePath3) ;por se quedou dunha execución anterior FileRecycle($sFilePath) FileRecycle($sFilePath2) MouseMove(@DesktopWidth - 80, @DesktopHeight - 80) Sleep(10000) Global $sCoords[4] = [1416, 646, 1418, 648] Global $count, $iCheckSum = 1769473 ;black screen $offset = 1 ; how far to move the mouse ;Get initial checksum we will check later ;$iCheckSum = PixelChecksum($sCoords[0], $sCoords[1], $sCoords[2], $sCoords[3]) ;ConsoleWrite($iCheckSum & @CRLF) ;Wait for the region to change, the region is checked every 5000ms to reduce CPU load While $iCheckSum = PixelChecksum($sCoords[0], $sCoords[1], $sCoords[2], $sCoords[3]) Sleep(5000) $mouse = MouseGetPos() MouseMove($mouse[0] + $offset, $mouse[1] + $offset) $offset = -$offset $count += 1 If $count = 1800 Then _FileWriteLog($hFile, "ExitLoop: Black Screen $count = 1800") ExitLoop ;_ScreenCapture_Capture($sFilePath3 & $Day & @HOUR & @MIN & ".png" , $sCoords[0], $sCoords[1], $sCoords[2], $sCoords[3], False) EndIf WEnd ;MsgBox(0, "", "Something in the region has changed!") Sleep(10000) _CheckFullScreen() _ProcessClean(@ScriptLineNumber) Sleep(5000) ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "#r") = 1 Then _FileWriteLog($hFile, "OK ControlSend: #r") Sleep(2000) If ControlSend($hWnd, "", "", "C:\a3\A3CONV5\COWMENU.EXE") = 1 Then _FileWriteLog($hFile, "OK ControlSend: command") Sleep(2000) ControlSend($hWnd, "", "", "{ENTER}") Else _FileWriteLog($hFile, "Error ControlSend: command") Exit EndIf Else _FileWriteLog($hFile, "Error ControlSend: #r") Exit EndIf Sleep(7000) $count = 0 For $i = 1 To 10 $count += 1 $offset = 1 ; how far to move the mouse $mouse = MouseGetPos() MouseMove($mouse[0] + $offset, $mouse[1] + $offset) $offset = -$offset Sleep(1000) MouseMove($mouse[0] + $offset, $mouse[1] + $offset) ;Please note that these examples might not work as the match pictures have to be found with the exact same size on your screen. Global $sCoords[4] = [770, 470, 778, 481] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\01.png", 0.70, $sCoords, 30, 1000);Try to find the match picture on the screen. Number of tries: 60, Sleep between each try: 500ms. If Not @error Then _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found Sleep(2000) MouseClick($MOUSE_CLICK_LEFT, 747, 440) Sleep(1000) If ControlSend($hWnd, "", "", "ABCDEFG") = 1 Then _FileWriteLog($hFile, "OK ControlSend: ABCDEFG") Else _FileWriteLog($hFile, "Error ControlSend: ABCDEFG") Exit EndIf Sleep(1000) _ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position Sleep(1000) ExitLoop Else If $count = 10 Then _FileWriteLog($hFile, "No match found: " & $sOpenCVDir & "\Match\a3\01.png") Exit EndIf EndIf Next Sleep(5000) ;Acceso a aplicaciones: a3con Global $sCoords[4] = [302, 238, 365, 276] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\01b.png", 0.70, $sCoords, 60, 1000);Try to find the match picture on the screen. Number of tries: 60, Sleep between each try: 500ms. If Not @error Then _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found Sleep(100) _ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position Sleep(1000) Else _FileWriteLog($hFile, "No match found: " & $sOpenCVDir & "\Match\a3\01b.png") Exit EndIf Sleep(10000) $count = 0 For $i = 1 To 10 $count += 1 $offset = 1 ; how far to move the mouse $mouse = MouseGetPos() MouseMove($mouse[0] + $offset, $mouse[1] + $offset) $offset = -$offset Sleep(1000) MouseMove($mouse[0] + $offset, $mouse[1] + $offset) Global $sCoords[4] = [268, 91, 276, 100] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\02.png", 0.70, $sCoords, 30, 1000);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If Not @error Then _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found Sleep(100) For $i = 0 To 1 If ControlSend($hWnd, "", "", $Day & $Mon & $YearA3) = 1 Then Sleep(500) If ControlSend($hWnd, "", "", "{TAB}") = 1 Then Sleep(200) _FileWriteLog($hFile, "OK ControlSend: {TAB}") Else _FileWriteLog($hFile, "Error ControlSend: {TAB}") Exit EndIf _FileWriteLog($hFile, "OK ControlSend: " & $Day & $Mon & $YearA3) Else _FileWriteLog($hFile, "Error ControlSend: " & $Day & $Mon & $YearA3) Exit EndIf Next Sleep(1000) _ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position Sleep(1000) ExitLoop Else If $count = 10 Then _FileWriteLog($hFile, "No match found: " & $sOpenCVDir & "\Match\a3\02.png") Exit EndIf EndIf Next Global $sCoords[4] = [1047, 371, 1057, 378] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\03.png", 0.70, $sCoords, 30, 1000);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If Not @error Then _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found Sleep(100) ;Avisos con pouco texto pode estar visible ainda Global $sCoords[4] = [1046, 355, 1328, 382] While 1 ;use infinite loop since ExitLoop will get called Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\03b.png", 0.70, $sCoords, 1, 1000);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If @error Then Sleep(100) ExitLoop EndIf Sleep(1000) WEnd If ControlSend($hWnd, "", "", "{F10}lcmi") = 1 Then _FileWriteLog($hFile, "OK ControlSend: {F10}lcmi") Else _FileWriteLog($hFile, "Error ControlSend: {F10}lcmi") Exit EndIf Sleep(1000) ;_ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position ;Sleep(1000) Else _FileWriteLog($hFile, "No match found: " & $sOpenCVDir & "\Match\a3\03b.png") Exit EndIf Sleep(1000) Global $sCoords[4] = [33, 138, 41, 145] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\mayores_01.png", 0.70, $sCoords, 30, 1000);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If Not @error Then _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found Sleep(100) _ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position Sleep(1000) Else _FileWriteLog($hFile, "No match found: " & $sOpenCVDir & "\Match\a3\mayores_01.png") Exit EndIf If WinActive($hWnd, "") Then MouseClick($MOUSE_CLICK_LEFT, 118, 180) _FileWriteLog($hFile, "Click") Sleep(1000) EndIf If ControlSend($hWnd, "", "", $FromF) = 1 Then _FileWriteLog($hFile, "OK ControlSend: " & $FromF) Else _FileWriteLog($hFile, "Error ControlSend: " & $FromF) Exit EndIf Sleep(1000) If ControlSend($hWnd, "", "", "{TAB}") = 1 Then _FileWriteLog($hFile, "OK ControlSend: {TAB}") Else _FileWriteLog($hFile, "Error ControlSend: {TAB}") Exit EndIf Sleep(500) If ControlSend($hWnd, "", "", $ToF) = 1 Then _FileWriteLog($hFile, "OK ControlSend: " & $ToF) Else _FileWriteLog($hFile, "Error ControlSend: " & $ToF) Exit EndIf Sleep(1000) If ControlSend($hWnd, "", "", "{TAB}") = 1 Then _FileWriteLog($hFile, "OK ControlSend: {TAB}") Else _FileWriteLog($hFile, "Error ControlSend: {TAB}") Exit EndIf Sleep(500) If ControlSend($hWnd, "", "", $FromC) = 1 Then _FileWriteLog($hFile, "OK ControlSend: " & $FromC) Else _FileWriteLog($hFile, "Error ControlSend: " & $FromC) Exit EndIf Sleep(1000) If ControlSend($hWnd, "", "", "{TAB}") = 1 Then _FileWriteLog($hFile, "OK ControlSend: {TAB}") Else _FileWriteLog($hFile, "Error ControlSend: {TAB}") Exit EndIf Sleep(500) If ControlSend($hWnd, "", "", $ToC) = 1 Then _FileWriteLog($hFile, "OK ControlSend: " & $ToC) Else _FileWriteLog($hFile, "Error ControlSend: " & $ToC) Exit EndIf Sleep(1000) If ControlSend($hWnd, "", "", "{TAB}") = 1 Then _FileWriteLog($hFile, "OK ControlSend: {TAB}") Else _FileWriteLog($hFile, "Error ControlSend: {TAB}") Exit EndIf Sleep(500) If WinActive($hWnd, "") Then MouseClick($MOUSE_CLICK_LEFT, 328, 283) _FileWriteLog($hFile, "Click: Ambos") Sleep(1000) EndIf ;32 - Listar Nº Referencia Global $sCoords[4] = [323, 321, 333, 331] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\05.png", 0.70, $sCoords, 1, 1000);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If Not @error Then _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found Sleep(100) _ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position Sleep(500) ;Else ;Exit EndIf ;34 - No listar ctas sin movimiento Global $sCoords[4] = [323, 364, 333, 374] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\05.png", 0.70, $sCoords, 1, 1000);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If Not @error Then _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found Sleep(100) _ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position Sleep(500) ;Else ;Exit EndIf ;35 - No listar ctas con saldo 0 Global $sCoords[4] = [323, 385, 334, 398] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\06.png", 0.70, $sCoords, 1, 500);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If Not @error Then _MarkMatch($Match1) ;Debugging: Draws a rect on the screen/coordinates of the match to show the user where the match was found Sleep(100) _ClickMouse($Match1, "left",1) ;Calculates the center of the match and clicks the left mouse once on click position Sleep(500) ;Else ;Exit EndIf If WinActive($hWnd, "") Then MouseClick($MOUSE_CLICK_LEFT, 93, 87) _FileWriteLog($hFile, "Click: pantalla") Sleep(1000) EndIf $offset = 1 While 1 If Not WinExists("__._._._ - Conexión a Escritorio remoto") Then _FileWriteLog($hFile, "Error Not WinExists: __._._._") ExitLoop Else If Not WinActive($hWnd, "") Then If _Timer_GetIdleTime() > 30000 Then WinActivate($hWnd) WinWaitActive($hWnd, "", 10) WinSetState($hWnd, "", @SW_MAXIMIZE) EndIf Sleep(5000) Else If $Found = False Then Global $sCoords[4] = [132, 45, 139, 55] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\Listado_Plan_Contable.png", 0.70, $sCoords, 1, 1000);Try to find the match picture on the screen. Number of tries: 1, Sleep between each try: 1000ms. If @error Then If WinActive($hWnd, "") Then $mouse = MouseGetPos() MouseMove($mouse[0] + $offset, $mouse[1] + $offset) $offset = -$offset EndIf Else $Found = True ConsoleWrite("Found: Listado_Plan_Contable.png" & @crlf) _FileWriteLog($hFile, "Found: Listado_Plan_Contable.png") EndIf Sleep(5000) Else Global $sCoords[4] = [132, 45, 139, 55] Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\a3\Listado_Plan_Contable.png", 0.70, $sCoords, 1, 1000);Try to find the match picture on the screen. Number of tries: 1, Sleep between each try: 1000ms. If @error Then _FileWriteLog($hFile, "Not Found: Listado_Plan_Contable.png") ConsoleWrite("Not Found: Listado_Plan_Contable.png" & @crlf) If ControlSend($hWnd, "", "", "{F10}") = 1 Then _FileWriteLog($hFile, "OK ControlSend: {F10}") Else _FileWriteLog($hFile, "Error ControlSend: {F10}") Exit EndIf Sleep(3000) If ControlSend($hWnd, "", "", $sFilePath2) = 1 Then _FileWriteLog($hFile, "OK ControlSend: " & $sFilePath2) Else _FileWriteLog($hFile, "Error ControlSend: " & $sFilePath2) Exit EndIf Sleep(3000) If ControlSend($hWnd, "", "", "{ENTER}") = 1 Then _FileWriteLog($hFile, "OK ControlSend: {ENTER}") Else _FileWriteLog($hFile, "Error ControlSend: {ENTER}") Exit EndIf For $j = 0 To 29 Sleep(20000) If WinActive($hWnd, "") Then $mouse = MouseGetPos() MouseMove($mouse[0] + $offset, $mouse[1] + $offset) $offset = -$offset EndIf $iFileExists = FileExists($sFilePath2) If $iFileExists Then _FileWriteLog($hFile, "OK FileExists: " & $sFilePath2) ExitLoop Else _FileWriteLog($hFile, "Sleep(20000)") EndIf Next ExitLoop Else Sleep(5000) EndIf EndIf EndIf EndIf WEnd For $j = 0 To 300 $iFileExists = FileExists($sFilePath2) If $iFileExists Then While _WinAPI_FileInUse($sFilePath2) Sleep(1000) WEnd ExitLoop Else Sleep(1000) EndIf Next If FileExists($sFilePath2) Then If FileMove($sFilePath2, $sFilePath4, 1) = 1 Then _FileWriteLog($hFile, "OK FileMove") Global $iFileSize = FileGetSize($sFilePath4) $CleanLog = True Else _FileWriteLog($hFile, "Error FileMove") Exit EndIf Sleep(1000) While _WinAPI_FileInUse($sFilePath4) Sleep(1000) WEnd Sleep(1000) ;Evitar coincidir con ... (22 horas) While 1 ;use infinite loop since ExitLoop will get called If Abs(_DateDiff('n', $Year & "/" & $Mon & "/" & $Day & " 22:00:00", _NowCalc())) > 5 Then ExitLoop EndIf Sleep(1000) WEnd ;Outra forma ;Do ;Sleep(1000) ;Until Abs(_DateDiff('n', @YEAR & "/" & $Mon & "/" & @MDAY & " 22:00:00", _NowCalc())) > 5 RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & "C:\Users\...\Strings\RTF_to_DataBase.au3" & '"', "", @SW_SHOW, 0) _FileWriteLog($hFile, "OK: RTF_to_DataBase.au3") FileRecycle($sFilePath4) _FileWriteLog($hFile, "FileRecycle") If $sms Then Global $sResp = _HTTP_Post("http://api.mensatek.com/sms/v5/enviar.php", "Correo=" & URLEncode("SOME@DOMAIN.com") & "&Passwd=01234&Remitente=ABCDE&Destinatarios=" & URLEncode("34612345678") & "&Mensaje=" & URLEncode("OK: File size " & $iFileSize & " bytes") & "&Resp=JSON") ;Open the file for write access. Global $hFileOpen = FileOpen(@DesktopDir & "\Resp_mensatek.txt", 2) ;If $hFileOpen = -1 Then ;MsgBox(0, "", "An error occurred when reading/writing the file.") ;EndIf ;Write some data. FileWrite($hFileOpen, $sResp) ;Close the handle returned by FileOpen. FileClose($hFileOpen) EndIf Else _FileWriteLog($hFile, "Error Not FileExists: " & $sFilePath2) Exit EndIf Else ;MsgBox(0, "Error", "Window not active") ;Local $hActive = WinGetHandle("[active]") ;Local $sTitle = WinGetTitle("[active]") ;MsgBox(0, "Error", $sTitle) ;Open the file for write access. Global $hFileOpen = FileOpen(@DesktopDir & "\RDP_A3_OpenCV_ERROR.txt", 2) ;If $hFileOpen = -1 Then ;MsgBox(0, "", "An error occurred when reading/writing the file.") ;EndIf ;Write some data. FileWrite($hFileOpen, "ERROR: Conexión a Escritorio remoto non é a ventana activa") ;Close the handle returned by FileOpen. FileClose($hFileOpen) EndIf Func _CheckFullScreen() ;Check fullscreen ;https://superuser.com/questions/94620/remote-desktop-doesnt-maximize-to-fullscreen ;Try CTRL+ALT+BREAK - which switches the client between full-screen mode and window mode. ;https://learn.microsoft.com/en-us/windows/win32/termserv/terminal-services-shortcut-keys ;--- ;When you launch RDP dialog and before you logon/connect to the remote computer, select the Display Tab and set your display configuration. ;If you want full screen mode, set the slider all the way to the right. Global $sCoords[4] = [10, 10, 40, 170] While 1 ;use infinite loop since ExitLoop will get called Global $Match1 = _MatchPicture($sOpenCVDir & "\Match\0000.png", 0.70, $sCoords, 1, 1000);Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If @error Then Sleep(100) ExitLoop EndIf ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "^!{BREAK}") = 1 Then _FileWriteLog($hFile, "OK ControlSend: ^!{BREAK}") Else _FileWriteLog($hFile, "Error ControlSend: ^!{BREAK}") EndIf $RestoreBreak = True Sleep(2000) WEnd EndFunc Func _RDPClose($iLine) If Not WinActive($hWnd, "") Then WinActivate($hWnd) WinWaitActive($hWnd, "", 10) WinSetState($hWnd, "", @SW_MAXIMIZE) Sleep(3000) EndIf ;Test if the window is now activated ;You can use the WinActive() function to check if WinActivate() succeeded. If WinActive($hWnd, "") Then ;WinSetState($hWnd, "", @SW_MAXIMIZE) ;MsgBox(0, "", "Window NOW active") Sleep(2000) _CheckFullScreen() ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "#r") = 1 Then ;_FileWriteLog($hFile, "OK ControlSend: #r [" & $iLine & "]") Sleep(2000) If ControlSend($hWnd, "", "", "shutdown -L") = 1 Then ;_FileWriteLog($hFile, "OK ControlSend: shutdown -L [" & $iLine & "]") Sleep(2000) ControlSend($hWnd, "", "", "{ENTER}") Else SetError(2) ;_FileWriteLog($hFile, "Error ControlSend: shutdown -L [" & $iLine & "]") EndIf Else SetError(1) ;_FileWriteLog($hFile, "Error ControlSend: #r [" & $iLine & "]") EndIf Sleep(5000) EndIf EndFunc Func _ProcessClean($iLine) If Not WinActive($hWnd, "") Then WinActivate($hWnd) WinWaitActive($hWnd, "", 10) WinSetState($hWnd, "", @SW_MAXIMIZE) Sleep(3000) EndIf ;Test if the window is now activated ;You can use the WinActive() function to check if WinActivate() succeeded. If WinActive($hWnd, "") Then ;WinSetState($hWnd, "", @SW_MAXIMIZE) ;MsgBox(0, "", "Window NOW active") Sleep(2000) ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "#r") = 1 Then _FileWriteLog($hFile, "OK ControlSend: #r [" & $iLine & "]") Sleep(2000) If ControlSend($hWnd, "", "", "TASKKILL /F /IM A3_SOME-2.EXE") = 1 Then _FileWriteLog($hFile, "OK ControlSend: TASKKILL /F /IM A3_SOME-2.EXE [" & $iLine & "]") Sleep(2000) ControlSend($hWnd, "", "", "{ENTER}") Else SetError(2) _FileWriteLog($hFile, "Error ControlSend: TASKKILL /F /IM A3_SOME-2.EXE [" & $iLine & "]") EndIf Else SetError(1) _FileWriteLog($hFile, "Error ControlSend: #r [" & $iLine & "]") EndIf Sleep(5000) ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "#r") = 1 Then _FileWriteLog($hFile, "OK ControlSend: #r [" & $iLine & "]") Sleep(2000) If ControlSend($hWnd, "", "", "TASKKILL /F /IM A3_SOME.EXE") = 1 Then _FileWriteLog($hFile, "OK ControlSend: TASKKILL /F /IM A3_SOME.EXE [" & $iLine & "]") Sleep(2000) ControlSend($hWnd, "", "", "{ENTER}") Else SetError(2) _FileWriteLog($hFile, "Error ControlSend: TASKKILL /F /IM A3_SOME.EXE [" & $iLine & "]") EndIf Else SetError(1) _FileWriteLog($hFile, "Error ControlSend: #r [" & $iLine & "]") EndIf Sleep(5000) ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "#r") = 1 Then _FileWriteLog($hFile, "OK ControlSend: #r [" & $iLine & "]") Sleep(2000) If ControlSend($hWnd, "", "", "TASKKILL /F /IM EXCEL.EXE") = 1 Then _FileWriteLog($hFile, "OK ControlSend: TASKKILL /F /IM EXCEL.EXE [" & $iLine & "]") Sleep(2000) ControlSend($hWnd, "", "", "{ENTER}") Else SetError(2) _FileWriteLog($hFile, "Error ControlSend: TASKKILL /F /IM EXCEL.EXE [" & $iLine & "]") EndIf Else SetError(1) _FileWriteLog($hFile, "Error ControlSend: #r [" & $iLine & "]") EndIf Sleep(2000) ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "#r") = 1 Then _FileWriteLog($hFile, "OK ControlSend: #r [" & $iLine & "]") Sleep(2000) If ControlSend($hWnd, "", "", "TASKKILL /F /IM SOME.EXE") = 1 Then _FileWriteLog($hFile, "OK ControlSend: TASKKILL /F /IM SOME.EXE [" & $iLine & "]") Sleep(2000) ControlSend($hWnd, "", "", "{ENTER}") Else SetError(2) _FileWriteLog($hFile, "Error ControlSend: TASKKILL /F /IM SOME.EXE [" & $iLine & "]") EndIf Else SetError(1) _FileWriteLog($hFile, "Error ControlSend: #r [" & $iLine & "]") EndIf Sleep(2000) ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "#d") = 1 Then _FileWriteLog($hFile, "OK ControlSend: #d [" & $iLine & "]") Else SetError(1) _FileWriteLog($hFile, "Error ControlSend: #d [" & $iLine & "]") EndIf Sleep(2000) EndIf EndFunc Func OnAutoItExit() If WinExists("__._._._ - Conexión a Escritorio remoto") Then If Not WinActive($hWnd, "") Then WinActivate($hWnd) WinWaitActive($hWnd, "", 10) WinSetState($hWnd, "", @SW_MAXIMIZE) Sleep(5000) EndIf ;Test if the window is now activated ;You can use the WinActive() function to check if WinActivate() succeeded. If WinActive($hWnd, "") Then ;WinSetState($hWnd, "", @SW_MAXIMIZE) ;MsgBox(0, "", "Window NOW active") _RDPClose(@ScriptLineNumber) EndIf EndIf _OpenCV_Shutdown();Closes DLLs ;_CFS_ReleaseSemaphore($logfile) FileClose($hFile) If $CleanLog Then FileRecycle($sFilePathLog) If $RestoreBreak Then ;google keywords: restore pause break key vba ;https://stackoverflow.com/questions/2154699/excel-vba-app-stops-spontaneously-with-message-code-execution-has-been-halted Send("{CTRLDOWN}{BREAK}{CTRLUP}") EndIf EndFunc Include.7z
  6. There would be common sense rules that we should all respect, for example, avoiding unfounded suspicions/accusations and always thinking carefully before writing. And these are laws or fundamental rights: the presumption of innocence and the freedom of expression. Here an example of a broken logical rule: You drive the company car and you get fined. There is a company rule that you must pay, because you should avoid infringement of the rules But if the fine refers to the condition of the vehicle, the rule does not make any sense in this case. There's a saying in Spanish: Prudence is a good advisor I need to interact with the rdp session because of an accounting software that uses flat files instead of a relational database. I'm using AutoIt as user automation, to export a .rtf report and from this file loading Access tables. Does this breaks some rule ? Possibly, because the vendor offers an expensive solution to export your own data to databases.
  7. Perhaps always trying to close and then open, Opt('WinWaitDelay', 250) Opt('WinDetectHiddenText', 1) Opt('MouseCoordMode', 0) Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("SendKeyDelay", 75) Opt("SendKeyDownDelay", Default) Opt("SendCapslockMode", 1) Global $hWnd $hWnd = WinWait("__._._.__ - Conexión a Escritorio remoto", "", 90) If WinExists($hWnd) Then If Not WinActive($hWnd, "") Then WinActivate($hWnd) WinWaitActive($hWnd, "", 60000) ;WinSetState($hWnd, "", @SW_MAXIMIZE) Sleep(1000) EndIf If WinActive($hWnd, "") Then ;_FileWriteLog($hFile, "OK Active Window") EndIf EndIf ;https://stackoverflow.com/questions/26505329/autoit-controlsend-remote-desktop If ControlSend($hWnd, "", "", "#r") = 1 Then ;_FileWriteLog($hFile, "OK ControlSend: #r [" & $iLine & "]") Sleep(2000) If ControlSend($hWnd, "", "", "TASKKILL /F /IM EXCEL.EXE") = 1 Then ;_FileWriteLog($hFile, "OK ControlSend: TASKKILL /F /IM EXCEL.EXE [" & $iLine & "]") Sleep(2000) ControlSend($hWnd, "", "", "{ENTER}") Else SetError(2) ;_FileWriteLog($hFile, "Error ControlSend: TASKKILL /F /IM EXCEL.EXE [" & $iLine & "]") EndIf Else SetError(1) ;_FileWriteLog($hFile, "Error ControlSend: #r [" & $iLine & "]") EndIf Sleep(2000)
  8. Perhaps using this funcion to detect open excel files in the folder, and then closing them passing their paths to the Excel UDF: _WinAPI_FileInUse This could give some ideas: #include <File.au3> #include <WinAPIFiles.au3> Global $aFileList, $bFileOpen Global $sFolder = FileSelectFolder("Directory", "") ;Global $sFolder = FileSelectFolder("Select root folder", @ScriptDir, 0, @ScriptDir) Global $sFolderLen = StringLen($sFolder) If StringRight($sFolder, 1) = "\" Then $sFolderLen += 1 $aFileList = _FileListToArray($sFolder, "*.xls", 1, True) If Not @error Then For $i = 1 To $aFileList[0] ;Discard some kind of temp files (locked files from antivirus?) If StringInStr($aFileList[$i], "~", 0, 1, $sFolderLen) > 0 Then Consolewrite($aFileList[$i] & @CRLF) ;FileDelete($aFileList[$i]) ContinueLoop EndIf $bFileOpen = _WinAPI_FileInUse($aFileList[$i]) If $bFileOpen = 0 Then Consolewrite($aFileList[$i] & @CRLF) Else Consolewrite("Locked file: " & $aFileList[$i] & @CRLF) EndIf Next Else MsgBox(16, "Error", "No excel files were found in the folder") EndIf
  9. Just for ideas, related with paths, not MsgBox:
  10. Another possible idea, try with this UDF: http://github.com/jesobreira/HTTP.au3 from:
  11. Would this be an idea? Googling: WinHttp stunnel
  12. I'd try this for stored procedures returning a recordset: Global Const $iCursorType = 3 ;0 adOpenForwardOnly, 3 adOpenStatic Global Const $iLockType = 1 ;1 adLockReadOnly, 3 adLockOptimistic Global Const $iOptions = 1 ; Options, 1 Evaluates as a textual definition of a command or stored procedure call $oRS.Open ("EXEC admin.sp_my_procedure '" & $StringParam & "', " & $NumParam ";", $oConn, $iCursorType, $iLockType, $iOptions)
  13. Some ideas: Avoid "double dot" notation (see example below) Wait for Application.Ready Update AutoIt Minimize interaction with the sheet: read a whole range and then work with the data array Code example: #include <Excel.au3> #include <WinAPIFiles.au3> Global $sFilePath2 = @ScriptDir & "\Test.xlsx" Global $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") ;Install a custom error handler Global $iEventError ; to be checked to know if com error occurs. Must be reset after handling. Global $Rows, $oAppl, $oWorkbook, $oSheet, $oRange $Rows = 2 ;water: force the Excel UDF to always start up a new instance by using: _Excel_Open(False, Default, Default, Default, True) $oAppl = _Excel_Open(True, False, False, Default, True) ;Global $oAppl = _Excel_Open() ;_Excel_Open(Default, Default, False, Default, Default) ;If @error Then Exit MsgBox(0, "Error", "Error _Excel_Open" & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;https://www.autoitscript.com/forum/topic/185789-solved-excel_bookopen-without-wait/?do=findComment&comment=1334509 ;https://stackoverflow.com/questions/32513797/test-if-excel-has-finished-its-startup-shutdown-sequence While Not $oAppl.ready Sleep(1000) WEnd $oAppl.EnableEvents = False $oAppl.DisplayAlerts = False ;Global $oWorkbook = _Excel_BookOpen($oAppl, $sFilePath2, False, True) ;If @error Then Exit MsgBox(0, "Error", "Error _Excel_BookOpen: " & $sFilePath & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;Create a new workbook with only 1 worksheet $oWorkbook = _Excel_BookNew($oAppl, 1) ;If @error Then Exit MsgBox(0, "Excel UDF: _Excel_BookNew Example 1", "Error creating new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;MsgBox(0, "Excel UDF: _Excel_BookNew Example 1", "Workbook has been created successfully with only 1 worksheets.") ;https://stackoverflow.com/questions/32513797/test-if-excel-has-finished-its-startup-shutdown-sequence While Not $oAppl.ready Sleep(1000) WEnd Sleep(3000) $oWorkbook.UpdateLinks = 2 ;xlUpdateLinksNever ;https://www.autoitscript.com/forum/topic/166043-close-the-entire-application-of-excel/?do=findComment&comment=1263179 ;water ;Seems Excel doesn't like double dot notation. "chaining" object references seems to be a problem. ;So I changed the code to only have single dot notation. Could you please test this version? ;https://www.add-in-express.com/creating-addins-blog/2013/11/05/release-excel-com-objects/ ;Global $oSheets = $oWorkbook.Sheets $oSheet = $oWorkbook.ActiveSheet ;Global $oSheet = $oWorkbook.Sheets("Main") ;MsgBox(0, "", $oSheet.Name) While Not $oAppl.ready Sleep(1000) WEnd ;http://www.siddharthrout.com/index.php/2018/02/10/find-last-row-and-last-column/ ;Find Last Row and Last Column. Siddharth Rout, Feb 2018 ;~ Global $LastRow = $oSheet.Cells(5000, 1).End(-4162).Row ;$UltimaFila = $oSheet.Cells(23, 1).End(-4121).Row ;MsgBox(0, "", $UltimaFila) ;$oWorkbook.Sheets.Item(2).Activate ;$Signal = $oSheet.Cells(21, 1).Value ;$oSheet.Range("I4").value = "ABC" ;$oSheet.Range("J25:K25").Value = 100 ;$oSheet.PrintOut ;~ Global $aResult = _Excel_RangeRead($oWorkbook, Default, $oSheet.Range("A9:E" & $LastRow), 1) ;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $oPageSetup = $oSheet.PageSetup With $oPageSetup ;.PrintTitleRows = "$1:$1" .PrintTitleColumns = "" .PrintArea = "" .LeftHeader = "&D" .CenterHeader = "Example" ;.RightHeader = "&P of &N" ;.LeftFooter = "&F {&A}" .CenterFooter = "" .RightFooter = "" .LeftMargin = 28 .RightMargin = 28 .TopMargin = 28 .BottomMargin = 28 .HeaderMargin = 15 .FooterMargin = 15 .PrintHeadings = False .PrintGridlines = False .PrintComments = -4142 .CenterHorizontally = False .CenterVertically = False .Orientation = 1 .Draft = False .FirstPageNumber = -4105 .Order = 1 .BlackAndWhite = False .Zoom = False ;100 .FitToPagesWide = 1 .FitToPagesTall = 1 EndWith Global $aArray1D[2] = ["Factura", "EUR"] $oRange = $oSheet.Range("A1:B1") If $iEventError Then Consolewrite("+--> Error: $oSheet.Range('A1:B1')" & @CRLF) $iEventError = 0 ; Reset after displaying a COM Error occurred EndIf With $oRange .HorizontalAlignment = -4108 .value = $aArray1D ;.Font.Bold = True ;.AutoFilter EndWith While Not $oAppl.ready Sleep(1000) WEnd While Not $oAppl.ready Sleep(1000) WEnd ;$oAppl.ActiveWindow.DisplayZeros = False $oAppl.ActiveWindow.DisplayGridlines = False $oSheet.Columns("A:B").ColumnWidth = 10 ;$oSheet.Columns(3).ColumnWidth = 10 If $iEventError Then Consolewrite("+--> Error ColumnWidth" & @CRLF) $iEventError = 0 ; Reset after displaying a COM Error occurred EndIf ;$oSheet.Range("A2:B" & $Rows).HorizontalAlignment = -4108 ;$oSheet.Range("B2:B" & $Rows).NumberFormat = "dd/mm;@" ;$oSheet.Range("C2:C" & $Rows).NumberFormat = "#.##0,00" ;$oSheet.Range("H2:H" & $Rows).WrapText = True ;$oSheet.Range("H2:H" & $Rows).Font.Size = 8 ;$oSheet.Range("A2:M" & $Rows).VerticalAlignment = -4160 $oSheet.Range("A2:A" & $Rows).NumberFormat = "@" ;$oSheet.Cells(1, 1).Resize(1, 7).Font.Bold = True ;$oSheet.Cells(1, 1).Resize($Rows, 1).Font.Bold = True ;$oSheet.Cells(1, 1).Resize(1, 3).AutoFilter While Not $oAppl.ready Sleep(1000) WEnd ;water, Aug 2016 ;https://www.autoitscript.com/forum/topic/184041-excel-formatting-cellsborders/?do=findComment&comment=1321855 ;XlListObjectSourceType Enumeration - https://msdn.microsoft.com/en-us/library/ff820815(v=office.14).aspx Global $xlSrcRange = 1 With $oSheet .ListObjects.Add($xlSrcRange, .Range("A1:B" & $Rows), Default, $xlYes).Name = "TB_Datos" .ListObjects("TB_Datos").TableStyle = "TableStyleMedium6" .ListObjects("TB_Datos").ShowTotals = True EndWith _Excel_BookSaveAs($oWorkbook, $sFilePath2, $xlOpenXMLWorkbook, True) ;$xlOpenXMLWorkbook 51 ;$xlExcel8 56 ;https://stackoverflow.com/questions/32513797/test-if-excel-has-finished-its-startup-shutdown-sequence While Not $oAppl.ready Sleep(1000) WEnd _Excel_BookClose($oWorkbook, False) ;If @error Then Exit MsgBox(0, "Error", "Error _Excel_BookClose: " & $sFilePath & @CRLF & "@error = " & @error & ", @extended = " & @extended) While _WinAPI_FileInUse($sFilePath2) Sleep(1000) Wend While _WinAPI_FileInUse($sFilePath2) Sleep(1000) Wend Sleep(3000) $oAppl.EnableEvents = True $oAppl.DisplayAlerts = True _Excel_Close($oAppl, False, True) ;If @error Then Exit MsgBox(0, "Error", "Error _Excel_Close" & @CRLF & "@error = " & @error & ", @extended = " & @extended) Sleep(5000) ;deixar tempo para cerrar proceso ;Chequear si quedou cerrado Excel Global $aProcesses = ProcessList("Excel.exe") ;_ArrayDisplay($aProcesses) If $aProcesses[0][0] > 0 Then ;https://www.autoitscript.com/forum/topic/166043-close-the-entire-application-of-excel/?do=findComment&comment=1263191 ;@water, thanks for your help so far, at least we pinned down that it's not a UDF bug. :) ;For now I will use a crude workaround by closing the most recent Excel.exe instance: ProcessClose($aProcesses[$aProcesses[0][0]][1]) Sleep(500) ;just to allow some time for the process to definitely close (if it does close) EndIf ;This is a custom error handler Func ErrFunc() Local $HexNumber = Hex($oMyError.number, 8) ;~ MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _ ;~ "Number is: " & $HexNumber & @CRLF & _ ;~ "WinDescription is: " & $oMyError.windescription) ConsoleWrite("-> We intercepted a COM Error !" & @CRLF & _ "-> err.number is: " & @TAB & $HexNumber & @CRLF & _ "-> err.source: " & @TAB & $oMyError.source & @CRLF & _ "-> err.windescription: " & @TAB & $oMyError.windescription & _ "-> err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF) $iEventError = 1 ; Use to check when a COM Error occurs $sTxt = "Err Excel" Consolewrite($sTxt & @CRLF) ;_FileWriteLog($hFile, $sTxt) EndFunc ;==>ErrFunc
  14. Just to share a reference: https://stackoverflow.com/questions/8377306/validate-iban-in-excel And an example function for BIC (Bank Identifier Code) complete for Spain, and only some data for Portugal and Italy: #include <StringConstants.au3> Global $sIBAN = "ES4221009668423577522711" ConsoleWrite(_BIC($sIBAN) & @CRLF) Func _BIC($iban) If StringCompare(StringLeft($iban, 2), "ES", $STR_NOCASESENSEBASIC) = 0 Then Switch Stringmid($iban, 5, 4) Case "0003" Return "BDEPESM1XXX" Case "0003" Return "BDEPESM1XXX" Case "0004" Return "BANDESSSXXX" Case "0008" Return "BSABESBBXXX" Case "0010" Return "BBVAESMMXXX" Case "0013" Return "SLBKESBBXXX" Case "0015" Return "CATAESBBXXX" Case "0016" Return "CENTESMM" Case "0019" Return "DEUTESBBXXX" Case "0020" Return "BCIOESMMXXX" Case "0024" Return "BALEES22XXX" Case "0029" Return "CRLEESMMXXX" Case "0030" Return "ESPCESMMXXX" Case "0031" Return "ETCHES2GXXX" Case "0036" Return "SABNESMMXXX" Case "0042" Return "BGUIES22XXX" Case "0046" Return "GALEES2GXXX" Case "0049" Return "BSCHESMMXXX" Case "0057" Return "BVADESMMXXX" Case "0058" Return "BNPAESMMXXX" Case "0059" Return "MADRESMMXXX" Case "0061" Return "BMARES2MXXX" Case "0065" Return "BARCESMMXXX" Case "0072" Return "PSTRESMMXXX" Case "0073" Return "OPENESMMXXX" Case "0075" Return "BSCHESMMXXX" Case "0078" Return "BAPUES22XXX" Case "0081" Return "BSABESBBXXX" Case "0083" Return "RENBESMMXXX" Case "0086" Return "NORTESMMXXX" Case "0093" Return "VALEESVVXXX" Case "0094" Return "BVALESMMXXX" Case "0099" Return "AHCRESVVXXX" Case "0106" Return "LOYDESMMXXX" Case "0107" Return "BNLIESM1XXX" Case "0108" Return "SOGEESMMXXX" Case "0113" Return "INBBESM1XXX" Case "0121" Return "OCBAESM1XXX" Case "0122" Return "CITIES2XXXX" Case "0125" Return "BAOFESM1XXX" Case "0128" Return "BKBKESMMXXX" Case "0129" Return "INALESM1XXX" Case "0130" Return "CGDIESMMXXX" Case "0131" Return "BESMESMMXXX" Case "0132" Return "PRNEESM1XXX" Case "0133" Return "MIKBESB1XXX" Case "0136" Return "AREBESMMXXX" Case "0138" Return "BKOAES22XXX" Case "0144" Return "PARBESMXXXX" Case "0145" Return "DEUTESM1XXX" Case "0149" Return "BNPAESMSXXX" Case "0151" Return "CHASESM3XXX" Case "0211" Return "PROAESMMXXX" Case "0216" Return "POHIESMMXXX" Case "0217" Return "HLFXESMMXXX" Case "0219" Return "BMCEESMMXXX" Case "0220" Return "FIOFESM1XXX" Case "0227" Return "UNOEESM1XXX" Case "0229" Return "POPLESMMXXX" Case "0487" Return "GBMNESMMXXX" Case "1000" Return "ICROESMMXXX" Case "1302" Return "BBVAESMMXXX" Case "1465" Return "INGDESMMXXX" Case "1490" Return "SELFESMMXXX" Case "1491" Return "TRIOESMMXXX" Case "2000" Return "CECAESMMXXX" Case "2010" Return "CECAESMM1" Case "2013" Return "CESCESBBXXX" Case "2017" Return "CECAESMM17" Case "2018" Return "CECAESMM18" Case "2031" Return "CECAESMM31" Case "2038" Return "CAHMESMMXXX" Case "2043" Return "CECAESMM43" Case "2045" Return "CECAESMM45" Case "2048" Return "CECAESMM48" Case "2051" Return "CECAESMM51" Case "2052" Return "CECAESMM52" Case "2056" Return "CECAESMM56" Case "2059" Return "CECAESMM59" Case "2066" Return "CECAESMM66" Case "2080" Return "CAGLESMMVIG" Case "2081" Return "CECAESMM81" Case "2085" Return "CAZRES2ZXXX" Case "2086" Return "CECAESMM86" Case "2095" Return "BASKES2BXXX" Case "2096" Return "CSPAES2LXXX" Case "2099" Return "CECAESMM99" Case "2100" Return "CAIXESBBXXX" Case "2101" Return "CGGKES22XXX" Case "2103" Return "UCJAES2MXXX" Case "2104" Return "CSSOES2SXXX" Case "2105" Return "CECAESMM15" Case "2107" Return "BBVAESMM17" Case "3001" Return "BCOEESMM1" Case "3005" Return "BCOEESMM5" Case "3007" Return "BCOEESMM7" Case "3008" Return "BCOEESMM8" Case "3009" Return "BCOEESMM9" Case "3016" Return "BCOEESMM16" Case "3017" Return "BCOEESMM17" Case "3018" Return "BCOEESMM18" Case "3020" Return "BCOEESMM2" Case "3023" Return "BCOEESMM23" Case "3025" Return "CDENESBBXXX" Case "3029" Return "CCRIES2A29" Case "3035" Return "CLPEES2MXXX" Case "3045" Return "CCRIES2A45" Case "3058" Return "CCRIES2AXXX" Case "3059" Return "BCOEESMM59" Case "3060" Return "BCOEESMM6" Case "3063" Return "BCOEESMM63" Case "3067" Return "BCOEESMM67" Case "3070" Return "BCOEESMM7" Case "3076" Return "BCOEESMM76" Case "3080" Return "BCOEESMM8" Case "3081" Return "BCOEESMM81" Case "3082" Return "CCRIES2A82" Case "3084" Return "CVRVES2BXXX" Case "3085" Return "BCOEESMM85" Case "3089" Return "BCOEESMM89" Case "3095" Return "CCRIES2A95" Case "3096" Return "BCOEESMM96" Case "3098" Return "BCOEESMM98" Case "3102" Return "BCOEESMM12" Case "3104" Return "BCOEESMM14" Case "3105" Return "CCRIES2A15" Case "3110" Return "BCOEESMM11" Case "3111" Return "BCOEESMM111" Case "3112" Return "CCRIES2A112" Case "3113" Return "BCOEESMM113" Case "3114" Return "CCRIES2A114" Case "3115" Return "BCOEESMM115" Case "3116" Return "BCOEESMM116" Case "3117" Return "BCOEESMM117" Case "3118" Return "CCRIES2A118" Case "3119" Return "CCRIES2A119" Case "3121" Return "CCRIES2A121" Case "3123" Return "CCRIES2A123" Case "3127" Return "BCOEESMM127" Case "3130" Return "BCOEESMM13" Case "3134" Return "BCOEESMM134" Case "3135" Return "CCRIES2A135" Case "3137" Return "CCRIES2A137" Case "3138" Return "BCOEESMM138" Case "3140" Return "BCOEESMM14" Case "3144" Return "BCOEESMM144" Case "3146" Return "CCCVESM1XXX" Case "3150" Return "BCOEESMM15" Case "3152" Return "CCRIES2A152" Case "3157" Return "CCRIES2A157" Case "3159" Return "BCOEESMM159" Case "3160" Return "CCRIES2A16" Case "3162" Return "BCOEESMM162" Case "3165" Return "CCRIES2A165" Case "3166" Return "BCOEESMM166" Case "3171" Return "CXAVESB1XXX" Case "3172" Return "CCOCESMMXXX" Case "3174" Return "BCOEESMM174" Case "3177" Return "BCOEESMM177" Case "3179" Return "CCRIES2A179" Case "3183" Return "CASDESBBXXX" Case "3187" Return "BCOEESMM187" Case "3188" Return "CCRIES2A188" Case "9000" Return "ESPBESMMXXX" Case "3191" Return "BCOEESMM191" Case "0011" Return "ALLFESMMXXX" Case "0184" Return "BEDFESM1XXX" Case "0223" Return "GEECESB1XXX" Case "0224" Return "SCFBESMMXXX" Case "0225" Return "FIEIESM1XXX" Case "0226" Return "UBSWESMMXXX" Case "0231" Return "DSBLESMMXXX" Case "0232" Return "INVLESMMXXX" Case "0233" Return "POPIESMMXXX" Case "0234" Return "CCOCESMMXXX" Case "0235" Return "PIESESM1XXX" Case "0236" Return "LOYIESMMXXX" Case "0237" Return "CSURES2CXXX" Case "0488" Return "BFASESMMXXX" Case "0490" Return "GBCCESMMXXX" Case "2108" Return "CSPAES2L18" Case "2404" Return "CECAESMM52" Case "2405" Return "CECAESMM42" Case "2406" Return "CECAESMM37" Case "2408" Return "CECAESMM69" Case "2410" Return "CANVES2PXXX" Case "2411" Return "CECAESMM16" Case "2412" Return "CECAESMM65" Case "2413" Return "CECAESMM18" Case "2415" Return "CECAESMM99" Case "2416" Return "CECAESMM66" Case "2421" Return "CECAESMM31" Case "2422" Return "CECAESMM43" Case "2423" Return "CECAESMM81" Case "2424" Return "CECAESMM51" Case "3186" Return "CCRIES2A186" Case "3190" Return "BCOEESMM19" Case "0021" Return "BCNDESM1XXX" Case "0041" Return "CAIXESBBXXX" Case "1460" Return "CRESESMMXXX" Case "8233" Return "CSFAESM1XXX" Case "1466" Return "FRANESM1XXX" Case "1467" Return "EHYPESMXXXX" Case "1469" Return "SHSAESM1XXX" Case "1470" Return "BPIPESM1XXX" Case "1472" Return "UCSSESM1XXX" Case "1473" Return "PRIBESMXXXX" Case "1474" Return "CITIESMXXXX" Case "1475" Return "CCSEESM1XXX" Case "1478" Return "MLIBESM1XXX" Case "1479" Return "NATXESMMXXX" Case "1480" Return "VOWAES21XXX" Case "1488" Return "PICTESMMXXX" Case "1494" Return "BCITESMMXXX" Case "1497" Return "ESSIESMMXXX" Case "1501" Return "DPBBESM1XXX" Case "1522" Return "EFGBESMMXXX" Case "1525" Return "BCDMESMMXXX" Case "1534" Return "KBLXESMMXXX" Case "1538" Return "ICBKESMMXXX" Case "1544" Return "BACAESMMXXX" Case "1116" Return "SCSIESM1XXX" Case "1127" Return "SCBLESM1XXX" Case "1156" Return "IRVTESM1XXX" Case "1168" Return "BNACESM1XXX" Case "1191" Return "HANDES21XXX" Case "1193" Return "PKBSES21XXX" Case "1196" Return "AEEVESM1XXX" Case "1197" Return "BILLESB1XXX" Case "1199" Return "CRGEESM1XXX" Case "1209" Return "ABCMESM1XXX" Case "1210" Return "REDEESM1XXX" Case "1255" Return "AARBESM1XXX" Case "1173" Return "COURESB1XXX" Case "0239" Return "CAGLESMMXXX" Case "0003" Return "BDEPESM1XXX" Case "0004" Return "BANDESSSXXX" Case "0008" Return "BSABESBBXXX" Case "0010" Return "BBVAESMMXXX" Case "0013" Return "SLBKESBBXXX" Case "0015" Return "CATAESBBXXX" Case "0016" Return "CENTESMM" Case "0019" Return "DEUTESBBXXX" Case "0020" Return "BCIOESMMXXX" Case "0024" Return "BALEES22XXX" Case "0029" Return "CRLEESMMXXX" Case "0030" Return "ESPCESMMXXX" Case "0031" Return "ETCHES2GXXX" Case "0036" Return "SABNESMMXXX" Case "0042" Return "BGUIES22XXX" Case "0046" Return "GALEES2GXXX" Case "0049" Return "BSCHESMMXXX" Case "0057" Return "BVADESMMXXX" Case "0058" Return "BNPAESMMXXX" Case "0059" Return "MADRESMMXXX" Case "0061" Return "BMARES2MXXX" Case "0065" Return "BARCESMMXXX" Case "0072" Return "PSTRESMMXXX" Case "0073" Return "OPENESMMXXX" Case "0075" Return "POPUESMMXXX" Case "0078" Return "BAPUES22XXX" Case "0081" Return "BSABESBBXXX" Case "0083" Return "RENBESMMXXX" Case "0086" Return "NORTESMMXXX" Case "0093" Return "VALEESVVXXX" Case "0094" Return "BVALESMMXXX" Case "0099" Return "AHCRESVVXXX" Case "0106" Return "LOYDESMMXXX" Case "0107" Return "BNLIESM1XXX" Case "0108" Return "SOGEESMMXXX" Case "0113" Return "INBBESM1XXX" Case "0121" Return "OCBAESM1XXX" Case "0122" Return "CITIES2XXXX" Case "0125" Return "BAOFESM1XXX" Case "0128" Return "BKBKESMMXXX" Case "0129" Return "INALESM1XXX" Case "0130" Return "CGDIESMMXXX" Case "0131" Return "BESMESMMXXX" Case "0132" Return "PRNEESM1XXX" Case "0133" Return "MIKBESB1XXX" Case "0136" Return "AREBESMMXXX" Case "0138" Return "BKOAES22XXX" Case "0144" Return "PARBESMXXXX" Case "0145" Return "DEUTESM1XXX" Case "0149" Return "BNPAESMSXXX" Case "0151" Return "CHASESM3XXX" Case "0152" Return "BPLCESMMXXX" Case "0154" Return "BSUIESMMXXX" Case "0155" Return "BRASESMMXXX" Case "0156" Return "ABNAESMMXXX" Case "0159" Return "COBAESMXXXX" Case "0160" Return "BOTKESMXXXX" Case "0161" Return "BKTRESM1XXX" Case "0162" Return "MIDLESMMXXX" Case "0167" Return "GEBAESMMXXX" Case "0168" Return "BBRUESMXXXX" Case "0169" Return "NACNESMMXXX" Case "0182" Return "BBVAESMMXXX" Case "0186" Return "BFIVESBBXXX" Case "0188" Return "ALCLESMMXXX" Case "0190" Return "BBPIESMMXXX" Case "0196" Return "WELAESMMXXX" Case "0198" Return "BCOEESMMXXX" Case "0200" Return "PRVBESB1XXX" Case "0205" Return "DECRESM1XXX" Case "0211" Return "PROAESMMXXX" Case "0216" Return "POHIESMMXXX" Case "0217" Return "HLFXESMMXXX" Case "0219" Return "BMCEESMMXXX" Case "0220" Return "FIOFESM1XXX" Case "0227" Return "UNOEESM1XXX" Case "0229" Return "POPLESMMXXX" Case "0487" Return "GBMNESMMXXX" Case "1000" Return "ICROESMMXXX" Case "1302" Return "BBVAESMMXXX" Case "1465" Return "INGDESMMXXX" Case "1490" Return "SELFESMMXXX" Case "1491" Return "TRIOESMMXXX" Case "2000" Return "CECAESMMXXX" Case "2010" Return "CECAESMM1" Case "2013" Return "CESCESBBXXX" Case "2017" Return "CECAESMM17" Case "2018" Return "CECAESMM18" Case "2031" Return "CECAESMM31" Case "2038" Return "CAHMESMMXXX" Case "2043" Return "CECAESMM43" Case "2045" Return "CECAESMM45" Case "2048" Return "CECAESMM48" Case "2051" Return "CECAESMM51" Case "2052" Return "CECAESMM52" Case "2056" Return "CECAESMM56" Case "2059" Return "CECAESMM59" Case "2066" Return "CECAESMM66" Case "2080" Return "CAGLESMMVIG" Case "2081" Return "CECAESMM81" Case "2085" Return "CAZRES2ZXXX" Case "2086" Return "CECAESMM86" Case "2095" Return "BASKES2BXXX" Case "2096" Return "CSPAES2LXXX" Case "2099" Return "CECAESMM99" Case "2100" Return "CAIXESBBXXX" Case "2101" Return "CGGKES22XXX" Case "2103" Return "UCJAES2MXXX" Case "2104" Return "CSSOES2SXXX" Case "2105" Return "CECAESMM15" Case "2107" Return "BBVAESMM17" Case "3001" Return "BCOEESMM1" Case "3005" Return "BCOEESMM5" Case "3007" Return "BCOEESMM7" Case "3008" Return "BCOEESMM8" Case "3009" Return "BCOEESMM9" Case "3016" Return "BCOEESMM16" Case "3017" Return "BCOEESMM17" Case "3018" Return "BCOEESMM18" Case "3020" Return "BCOEESMM2" Case "3023" Return "BCOEESMM23" Case "3025" Return "CDENESBBXXX" Case "3029" Return "CCRIES2A29" Case "3035" Return "CLPEES2MXXX" Case "3045" Return "CCRIES2A45" Case "3058" Return "CCRIES2AXXX" Case "3059" Return "BCOEESMM59" Case "3060" Return "BCOEESMM6" Case "3063" Return "BCOEESMM63" Case "3067" Return "BCOEESMM067" Case "3070" Return "BCOEESMM7" Case "3076" Return "BCOEESMM76" Case "3080" Return "BCOEESMM8" Case "3081" Return "BCOEESMM81" Case "3082" Return "CCRIES2A82" Case "3084" Return "CVRVES2BXXX" Case "3085" Return "BCOEESMM85" Case "3089" Return "BCOEESMM89" Case "3095" Return "CCRIES2A95" Case "3096" Return "BCOEESMM96" Case "3098" Return "BCOEESMM98" Case "3102" Return "BCOEESMM12" Case "3104" Return "BCOEESMM14" Case "3105" Return "CCRIES2A15" Case "3110" Return "BCOEESMM11" Case "3111" Return "BCOEESMM111" Case "3112" Return "CCRIES2A112" Case "3113" Return "BCOEESMM113" Case "3114" Return "CCRIES2A114" Case "3115" Return "BCOEESMM115" Case "3116" Return "BCOEESMM116" Case "3117" Return "BCOEESMM117" Case "3118" Return "CCRIES2A118" Case "3119" Return "CCRIES2A119" Case "3121" Return "CCRIES2A121" Case "3123" Return "CCRIES2A123" Case "3127" Return "BCOEESMM127" Case "3130" Return "BCOEESMM13" Case "3134" Return "BCOEESMM134" Case "3135" Return "CCRIES2A135" Case "3137" Return "CCRIES2A137" Case "3138" Return "BCOEESMM138" Case "3140" Return "BCOEESMM14" Case "3144" Return "BCOEESMM144" Case "3146" Return "CCCVESM1XXX" Case "3150" Return "BCOEESMM15" Case "3152" Return "CCRIES2A152" Case "3157" Return "CCRIES2A157" Case "3159" Return "BCOEESMM159" Case "3160" Return "CCRIES2A16" Case "3162" Return "BCOEESMM162" Case "3165" Return "CCRIES2A165" Case "3166" Return "BCOEESMM166" Case "3171" Return "CXAVESB1XXX" Case "3172" Return "CCOCESMMXXX" Case "3174" Return "BCOEESMM174" Case "3177" Return "BCOEESMM177" Case "3179" Return "CCRIES2A179" Case "3183" Return "CASDESBBXXX" Case "3187" Return "BCOEESMM187" Case "3188" Return "CCRIES2A188" Case "9000" Return "ESPBESMMXXX" Case "3191" Return "BCOEESMM191" Case "0011" Return "ALLFESMMXXX" Case "0184" Return "BEDFESM1XXX" Case "0223" Return "GEECESB1XXX" Case "0224" Return "SCFBESMMXXX" Case "0225" Return "FIEIESM1XXX" Case "0226" Return "UBSWESMMXXX" Case "0231" Return "DSBLESMMXXX" Case "0232" Return "INVLESMMXXX" Case "0233" Return "POPIESMMXXX" Case "0234" Return "CCOCESMMXXX" Case "0235" Return "PIESESM1XXX" Case "0236" Return "LOYIESMMXXX" Case "0237" Return "CSURES2CXXX" Case "0488" Return "BFASESMMXXX" Case "0490" Return "GBCCESMMXXX" Case "2108" Return "CSPAES2L18" Case "2404" Return "CECAESMM52" Case "2405" Return "CECAESMM42" Case "2406" Return "CECAESMM37" Case "2408" Return "CECAESMM69" Case "2410" Return "CANVES2PXXX" Case "2411" Return "CECAESMM16" Case "2412" Return "CECAESMM65" Case "2413" Return "CECAESMM18" Case "2415" Return "CECAESMM99" Case "2416" Return "CECAESMM66" Case "2421" Return "CECAESMM31" Case "2422" Return "CECAESMM43" Case "2423" Return "CECAESMM81" Case "2424" Return "CECAESMM51" Case "3186" Return "CCRIES2A186" Case "3190" Return "BCOEESMM19" Case "0021" Return "BCNDESM1XXX" Case "0041" Return "CAIXESBBXXX" Case "1460" Return "CRESESMMXXX" Case "8233" Return "CSFAESM1XXX" Case "1466" Return "FRANESM1XXX" Case "1467" Return "EHYPESMXXXX" Case "1469" Return "SHSAESM1XXX" Case "1470" Return "BPIPESM1XXX" Case "1472" Return "UCSSESM1XXX" Case "1473" Return "PRIBESMXXXX" Case "1474" Return "CITIESMXXXX" Case "1475" Return "CCSEESM1XXX" Case "1478" Return "MLIBESM1XXX" Case "1479" Return "NATXESMMXXX" Case "1480" Return "VOWAES21XXX" Case "1488" Return "PICTESMMXXX" Case "1494" Return "BCITESMMXXX" Case "1497" Return "ESSIESMMXXX" Case "1501" Return "DPBBESM1XXX" Case "1522" Return "EFGBESMMXXX" Case "1525" Return "BCDMESMMXXX" Case "1534" Return "KBLXESMMXXX" Case "1538" Return "ICBKESMMXXX" Case "1544" Return "BACAESMMXXX" Case "1116" Return "SCSIESM1XXX" Case "1127" Return "SCBLESM1XXX" Case "1156" Return "IRVTESM1XXX" Case "1168" Return "BNACESM1XXX" Case "1191" Return "HANDES21XXX" Case "1193" Return "PKBSES21XXX" Case "1196" Return "AEEVESM1XXX" Case "1197" Return "BILLESB1XXX" Case "1199" Return "CRGEESM1XXX" Case "1209" Return "ABCMESM1XXX" Case "1210" Return "REDEESM1XXX" Case "1255" Return "AARBESM1XXX" Case "1173" Return "COURESB1XXX" Case "0239" Return "CAGLESMMXXX" Case "6814" Return "MNTYESMMXXX" Case "1464" Return "NFFSESM1XXX" Case "0228" Return "IXIUESM1XXX" Case "8512" Return "UCINESMMXXX" Case "0486" Return "TRESES2BXXX" Case "0218" Return "FCEFESM1XXX" Case "1457" Return "LLISESM1XXX" Case "1459" Return "PRABESMMXXX" Case "1462" Return "ASSCESM1XXX" Case "1463" Return "PSABESM1XXX" Case "1502" Return "IKBDESM1XXX" Case "1505" Return "ARABESMMXXX" Case "1506" Return "MLCBESM1XXX" Case "1524" Return "UBIBESMMXXX" Case "1485" Return "BOFAES2XXXX" Case "1113" Return "BSUDESM1XXX" Case "1164" Return "ESBFESM1XXX" Case "1182" Return "HYVEESM1XXX" Case "1221" Return "PNBMESM1XXX" Case "1224" Return "RHRHESM1XXX" Case "1227" Return "BSSAESB1XXX" Case "1231" Return "BOCAES21XXX" Case "1233" Return "BCMAESM1XXX" Case "1234" Return "PRBAESM1XXX" Case "1236" Return "HELAESM1XXX" Case "1238" Return "BIMEESM1XXX" Case "1240" Return "LOFPESB1XXX" Case "1241" Return "STOLESM1XXX" Case "1242" Return "SOLAESB1XXX" Case "1245" Return "BEIVESM1XXX" Case "1248" Return "WAFAESM1XXX" Case "1249" Return "NPBSES21XXX" Case "1251" Return "IHZUES21XXX" Case "1451" Return "CRCGESB1XXX" Case "1454" Return "NEWGESM1XXX" Case "0238" Return "PSTRESMMXXX" Case "0152" Return "BPLCESMMXXX" Case "0154" Return "BSUIESMMXXX" Case "0155" Return "BRASESMMXXX" Case "0156" Return "ABNAESMMXXX" Case "0159" Return "COBAESMXXXX" Case "0160" Return "BOTKESMXXXX" Case "0161" Return "BKTRESM1XXX" Case "0162" Return "MIDLESMMXXX" Case "0167" Return "GEBAESMMXXX" Case "0168" Return "BBRUESMXXXX" Case "0169" Return "NACNESMMXXX" Case "0182" Return "BBVAESMMXXX" Case "0186" Return "BFIVESBBXXX" Case "0188" Return "ALCLESMMXXX" Case "0190" Return "BBPIESMMXXX" Case "0196" Return "WELAESMMXXX" Case "0198" Return "BCOEESMMXXX" Case "0200" Return "PRVBESB1XXX" Case "0205" Return "DECRESM1XXX" Case "6814" Return "MNTYESMMXXX" Case "1464" Return "NFFSESM1XXX" Case "0228" Return "IXIUESM1XXX" Case "8512" Return "UCINESMMXXX" Case "0486" Return "TRESES2BXXX" Case "0218" Return "FCEFESM1XXX" Case "1457" Return "LLISESM1XXX" Case "1459" Return "PRABESMMXXX" Case "1462" Return "ASSCESM1XXX" Case "1463" Return "PSABESM1XXX" Case "1502" Return "IKBDESM1XXX" Case "1505" Return "ARABESMMXXX" Case "1506" Return "MLCBESM1XXX" Case "1524" Return "UBIBESMMXXX" Case "1485" Return "BOFAES2XXXX" Case "1113" Return "BSUDESM1XXX" Case "1164" Return "ESBFESM1XXX" Case "1182" Return "HYVEESM1XXX" Case "1221" Return "PNBMESM1XXX" Case "1224" Return "RHRHESM1XXX" Case "1227" Return "BSSAESB1XXX" Case "1231" Return "BOCAES21XXX" Case "1233" Return "BCMAESM1XXX" Case "1234" Return "PRBAESM1XXX" Case "1236" Return "HELAESM1XXX" Case "1238" Return "BIMEESM1XXX" Case "1240" Return "LOFPESB1XXX" Case "1241" Return "STOLESM1XXX" Case "1242" Return "SOLAESB1XXX" Case "1245" Return "BEIVESM1XXX" Case "1248" Return "WAFAESM1XXX" Case "1249" Return "NPBSES21XXX" Case "1251" Return "IHZUES21XXX" Case "1451" Return "CRCGESB1XXX" Case "1454" Return "NEWGESM1XXX" Case "0238S" Return "PSTRESMMXXX" Case Else Return "" EndSwitch ElseIf StringCompare(StringLeft($iban, 2), "PT", $STR_NOCASESENSEBASIC) = 0 Then Switch Stringmid($iban, 5, 4) Case "0003" Return "BDEPESM1XXX" Case "0018" Return "TOTAPTPLXXX" Case "0010" Return "BBPIPTPL" Case "0033" Return "BCOMPTPLXXX" Case "0045" Return "CCCMPTPL" Case "0007" Return "BESCPTPL" Case Else Return "" EndSwitch ElseIf StringCompare(StringLeft($iban, 2), "IT", $STR_NOCASESENSEBASIC) = 0 Then Switch Stringmid($iban, 5, 4) Case "P020" Return "UNCRITMMORR" Case Else Return "" EndSwitch Else Return "" EndIf EndFunc
  15. Try this OpenCV Match UDF
  16. You should run a compiled script on the remote server, from your computer you only see a kind of "video" of the remote screen, not possible direct interaction with controls. I have some examples: https://www.autoitscript.com/forum/topic/200843-executing-a-script-on-a-remote-machine/?do=findComment&comment=1441237 https://www.autoitscript.com/forum/topic/205023-how-do-i-go-about-making-a-program-that-look-on-the-screen-for-on-image-and-then-click-on-it/?do=findComment&comment=1474031 https://www.autoitscript.com/forum/topic/203441-rdp-interaction-moved/?do=findComment&comment=1461206
  17. taietel code adapted for two ListBoxes #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> GUICreate("Form1", 400, 350) $hListBox = GUICtrlCreateList("", 5, 5, 190, 340) Local $t For $i=1 To 10 $t &="Item no."&$i&"|" Next GUICtrlSetData(-1,$t) $mnuLBContext = GUICtrlCreateContextMenu($hListBox) GUICtrlCreateMenuItem("MenuItem3", $mnuLBContext) GUICtrlCreateMenuItem("MenuItem2", $mnuLBContext) GUICtrlCreateMenuItem("MenuItem1", $mnuLBContext) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") $hListBox_2 = GUICtrlCreateList("", 205, 5, 190, 340) GUICtrlSetData(-1,$t) GUISetState(@SW_SHOW) While 1 Sleep(10) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox, $hWndListBox_2 If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox) If Not IsHWnd($hListBox_2) Then $hWndListBox_2 = GUICtrlGetHandle($hListBox_2) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $hListBox, $hWndListBox, $hListBox_2, $hWndListBox_2 Switch $iCode Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box Switch $iIDFrom Case $hListBox, $hWndListBox ConsoleWrite("ListBox 1 Item " & _GUICtrlListBox_GetCurSel($hListBox) & @CRLF) Case $hListBox_2, $hWndListBox_2 ConsoleWrite("ListBox 2 Item " & _GUICtrlListBox_GetCurSel($hListBox_2) & @CRLF) EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND
  18. Perhaps your script have to match with driver: if running in 32-bit mode, then you need 32-bit version of data driver (but your image is about 64-bit). Both script and data driver have to match. Seems you don't have the 32-bit data driver, not problem i think Some ideas (sorry copy-paste): Jet for Access, Excel and Txt on 64 bit systems https://www.connectionstrings.com/the-microsoft-ace-oledb-12-0-provider-is-not-registered-on-the-local-machine/ "Summary It is possible to open Excel, Access and text files on 64 bit systems. You can either configure your app to go 32-bit or you can change your application to use the new 64 bit drivers." --- https://stackoverflow.com/questions/13811179/where-how-can-i-download-and-install-the-microsoft-jet-oledb-4-0-for-windows-8 ... On modern Windows this driver isn't available by default anymore, but you can download as Microsoft Access Database Engine 2010 Redistributable on the MS site. If your app is 32 bits be sure to download and install the 32 bits variant because to my knowledge the 32 and 64 bit variant cannot coexist. --- From: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. MTL2014, March 8, 2017 https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetdataproviders "The ACE provider is not installed on Windows operating systems by default. You have to install it. The ACE provider is available in two forms: Microsoft Office Access database engine 2007 and the Microsoft Access Database Engine 2010 Redistributable. The 2007 version is only available as a 32-bit component whereas the 2010 version offers both 32 and 64-bit options. You need to be careful which option you choose, because a wrong choice here is the most frequent cause for the error message." ... "Do you install 32-bit component and restart your computer?" --- "You can't use 32-bit SSMS with the 64-bit ACE OLEDB Provider. You might want to try installing the 2007 version which is 32-bit only: https://www.microsoft.com/en-us/download/details.aspx?id=23734 Paul ~~~~ Microsoft MVP (Visual Basic)" --- "I think you need to install the 32 bit version of the database engine. Indeed, VS works in 32 bit." --- How do I setup the DSN for Microsoft access ODBC driver? https://www.yellowfinbi.com/resources/forum/yfforum-how-do-i-setup-the-dsn-for-microsoft-access-odbc-driver-thread-103711?_ga=2.120226248.1943523695.1606556100-1586943709.1602924953 ... " It's likely the shortcut for setting ODBC data sources is pointing to the 32bit data sources instead of 64bit." --- Accessing Excel files on a x64 machine 06/04/2010 https://docs.microsoft.com/en-us/archive/blogs/farukcelik/accessing-excel-files-on-a-x64-machine --- How to import data from an Excel file to a SQL Server database November 10, 2017 by Marko Zivkovic https://www.sqlshack.com/import-data-excel-file-sql-server-database/ … install Microsoft Access Database Engine 2016 Redistributable. The latest version of Microsoft Access Database Engine can open the earlier version of Excel, so make sure that you have the latest one. The Microsoft Access Database Engine 2016 Redistributable comes with two versions: - AccessDatabaseEngine.exe is 32-bit version - AccessDatabaseEngine_X64.exe is 64-bit version
  19. I remember similar issue in computers with not whole Office installed (missing Access then not data driver installed) Try to download and install this in your home computer: AccessDatabaseEngine.exe some references: https://www.autoitscript.com/wiki/ADO_Tools https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=13255 https://social.msdn.microsoft.com/Forums/en-US/600c7fb6-e7af-4a72-9323-c80c379703d2/the-microsoftaceoledb120-provider-is-not-registered-on-the-local-machine?forum=adodotnetdataproviders
  20. Just a reference: https://www.stunnel.org/ Cited: https://www.autoitscript.com/forum/topic/21889-ssl-gmail-with-openssl/?do=findComment&comment=1035990 https://www.autoitscript.com/forum/topic/201896-apache-autoit-https-api-on-autoit/?tab=comments#comment-1460968
  21. I have this script saved from a broken link (all credits for the author cited in code). Seems related but don't execute commands Perhaps can be adapted using AutoIt Execute Function #cs ---------------------------------------------------------------------------- http://www.emesn.com/autoitforum/viewtopic.php?f=4&t=4063 Terminal Ejemplo Dany, 2014 #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiEdit.au3> #include <Array.au3> #include <File.au3> ;~ Declaraciones #Region Global $hEdit, $hGUI, $hLB_Active, $hLB_LastCout, $hLB_Total, $hLB_Date, $iENTER, $iMsg = 0 Global $sData = ">> " Global $iReset = 0 Global Const $sFont = "Courier New" Global Const $aMode[6] = ["Comando1", "Comando2", "Comando3", "Comando4", "Salir", "Ayuda"]; Entre otros Global Enum $eCom1, $eCom2, $eCom3, $eCom4, $eSalir, $eAyuda Global $iState_Mode = $eCom1 Global Const $sTC = ">> Dany Terminal" & @CRLF & ">> " Global $iGoblal_Total = 0 Global $sDate = @MDAY & "/" & @MON & "/" & @YEAR Global $fSave = False Global $sfIndex = 0 #EndRegion ;~ Interface #Region $hGUI = GUICreate("Dany Terminal", 400, 350, -1, -1) GUISetBkColor(0x191919);Gris $hEdit = GUICtrlCreateEdit($sTC, 10, 5, 380, 290, $ES_MULTILINE) GUICtrlSetFont(-1, 9, 400, 0, $sFont) GUICtrlSetBkColor(-1, 0x000000) ; Black GUICtrlSetColor(-1, 0x00ff00) ;Green $hLB_Active = GUICtrlCreateLabel("Activo: ", 10, 300, 200, 20) GUICtrlSetFont(-1, 9, 400, 0, $sFont) GUICtrlSetBkColor(-1, 0x191919) ;Gris GUICtrlSetColor(-1, 0x00ff00) ;Green $hLB_Date = GUICtrlCreateLabel($sDate, 300, 300, 200, 20) GUICtrlSetFont(-1, 9, 400, 0, $sFont) GUICtrlSetBkColor(-1, 0x191919) ;Gris GUICtrlSetColor(-1, 0x00ff00) ;Green $iENTER = GUICtrlCreateDummy() $iBS = GUICtrlCreateDummy() Global $AccelKeys[2][3] = [["{ENTER}", $iENTER],["{BS}", $iBS]]; Set accelerators GUISetAccelerators($AccelKeys) #EndRegion GUISetState() ControlClick($hGUI, "", $hEdit);Quitar Selected ;~ Main Loop While $iMsg <> $GUI_EVENT_CLOSE $iMsg = GUIGetMsg() Select Case $iMsg = $iENTER Enter() Case $iMsg = $iBS Bs() EndSelect WEnd ;~funcion Modo Func Mode($sString) Local $sMode = "" $sMode = StringStripWS(StringRight($sString, StringLen($sString) - 3), 8) If ($sMode) = "" Then $iReset = 1 Return EndIf Select Case $sMode = $aMode[$eCom1] GUICtrlSetData($hLB_Active, "Activo:" & $aMode[$eCom1]) ConsoleWrite("Mode: " & $aMode[$eCom1] & @CRLF) $iState_Mode = $eCom1 _Comando1() $iReset = 0 Return 0 Case $sMode = $aMode[$eCom2] GUICtrlSetData($hLB_Active, "Activo:" & $aMode[$eCom2]) ConsoleWrite("Mode: " & $aMode[$eCom2] & @CRLF) $iState_Mode = $eCom2 $iReset = 0 Return 0 Case $sMode = $aMode[$eCom3] GUICtrlSetData($hLB_Active, "Activo:" & $aMode[$eCom3]) ConsoleWrite("Mode: " & $aMode[$eCom3] & @CRLF) $iState_Mode = $eCom3 $iReset = 0 Return 0 Case $sMode = $aMode[$eCom4] GUICtrlSetData($hLB_Active, "Activo:" & $aMode[$eCom4]) ConsoleWrite("Mode: " & $aMode[$eCom4] & @CRLF) $iState_Mode = $eCom4 $iReset = 0 Return 0 Case $sMode = $aMode[$eSalir] GUICtrlSetData($hLB_Active, "Activo:" & $aMode[$eSalir]) ConsoleWrite("Mode: " & $aMode[$eSalir] & @CRLF) $iState_Mode = $eSalir $iReset = 0 _Exit() Return 0 Case $sMode = $aMode[$eAyuda] GUICtrlSetData($hLB_Active, "Activo:" & $aMode[$eAyuda]) ConsoleWrite("Mode: " & $aMode[$eAyuda] & @CRLF) $iState_Mode = $eAyuda $iReset = 0 _Ayuda() Return 0 Case Else ;~ GUICtrlSetData($hLB_Active,"Activo :" & $sMode) ConsoleWrite("Mode: " & "Caso Else: " & $sMode & @CRLF) $iReset = 0 Return 0 EndSelect EndFunc ;==>Mode ;~ Ayuda Func _Ayuda() For $i = 0 To UBound($aMode) - 1 $sData &= @CRLF & ">> " & $aMode[$i] Next GUICtrlSetData($hEdit, $sData & @CRLF) $sfIndex = 0 $iReset = 1 EndFunc ;==>_Ayuda ;~ Salir Func _Exit() GUICtrlSetData($hEdit, ">> Bye Bye :)...") Sleep(2000) Exit EndFunc ;==>_Exit ;~ Limpiar Func Clean() ;~ $sData = ">> " $sData = $sTC GUICtrlSetData($hEdit, $sData) $sfIndex = 0 $iReset = 0 EndFunc ;==>Clean ;~ Funcion on Enter Func Enter() $sData = GUICtrlRead($hEdit) Local $sCurrentLine = "" If _WinAPI_GetFocus() = GUICtrlGetHandle($hEdit) Then ConsoleWrite("Reset value: " & $iReset & @CRLF) If _GUICtrlEdit_GetLineCount($hEdit) = 18 Then $iReset = 1 If $iReset = 1 Then Clean() Else $sCurrentLine = _GUICtrlEdit_GetLine($hEdit, _GUICtrlEdit_GetLineCount($hEdit) - 1) ConsoleWrite("[Enter] Fué Presionado!" & @CRLF) ConsoleWrite("Linea: " & _GUICtrlEdit_GetLine($hEdit, _GUICtrlEdit_GetLineCount($hEdit) - 1) & @CRLF) GUICtrlSetData($hEdit, $sData & @CRLF & ">> ") Mode($sCurrentLine) EndIf EndIf EndFunc ;==>Enter ;~ Funcion on BS Func Bs() $sData = GUICtrlRead($hEdit) If _WinAPI_GetFocus() = GUICtrlGetHandle($hEdit) Then If (StringMid($sData, StringLen($sData) - 1) == "> ") Then ConsoleWrite("[BS] Fué Presionado!" & @CRLF) GUICtrlSetData($hEdit, StringMid($sData, 1, StringLen($sData) - 5)) Else GUICtrlSetData($hEdit, StringMid($sData, 1, StringLen($sData) - 1)) EndIf EndIf EndFunc ;==>Bs ;Ejemplo de comando Func _Comando1() $sData &= @CRLF & ">> Se ejecuta el Comando 1 :)" GUICtrlSetData($hEdit, $sData) $sfIndex = 0 $iReset = 1 EndFunc ;==>_Comando1 Here another old reference: Other references: https://conemu.github.io/ https://stackoverflow.com/questions/12602411/use-custom-console-for-visual-studio-console-application-debugging
  22. This ok: ;Gianni, Oct 10 2022 ;https://www.autoitscript.com/forum/topic/197979-ie-embedded-capturing-events/?do=findComment&comment=1508094 #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $g_idGUIEdit Example() Exit ; End of our Demo. Func Example() Local $hGUIMain = GUICreate("Event Test", 1000, 600) $g_idGUIEdit = GUICtrlCreateEdit("", 5, 405, 990, 175) ; GUICtrlSetBkColor(-1, 0x000000) ; GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetFont(-1, 9, 400, -1, 'Courier New') GUICtrlCreateLabel("Below are some Browser events 'captured' from the above web page by AutoIt", 5, 385, 990, 20) Local $idGUIExit = GUICtrlCreateButton(" Close and exit", 5, 580, 990, 15) GUISetState() ;Show GUI ; We prepare the Internet Explorer as our test subject Global $oIE = ObjCreate("Shell.Explorer.2") $hIE = GUICtrlCreateObj($oIE, 5, 5, 990, 380) ; <- insert $oIE in the AutoIt GUI ; Here we load an example Web page just to have something viewed in the browser ;$oIE.navigate('http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onmousemoveEX.htm') ;>>>> ;These lines from: Chimp, Jan 2017 (edited) ;Who is Who ? (a little drag&drop game) ;https://www.autoitscript.com/forum/topic/186422-who-is-who-a-little-dragdrop-game/ ;Global $oIE = ObjCreate("Shell.Explorer.2") ; Create a BrowserControl ;Local $hGUI = GUICreate("", 660, 600, 30, 30) ;GUICtrlCreateObj($oIE, 0, 0, 660, 600) ; Place BrowserControl on the GUI ;GUISetState() ;Show GUI $oIE.navigate('about:blank') ; file:///' & @ScriptDir & '\WhoIsWho.html') While Not String($oIE.readyState) = 'complete' ; wait for about:blank Sleep(100) WEnd ; this waits till the document is ready to be used (portion of code from IE.au3) While Not (String($oIE.readyState) = "complete" Or $oIE.readyState = 4) Sleep(100) WEnd While Not (String($oIE.document.readyState) = "complete" Or $oIE.document.readyState = 4) Sleep(100) WEnd $oIE.document.Write(_GetHTML()) ; inject lising directly to the HTML document: $oIE.document.close() ; close the write stream $oIE.document.execCommand("Refresh") While Not String($oIE.readyState) = 'complete' ; wait for readyState after a refresh Sleep(100) WEnd $oDocument = $oIE.document ;>>>> ;~ Sleep(1000) ; Give it some time to load the web page ;~ Do ; wait for document ;~ Sleep(250) ;~ $oDocument = $oIE.document ;~ Until IsObj($oDocument) ; + Scripting Object Interfaces ; | --------------------------- ; | https://msdn.microsoft.com/en-us/library/hh801967(v=vs.85).aspx ; | ; +--> HTMLDocumentEvents2 interface (catch OnClick, OnMouseOver, .... etc ; ----------------------------- ; https://msdn.microsoft.com/en-us/library/aa769764(v=vs.85).aspx ; Global $oEventObject = ObjEvent($oDocument, "IEEvent2_", "HTMLDocumentEvents2") If @error Then MsgBox($MB_OK, "AutoIt COM Test", _ "ObjEvent: Can't use event interface 'HTMLDocumentEvents2'. Error code: " & Hex(@error, 8)) Exit EndIf ;From: Web Browsing Objects for VB Developers ;Objects ;... ;WebBrowser Object ;... ;TitleChange Event ;Occurs when the title of a document in the WebBrowser control becomes available or changes. For HTML, the title may change; while HTML is still downloading, the URL of the document is set as the title. After the real title (if there is one) is parsed from the HTML, the title is changed to reflect the actual title. ;Private Sub object_TitleChange(ByVal Text As String) ;object ;An object expression that evaluates to an object in the Applies To list. ;Text ;A string containing the new document title. Global $oEventObjectIE = ObjEvent($oIE, "IEEventIE_", "TitleChange") If @error Then MsgBox($MB_OK, "AutoIt COM Test", _ "ObjEvent: Can't use event interface 'TitleChange'. Error code: " & Hex(@error, 8)) Exit EndIf ; Waiting for user to close the GUI. Local $iMsg While 1 $iMsg = GUIGetMsg() If $iMsg = $GUI_EVENT_CLOSE Or $iMsg = $idGUIExit Then ExitLoop WEnd $oEventObject.Stop ; Tell IE we don't want to receive events. $oEventObject = 0 ; Kill the Event Object $oIE = 0 ; Remove IE from memory (not really necessary). GUIDelete() ; Remove GUI EndFunc ;==>Example ; A few Internet Explorer Event Functions ; ( reference to the Event Obj interface: ) ; ( https://msdn.microsoft.com/en-us/library/aa703876(v=vs.85).aspx ) ; Func IEEventIE_TitleChange($oEvent) Local $MyRef = $oIE.document.getElementById($oEvent) ConsoleWrite(VarGetType($MyRef) & @CRLF) ConsolePrint("Changed: " & $oEvent & ' New value: ' & $MyRef.Value) EndFunc ;==>IEEvent2_TitleChange Volatile Func IEEvent2_onClick($oEvent) ConsolePrint("mouse click: " & $oEvent.clientX & ',' & $oEvent.clientY & ' on ' & $oEvent.srcElement.NodeName & ' id: ' & $oEvent.srcElement.id) If $oEvent.srcElement.NodeName = "INPUT" Then If $oEvent.srcElement.type = "radio" Or $oEvent.srcElement.type = "checkbox" Then If $oEvent.srcElement.checked = True Then ConsolePrint("name: " & $oEvent.srcElement.name & " id " & $oEvent.srcElement.id & " True") Else ConsolePrint("name: " & $oEvent.srcElement.name & " id " & $oEvent.srcElement.id & " False") EndIf EndIf EndIf EndFunc ;==>IEEvent2_onClick Volatile Func IEEvent2_onDblClick($oEvent) ConsolePrint("mouse DoubleClick: @" & $oEvent.clientX & ',' & $oEvent.clientY) EndFunc ;==>IEEvent2_onDblClick ;~ Volatile Func IEEvent2_onMouseMove($oEvent) ;~ ConsolePrint("mouse moved to:" & @TAB & "Xpos = " & $oEvent.clientX & @TAB & "Ypos = " & $oEvent.clientY) ;~ EndFunc ;==>IEEvent2_onMouseMove ; =================================== Volatile Func IEEvent_Input_onkeydown($oEvent) ; onChange($oEvent) ConsolePrint("KeyCode: " & $oEvent.keyCode) EndFunc ;==>IEEvent_Input_onkeydown Volatile Func IEEvent_Input_onkeypress($oEvent) ; Fires when you exit from the input and ONLY IF YOU HAVE CHANGED IT'S CONTENT ; ---- ------------------------------------- ConsolePrint('Input content in "First name" field has changed') EndFunc ;==>IEEvent_Input_onkeypress ; =================================== Func ConsolePrint($sMsg) Local Const $iMaxLines = 9 ; keep last 9 log lines only $sMsg = @HOUR & ':' & @MIN & ':' & @SEC & ':' & @MSEC & @TAB & $sMsg & @CRLF $sMsg = StringReplace(GUICtrlRead($g_idGUIEdit) & $sMsg, @CR, @CR) If @extended > $iMaxLines Then ; more than $iMaxLines $sMsg = StringMid($sMsg, StringInStr($sMsg, @CR, 0, -1 * $iMaxLines) + 2) EndIf GUICtrlSetData($g_idGUIEdit, $sMsg) EndFunc ;==>ConsolePrint Func _GetHTML() ;form html code from: Marc Clifton, 16 Feb 2013, https://www.codeproject.com/Articles/547451/WebBrowser-Element-Events-and-Values ;JavaScript from: Marijn Haverbeke (2011), Eloquent JavaScript: a modern introduction to programming. No Starch Press, Inc. Local $sHTML = _ "<!DOCTYPE HTML>" & @CRLF & _ "<html>" & @CRLF & _ "<head>" & @CRLF & _ "<meta http-equiv='X-UA-Compatible' content='IE=edge' />" & @CRLF & _ "<title>Test</title>" & @CRLF & _ "</head>" & @CRLF & _ "<body>" & @CRLF & _ "<button type='button' id='btnMenu'>=</button>" & @CRLF & _ "<button type='button' id='btnClose'>X</button>" & @CRLF & _ "<br>" & @CRLF & _ "<form>First name: <input id='firstname' type='text' name='firstname'/>" & @CRLF & _ "<br>" & @CRLF & _ "Last name: <input id='lastname' type='text' name='lastname'/>" & @CRLF & _ "<br>" & @CRLF & _ "Password: <input id='password' type='password' name='pwd'/>" & @CRLF & _ "<br>" & @CRLF & _ "<input type='radio' id='male' name='sex' value='male'/>Male" & @CRLF & _ "<br>" & @CRLF & _ "<input type='radio' id='female' name='sex' value='female'/>Female" & @CRLF & _ "<br>" & @CRLF & _ "<input type='checkbox' id='bike' name='vehicle' value='Bike'/>I have a bike" & @CRLF & _ "<br>" & @CRLF & _ "<input type='checkbox' id='car' name='vehicle' value='Car'/>I have a car" & @CRLF & _ "<br>" & @CRLF & _ "<input type='button' id='ok' value='OK'/><br/>" & @CRLF & _ "<input type='button' id='cancel' value='Cancel'/>" & @CRLF & _ "</form>" & @CRLF & _ "<script type='text/javascript'>" & @CRLF & _ "var firstname = document.getElementById('firstname');" & @CRLF & _ "var lastname = document.getElementById('lastname');" & @CRLF & _ "var password = document.getElementById('password');" & @CRLF & _ "var male = document.getElementById('male');" & @CRLF & _ "var female = document.getElementById('female');" & @CRLF & _ "var bike = document.getElementById('bike');" & @CRLF & _ "var car = document.getElementById('car');" & @CRLF & _ "" & @CRLF & _ "//Marijn Haverbeke (2011), Eloquent JavaScript: a modern introduction to programming. No Starch Press, Inc." & @CRLF & _ "var output = dom('DIV', {id: 'printOutput'}, dom('H3', null, 'Print output:'));" & @CRLF & _ "window.onload = document.body.appendChild(output);" & @CRLF & _ "// print('Hello');" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(firstname, 'change', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ "print(event.srcElement.value);" & @CRLF & _ "document.title = event.srcElement.id;" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(lastname, 'change', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ "print(event.srcElement.value);" & @CRLF & _ "document.title = event.srcElement.id;" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(password, 'change', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ "print(event.srcElement.value);" & @CRLF & _ "document.title = event.srcElement.id;" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(male, 'click', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ " if (event.srcElement.value = true) {" & @CRLF & _ " //ok" & @CRLF & _ " print(event.srcElement.outerHTML + ' Coordinates: ' + event.clientX + ' , ' + event.clientY);" & @CRLF & _ " //Not working (tested with Internet Explorer 7)" & @CRLF & _ " //print(event.srcElement.GetAttribute('name'));" & @CRLF & _ " }" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(female, 'click', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ " if (event.srcElement.value = true) {" & @CRLF & _ " print(event.srcElement.outerHTML + ' Coordinates: ' + event.clientX + ' , ' + event.clientY);" & @CRLF & _ " }" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "//Returning always true ?" & @CRLF & _ "registerEventHandler(bike, 'click', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ " if (event.srcElement.value = true) {" & @CRLF & _ " print(event.srcElement.value + ' Coordinates: ' + event.clientX + ' , ' + event.clientY);" & @CRLF & _ " }" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "//Returning always true ?" & @CRLF & _ "registerEventHandler(car, 'click', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ " if (event.srcElement.value = true) {" & @CRLF & _ " print(event.srcElement.value + ' Coordinates: ' + event.clientX + ' , ' + event.clientY);" & @CRLF & _ " //Not working (tested with Internet Explorer 7)" & @CRLF & _ " //print(car.GetAttribute('checked'));" & @CRLF & _ " }" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "function registerEventHandler(node, event, handler) {" & @CRLF & _ "if (typeof node.addEventListener == 'function')" & @CRLF & _ "node.addEventListener(event, handler, false);" & @CRLF & _ "else" & @CRLF & _ "node.attachEvent('on' + event, handler);" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function print() {" & @CRLF & _ "var result = [];" & @CRLF & _ "forEach(arguments, function(arg){result.push(String(arg));});" & @CRLF & _ "output.appendChild(dom('PRE', null, result.join('')));" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function dom(name, attributes, children) {" & @CRLF & _ "var node = document.createElement(name);" & @CRLF & _ "if (attributes) {" & @CRLF & _ "forEachIn(attributes, function(name, value) {" & @CRLF & _ "node.setAttribute(name, value);" & @CRLF & _ "});" & @CRLF & _ "}" & @CRLF & _ "for (var i = 2; i < arguments.length; i++) {" & @CRLF & _ "var child = arguments[i];" & @CRLF & _ "if (typeof child == 'string')" & @CRLF & _ "child = document.createTextNode(child);" & @CRLF & _ "node.appendChild(child);" & @CRLF & _ "}" & @CRLF & _ "return node;" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function forEachIn(object, action) {" & @CRLF & _ "for (var property in object) {" & @CRLF & _ "if (object.hasOwnProperty(property))" & @CRLF & _ "action(property, object[property]);" & @CRLF & _ "}" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function forEach(array, action) {" & @CRLF & _ "for (var i = 0; i < array.length; i++)" & @CRLF & _ "action(array[i]);" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "</script>" & @CRLF & _ "</body>" & @CRLF & _ "</html>" Return $sHTML EndFunc ;==>_GetHTML Updated excel file with similar examples in vba, see end of post: https://www.autoitscript.com/forum/topic/197979-ie-embedded-capturing-events/?do=findComment&comment=1427391
  23. Perhaps using the document title to exchange a text reference of the input changed This is a try not fully working: ;From: Gianni, Oct 10 2022 ;https://www.autoitscript.com/forum/topic/197979-ie-embedded-capturing-events/?do=findComment&comment=1508094 #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $g_idGUIEdit Example() Exit ; End of our Demo. Func Example() Local $hGUIMain = GUICreate("Event Test", 1000, 600) $g_idGUIEdit = GUICtrlCreateEdit("", 5, 405, 990, 175) ; GUICtrlSetBkColor(-1, 0x000000) ; GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetFont(-1, 9, 400, -1, 'Courier New') GUICtrlCreateLabel("Below are some Browser events 'captured' from the above web page by AutoIt", 5, 385, 990, 20) Local $idGUIExit = GUICtrlCreateButton(" Close and exit", 5, 580, 990, 15) GUISetState() ;Show GUI ; We prepare the Internet Explorer as our test subject Global $oIE = ObjCreate("Shell.Explorer.2") $hIE = GUICtrlCreateObj($oIE, 5, 5, 990, 380) ; <- insert $oIE in the AutoIt GUI ; Here we load an example Web page just to have something viewed in the browser ;$oIE.navigate('http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onmousemoveEX.htm') ;>>>> ;These lines from: Chimp, Jan 2017 (edited) ;Who is Who ? (a little drag&drop game) ;https://www.autoitscript.com/forum/topic/186422-who-is-who-a-little-dragdrop-game/ ;Global $oIE = ObjCreate("Shell.Explorer.2") ; Create a BrowserControl ;Local $hGUI = GUICreate("", 660, 600, 30, 30) ;GUICtrlCreateObj($oIE, 0, 0, 660, 600) ; Place BrowserControl on the GUI ;GUISetState() ;Show GUI $oIE.navigate('about:blank') ; file:///' & @ScriptDir & '\WhoIsWho.html') While Not String($oIE.readyState) = 'complete' ; wait for about:blank Sleep(100) WEnd ; this waits till the document is ready to be used (portion of code from IE.au3) While Not (String($oIE.readyState) = "complete" Or $oIE.readyState = 4) Sleep(100) WEnd While Not (String($oIE.document.readyState) = "complete" Or $oIE.document.readyState = 4) Sleep(100) WEnd $oIE.document.Write(_GetHTML()) ; inject lising directly to the HTML document: $oIE.document.close() ; close the write stream $oIE.document.execCommand("Refresh") While Not String($oIE.readyState) = 'complete' ; wait for readyState after a refresh Sleep(100) WEnd $oDocument = $oIE.document ;>>>> ;~ Sleep(1000) ; Give it some time to load the web page ;~ Do ; wait for document ;~ Sleep(250) ;~ $oDocument = $oIE.document ;~ Until IsObj($oDocument) ; + Scripting Object Interfaces ; | --------------------------- ; | https://msdn.microsoft.com/en-us/library/hh801967(v=vs.85).aspx ; | ; +--> HTMLDocumentEvents2 interface (catch OnClick, OnMouseOver, .... etc ; ----------------------------- ; https://msdn.microsoft.com/en-us/library/aa769764(v=vs.85).aspx ; Global $oEventObject = ObjEvent($oDocument, "IEEvent2_", "HTMLDocumentEvents2") If @error Then MsgBox($MB_OK, "AutoIt COM Test", _ "ObjEvent: Can't use event interface 'HTMLDocumentEvents2'. Error code: " & Hex(@error, 8)) Exit EndIf Global $oEventObjectIE = ObjEvent($oIE, "IEEventIE_", "TitleChange") If @error Then MsgBox($MB_OK, "AutoIt COM Test", _ "ObjEvent: Can't use event interface 'TitleChange'. Error code: " & Hex(@error, 8)) Exit EndIf ; Waiting for user to close the GUI. Local $iMsg While 1 $iMsg = GUIGetMsg() If $iMsg = $GUI_EVENT_CLOSE Or $iMsg = $idGUIExit Then ExitLoop WEnd $oEventObject.Stop ; Tell IE we don't want to receive events. $oEventObject = 0 ; Kill the Event Object $oIE = 0 ; Remove IE from memory (not really necessary). GUIDelete() ; Remove GUI EndFunc ;==>Example ; A few Internet Explorer Event Functions ; ( reference to the Event Obj interface: ) ; ( https://msdn.microsoft.com/en-us/library/aa703876(v=vs.85).aspx ) ; Volatile Func IEEventIE_TitleChange($oEvent) ConsolePrint("TitleChange: " & $oIE.Document.Title) ConsolePrint("TitleChange: " & $oIE.document.GetElementById($oIE.Document.Title)) EndFunc ;==>IEEvent2_TitleChange Volatile Func IEEvent2_onClick($oEvent) ConsolePrint("mouse click: " & $oEvent.clientX & ',' & $oEvent.clientY & ' on ' & $oEvent.srcElement.NodeName & ' id: ' & $oEvent.srcElement.id) If $oEvent.srcElement.NodeName = "INPUT" Then If $oEvent.srcElement.type = "radio" Or $oEvent.srcElement.type = "checkbox" Then If $oEvent.srcElement.checked = True Then ConsolePrint("name: " & $oEvent.srcElement.name & " id " & $oEvent.srcElement.id & " True") Else ConsolePrint("name: " & $oEvent.srcElement.name & " id " & $oEvent.srcElement.id & " False") EndIf EndIf EndIf EndFunc ;==>IEEvent2_onClick Volatile Func IEEvent2_onDblClick($oEvent) ConsolePrint("mouse DoubleClick: @" & $oEvent.clientX & ',' & $oEvent.clientY) EndFunc ;==>IEEvent2_onDblClick ;~ Volatile Func IEEvent2_onMouseMove($oEvent) ;~ ConsolePrint("mouse moved to:" & @TAB & "Xpos = " & $oEvent.clientX & @TAB & "Ypos = " & $oEvent.clientY) ;~ EndFunc ;==>IEEvent2_onMouseMove ; =================================== Volatile Func IEEvent_Input_onkeydown($oEvent) ; onChange($oEvent) ConsolePrint("KeyCode: " & $oEvent.keyCode) EndFunc ;==>IEEvent_Input_onkeydown Volatile Func IEEvent_Input_onkeypress($oEvent) ; Fires when you exit from the input and ONLY IF YOU HAVE CHANGED IT'S CONTENT ; ---- ------------------------------------- ConsolePrint('Input content in "First name" field has changed') EndFunc ;==>IEEvent_Input_onkeypress ; =================================== Func ConsolePrint($sMsg) Local Const $iMaxLines = 9 ; keep last 9 log lines only $sMsg = @HOUR & ':' & @MIN & ':' & @SEC & ':' & @MSEC & @TAB & $sMsg & @CRLF $sMsg = StringReplace(GUICtrlRead($g_idGUIEdit) & $sMsg, @CR, @CR) If @extended > $iMaxLines Then ; more than $iMaxLines $sMsg = StringMid($sMsg, StringInStr($sMsg, @CR, 0, -1 * $iMaxLines) + 2) EndIf GUICtrlSetData($g_idGUIEdit, $sMsg) EndFunc ;==>ConsolePrint Func _GetHTML() ;form html code from: Marc Clifton, 16 Feb 2013, https://www.codeproject.com/Articles/547451/WebBrowser-Element-Events-and-Values ;JavaScript from: Marijn Haverbeke (2011), Eloquent JavaScript: a modern introduction to programming. No Starch Press, Inc. Local $sHTML = _ "<!DOCTYPE HTML>" & @CRLF & _ "<html>" & @CRLF & _ "<head>" & @CRLF & _ "<meta http-equiv='X-UA-Compatible' content='IE=edge' />" & @CRLF & _ "<title>Test</title>" & @CRLF & _ "</head>" & @CRLF & _ "<body>" & @CRLF & _ "<form>First name: <input id='firstname' type='text' name='firstname'/>" & @CRLF & _ "<br>" & @CRLF & _ "Last name: <input id='lastname' type='text' name='lastname'/>" & @CRLF & _ "<br>" & @CRLF & _ "Password: <input id='password' type='password' name='pwd'/>" & @CRLF & _ "<br>" & @CRLF & _ "<input type='radio' id='male' name='sex' value='male'/>Male" & @CRLF & _ "<br>" & @CRLF & _ "<input type='radio' id='female' name='sex' value='female'/>Female" & @CRLF & _ "<br>" & @CRLF & _ "<input type='checkbox' id='bike' name='vehicle' value='Bike'/>I have a bike" & @CRLF & _ "<br>" & @CRLF & _ "<input type='checkbox' id='car' name='vehicle' value='Car'/>I have a car" & @CRLF & _ "</form>" & @CRLF & _ "" & @CRLF & _ "<script type='text/javascript'>" & @CRLF & _ "var firstname2 = document.getElementById('firstname');" & @CRLF & _ ; <- changed firstname to firstname2 "var lastname = document.getElementById('lastname');" & @CRLF & _ "var password = document.getElementById('password');" & @CRLF & _ "var male = document.getElementById('male');" & @CRLF & _ "var female = document.getElementById('female');" & @CRLF & _ "var bike = document.getElementById('bike');" & @CRLF & _ "var car = document.getElementById('car');" & @CRLF & _ "" & @CRLF & _ "//Marijn Haverbeke (2011), Eloquent JavaScript: a modern introduction to programming. No Starch Press, Inc." & @CRLF & _ "var output = dom('DIV', {id: 'printOutput'}, dom('H3', null, 'Print output:'));" & @CRLF & _ "window.onload = document.body.appendChild(output);" & @CRLF & _ "// print('Hello');" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(firstname2, 'change', function(event) {" & @CRLF & _ ; <- changed firstname to firstname2 "event = event || window.event;" & @CRLF & _ "print(event.srcElement.value);" & @CRLF & _ "document.title = 'event.srcElement.id';" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(lastname, 'change', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ "print(event.srcElement.value);" & @CRLF & _ "document.title = 'event.srcElement.id';" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(password, 'change', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ "print(event.srcElement.value);" & @CRLF & _ "document.title = 'event.srcElement.id';" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(male, 'click', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ " if (event.srcElement.value = true) {" & @CRLF & _ " //ok" & @CRLF & _ " print(event.srcElement.outerHTML + ' Coordinates: ' + event.clientX + ' , ' + event.clientY);" & @CRLF & _ " //Not working (tested with Internet Explorer 7)" & @CRLF & _ " //print(event.srcElement.GetAttribute('name'));" & @CRLF & _ " }" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "registerEventHandler(female, 'click', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ " if (event.srcElement.value = true) {" & @CRLF & _ " print(event.srcElement.outerHTML + ' Coordinates: ' + event.clientX + ' , ' + event.clientY);" & @CRLF & _ " }" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "//Returning always true ?" & @CRLF & _ "registerEventHandler(bike, 'click', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ " if (event.srcElement.value = true) {" & @CRLF & _ " print(event.srcElement.value + ' Coordinates: ' + event.clientX + ' , ' + event.clientY);" & @CRLF & _ " }" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "//Returning always true ?" & @CRLF & _ "registerEventHandler(car, 'click', function(event) {" & @CRLF & _ "event = event || window.event;" & @CRLF & _ " if (event.srcElement.value = true) {" & @CRLF & _ " print(event.srcElement.value + ' Coordinates: ' + event.clientX + ' , ' + event.clientY);" & @CRLF & _ " //Not working (tested with Internet Explorer 7)" & @CRLF & _ " //print(car.GetAttribute('checked'));" & @CRLF & _ " }" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "function registerEventHandler(node, event, handler) {" & @CRLF & _ "if (typeof node.addEventListener == 'function')" & @CRLF & _ "node.addEventListener(event, handler, false);" & @CRLF & _ "else" & @CRLF & _ "node.attachEvent('on' + event, handler);" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function print() {" & @CRLF & _ "var result = [];" & @CRLF & _ "forEach(arguments, function(arg){result.push(String(arg));});" & @CRLF & _ "output.appendChild(dom('PRE', null, result.join('')));" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function dom(name, attributes, children) {" & @CRLF & _ "var node = document.createElement(name);" & @CRLF & _ "if (attributes) {" & @CRLF & _ "forEachIn(attributes, function(name, value) {" & @CRLF & _ "node.setAttribute(name, value);" & @CRLF & _ "});" & @CRLF & _ "}" & @CRLF & _ "for (var i = 2; i < arguments.length; i++) {" & @CRLF & _ "var child = arguments[i];" & @CRLF & _ "if (typeof child == 'string')" & @CRLF & _ "child = document.createTextNode(child);" & @CRLF & _ "node.appendChild(child);" & @CRLF & _ "}" & @CRLF & _ "return node;" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function forEachIn(object, action) {" & @CRLF & _ "for (var property in object) {" & @CRLF & _ "if (object.hasOwnProperty(property))" & @CRLF & _ "action(property, object[property]);" & @CRLF & _ "}" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function forEach(array, action) {" & @CRLF & _ "for (var i = 0; i < array.length; i++)" & @CRLF & _ "action(array[i]);" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "</script>" & @CRLF & _ "</body>" & @CRLF & _ "</html>" Return $sHTML EndFunc ;==>_GetHTML
×
×
  • Create New...