Jump to content

Recommended Posts

Posted

Hello folks!

Using the AutoIT recorder a few weeks ago, I saw pieces of code like these below. Today, I am trying to recreate a new script but do not get this code below?

What could be the reason?

Thx!

---

#include <IE.au3>

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
  Opt('WinWaitDelay',100)
  Opt('WinDetectHiddenText',1)
  Opt('MouseCoordMode',0)
  Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '')
  If $aResult[1] <> '00000409' Then
    MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000409->' & $aResult[1] & ')')
EndIf

EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

_AU3RecordSetup()

;Connect to ABS Preprod site
Local $oIE = _IECreate("https://preprod....", 1)

--

Posted

To automate IE I suggest to use the IE UDF that comes with AutoIt or the WebDriver UDF.
Recording keystrokes and clicks is not very reliable.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Thanks, Water. The access to the tool is really via Citrix (web). Once in, the client application is desktop, built using Java FX. What is your suggestion here?

 

Posted (edited)

Unfortunately I have never worked with Citrix or Java FX.
Does the application provide some kind of API so you do not need to automate the GUI?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

I think so. Is it possible to contact the provider of the software to get some ideas how to do what you want to do?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Yes, I will do so.

Meanwhile, I'd like to investigate IE UDF or the webdriver. Are these components part of the latest version of Autoit? Could you provide a bit more detail?

Appreciate it, thanks!

Posted

The IE UDF comes with AutoIt.
Check the help file for _IE* functions: https://www.autoitscript.com/autoit3/docs/libfunctions.htm

The WebDriver is a more general UDF to automate browser who support the WebDriver interface:

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Hi Water,

I like the idea to use IE UDF which I will do. At least I am able to open the main site. Now, my challenge comes with identifying the properties of the field in this case for user name and password.

Are you aware of a spy or recorder that can generate IE UDF? 

Thanks again

Carl

 

Posted

IE comes with a built-in debugger.
Press F12 then Ctrl-B and select the input field.
In the DOM-Explorer the the source code of the input field will be highlighted. There you can extract name or id for the IE* functions.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • 2 weeks later...
Posted

Thanks, Water. Helpful!

What can the problem be in this code? After many attempts cannot see the problem.

ERROR INFO:

>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\cferrer\Desktop\login_abs_preprod_2.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023179, Browser has been deleted prior to operation.)
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (930) : ==> The requested action with this object has failed.:
Local $oCol = $oObject.document.forms.item($sName)
Local $oCol = $oObject^ ERROR
->12:49:09 AutoIt3.exe ended.rc:1
+>12:49:09 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 12.31

CODE:

; Initialize variables
Local $user_name = "testmx1_ms"
Local $password    = "P@ssw0rd123"

; Functions
Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc


; Libraries
#include <IE.au3>

; Connect to ABS Preprod site
Local $oIE = _IECreate("https://preprod.rapps.xyz.internal.acan.local")
Sleep(5000)

; Wait for the site to load
_IELoadWait($oIE)

; Wait for 5 seconds
Sleep(5000)

; Enter user name and password
Local $oForm = _IEFormGetObjByName($oIE, "form insertPoint credentialform")
Local $oText = _IEFormElementGetObjByName($oForm, "username")
_IEFormElementSetValue($oText, $user_name)

Posted (edited)

Hi @CarlFerrer :)

I see that you're using Citrix, and, since I am going to use it in a project, I would like to help you if I can.

I suggest you to put some @error checking when you call your _IE* functions.

Something like:

_IECreate("website")
If @error Then
    ConsoleWrite("Error detected when opening the webpage. Error: " & @error & @CRLF)
Else
    ; Instructions
EndIf

So you can see if there is an error before one of the functions throws his one, exiting the script with those lines :)

Try this, and post the results :)

EDIT:

Use the <code> tag here above to include your script's code in the post! 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...