Jump to content

Sending keystroke works only for some IE pages


monicar
 Share

Recommended Posts

I am new to AutoIt and I am having a strange problem:

I have a small script that sends ALT+F on an IE window. It works if my URL is "www.yahoo.com" (File menu is displayed) or other simple thing, but it does not work if it is the URL to my JIRA bug tracking server. The browser opens with the correct page, the menu is underlined, but the File menu is not displayed. What could be the problem? I also tried _IEAction ($oIE, "saveas") but I have the same problem, works with Yahoo but not with my server. BUT

Send("{PRINTSCREEN}") works. I also tried WinWaitActive to the window name but it does not help either.

Here is the code:

#include <IE.au3>

$URL = "http://localhost:8080/secure/Dashboard.jspa"

$oIE = _IECreate( $URL )

sleep(1000)

_IELoadWait ($oIE)

_IEAction ($oIE, "focus")

; I added the sleep/LoadWait, and Focus to see if they would help. They did not.

Send("!F")

Thanks

Monica

Link to comment
Share on other sites

I am new to AutoIt and I am having a strange problem:

I have a small script that sends ALT+F on an IE window. It works if my URL is "www.yahoo.com" (File menu is displayed) or other simple thing, but it does not work if it is the URL to my JIRA bug tracking server. The browser opens with the correct page, the menu is underlined, but the File menu is not displayed. What could be the problem? I also tried _IEAction ($oIE, "saveas") but I have the same problem, works with Yahoo but not with my server. BUT

Send("{PRINTSCREEN}") works. I also tried WinWaitActive to the window name but it does not help either.

Here is the code:

#include <IE.au3>

$URL = "http://localhost:8080/secure/Dashboard.jspa"

$oIE = _IECreate( $URL )

sleep(1000)

_IELoadWait ($oIE)

_IEAction ($oIE, "focus")

; I added the sleep/LoadWait, and Focus to see if they would help. They did not.

Send("!F")

Thanks

Monica

Avoid waiting for the page to complete. Check the $f_wait parameter on _IECreate() and _IENavigate() in the help file, for example. Some web pages are just a big java script control that loops forever and will never return "complete" status.
#include <IE.au3>

Global $URL = "http://localhost:8080/secure/Dashboard.jspa"
Global $oIE = _IECreate($URL, 0, 1, 0); Don't wait
sleep(1000) 
$hIE = _IEPropertyGet($oIE, "hwnd")
ControlSend($hIE, "", "", "!f")

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Avoid waiting for the page to complete. Check the $f_wait parameter on _IECreate() and _IENavigate() in the help file, for example. Some web pages are just a big java script control that loops forever and will never return "complete" status.

#include <IE.au3>

Global $URL = "http://localhost:8080/secure/Dashboard.jspa"
Global $oIE = _IECreate($URL, 0, 1, 0); Don't wait
sleep(1000) 
$hIE = _IEPropertyGet($oIE, "hwnd")
ControlSend($hIE, "", "", "!f")

:mellow:

It worked! I used the code you provided and now I can send the keystrokes successfully. I will read more about all the options in _IECreate().

Thanks!

Monica

Link to comment
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
 Share

  • Recently Browsing   0 members

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