Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Get script to ignore page title and act on the active window regardless of its title

$
0
0
I'm trying to get a script to do the following:

1. Open Firefox Tools menu "{ALT}+t"
2. Open the Page Info sub-menu "i"
3. Move the focus to the MEDIA button "{RIGHT}"
4. Scroll down to select the 6th image "{DOWN}" repeated 6 times
5. Open the SAVE AS dialogue box "{ALT}+a"

I have two problems:

1. The script works to the ALT+a line when I specify the PAGE TITLE in the "WinWaitActive command".
But the SAVE AS box does not open.  There are no error messages or error sounds.

2. I can't get the script to run unless I have specified the page title of the window in the "WinWaitActive command.


My main problem is getting the script to work no matter what the page title is.  I don't know how to do this, as the script needs to know what window the command is to be applied, so if I leave this portion blank or empty, nothing happens.

What I want to tell the script is: "Ignore the "PAGE TITLE" and run the script on the active window."  This window will always be the "Page Info" box, but it will have a different title for each image.

Here's my script.  I have no idea what the top commands do except perhaps to set the environment, I've left them in from the sample script supplied with AutoIt.  My script begins from the line "Start of Script"

--------------
[Script=BEGIN]
--------------

' Example WSH Script (VBScript)
' -----------------------------

' Require Variants to be declared before used
' -------------------------------------------

Option Explicit

' Declare Variables & Objects
' ---------------------------

Dim oShell
Dim oAutoIt

' Initialise Variables & Objects
' ------------------------------

Set oShell = WScript.CreateObject("WScript.Shell")
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

' Start of Script
' ---------------

' Wait for the Firefox window to become active

oAutoIt.WinWaitActive "All sizes | oldsmobile | Flickr - Photo Sharing! - Mozilla Firefox", ""  


' Send some keystokes to firefox
' ------------------------------

oAutoIt.Send "{ALT}+t"
oAutoIt.Sleep 500
oAutoIt.Send "{i}"
oAutoIt.Sleep 500
oAutoIt.Send "{RIGHT}"
oAutoIt.Send "{TAB}"
oAutoIt.Send "{DOWN}"
oAutoIt.Send "{DOWN}"
oAutoIt.Send "{DOWN}"
oAutoIt.Send "{DOWN}"
oAutoIt.Send "{DOWN}"
oAutoIt.Send "{DOWN}"
oAutoIt.Send "{ALT}+a"
WScript.Quit

--------------------
[Script=END]
--------------------

I'm running Windows XP SP3 plus latest updates, on a HP P4 3.2 with 4GB DDR2 RAM, Firefox 20.0.1 with Javascript enabled

To summarize:

1. The line "oAutoIt.Send "{ALT}+a"" doesn't work.  How can I solve that?

2. How can I code the script and tell it to ignore the page title and work on the active window regardless of page title?

You might want to try it on the following web page - whick is my Flickr page:

http://www.flickr.com/photos/fruit_and_nut/8663623973/sizes/l/in/photostream/

After running the script, you'll need to click the Page Info window to make it active.


Thank you for considering this... :sweating:

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>