Xenon80

IE.au3 functions doesn't work within script

9 posts in this topic

Hi all,

I am having a really strange behavior with scripts using IE.au3 library on Windows 2012R2 and IE11.

The problem is really simple, no action within the website is running, no action is executed. It seems that anything (GPO, security setting, anything) in the system is blocking the script. I don't have any error or warning in console. The same script on different server and in more than one environment with same OS version or different OS version is working.

Even trying with a basic script like the following it doesn't work with the same behavior, this is an example:

 

#include <IE.au3>
Local $oIE = _IECreate("https://address/")
      sleep(2000)
      send("USER")
      send("{TAB}")
      sleep(2000)
      send("PASSWORD")
      send("{ENTER}")

 

To complete the picture I have another oddity with this situation which I try to summarize here:

1. Running the script via SciTE Editor (pressing F5);

2. Script starts, Internet Explorer launched with the right website: the IECreate function is working well;

3. As usual nothing happen, it should type something in the fields within the website according with the simple script code;

4. Close manually Internet Explorer (pressing X button);

5. The script, which is still running in background, begins to execute all "send" command in a text where you have the focus (for example the same SciTE editor).

Modifying the script avoiding the usage of IE.au3 function, for example like this one:

ShellExecute("iexplore.exe", "https://website/")
WinWait ("Internet Explorer")
      sleep(2000)
      send("USERNAME")
      sleep(1000)
      send("{TAB}")
      sleep(2000)
      Send ("PASSWORD")
      send("{ENTER}")

The script works like a charms.

I can't find any clue but I think a setting, probably a GPO, in OS could interfere with IE.au3, do you have any idea about?

 

Many thanks for your help.

 

 

Share this post


Link to post
Share on other sites



What happens if you set the $iWait (fourth parameter) in _IECreate to 0?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Generally, you want to avoid using Send when interacting with a web browser. Have you looked into using _IEFormElementGetObjByName and _IEFormElementSetValue?

Share this post


Link to post
Share on other sites

Yes, in the original script I didn't use "send" but IE functions, in any case it doesn't work on that system, only on that system.

I modified the script using "send" to make it easy and prove that commands outside Internet Explorer are working as it happens as shown in the step by step process I shown before when the script start to execute "send" command immediately after I close Internet Explorer.

 

Thanks again for your help

 

Share this post


Link to post
Share on other sites
7 hours ago, JLogan3o13 said:

What happens if you set the $iWait (fourth parameter) in _IECreate to 0?

I will give a try, thanks!

As further information in one on the test I already did  I also tried to use _IEAttach and instead of _IECreate with the same odd behavior.

Share this post


Link to post
Share on other sites

Does the problem go away if you add #RequireAdmin?

Share this post


Link to post
Share on other sites
15 hours ago, Danp2 said:

Does the problem go away if you add #RequireAdmin?

Running the script within SciTE editor it launch internet explorer but the script never ends and doesn't execute any action.

I also used a script which rely on ie.au3 function like this one:

#include <IE.au3>
#RequireAdmin

Global $Address = "website"
Global $User = "user"
Global $Password = "pw"

Local $oIE = _IECreate($address)

$oAs = _IETagnameGetCollection($oIE, "input")
$i = 1
For $oA in $oAs
   If $i = 2 Then _IEPropertySet($oA,"innertext",$user)
   $i = $i + 1
Next

$oAs = _IETagnameGetCollection($oIE, "input")
$i = 1
For $oA in $oAs
   If $i = 3 Then _IEPropertySet($oA,"innertext",$password)
   $i = $i + 1
Next

sleep (5000)

 

23 hours ago, JLogan3o13 said:

What happens if you set the $iWait (fourth parameter) in _IECreate to 0?

With the script used before, just setting $iWait and removing #RequireAdmin with a couple of sleep(5000) to load the page the script just ends after 10.3 second, I would say just the time to wait sleep 5sec * 2, and in any case nothing has beed typed in the "input" field.

This odd behavior happens with all website, internal or external.

 

Do you have any other idea?

Many thanks for your time!

Share this post


Link to post
Share on other sites

Have you read the Remarks section for _IECreate?

Share this post


Link to post
Share on other sites
22 hours ago, Danp2 said:

Have you read the Remarks section for _IECreate?

Yes, Protected Mode in IE enabled, nor UAC, even _IEAttach doesn't work....

I don't know what else to check...

Thanks for your help

Share this post


Link to post
Share on other sites

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