Jump to content

AutoIT - How to Change Application Focus - (Moved)


Go to solution Solved by Danp2,

Recommended Posts

I do some scripting at my current position nothing to advanced.  I am looking into creating a script that will open two different web pages at full screen then switch focus between them after a defined amount of time.  I know this sounds simple but I have never used AutoIT and the videos with AutoIT don't seem to cover this topic.  I am not looking for the script to but I really looking for the resources to used so I can do it myself.

Link to comment
Share on other sites

  • Developers

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

It is moved already as you can see. ;)  (It is just one click for us to move an post that standard message) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I suggest that you expand on your description of the task to be performed. For example --

  • Which browser will be used? Is it set as the default browser?
  • Do the two websites need to be in two completely separate windows or can they be in a single window with tabs?
  • Do either of the sites require you to authenticate or login?
  • etc

To get thing started, you can launch two websites into a tabbed window of the default browser using the ShellExecute command --

ShellExecute("www.yahoo.com")
ShellExecute("www.google.com")

 

Link to comment
Share on other sites

  • Devices reboots daily
  • The device does not have access to the internet so these internal sites
  • There is no authentication required.
  • Full screen is a requirement
  • The "Focus: or active page can be using tabs or and be multiple browsers
  • the script come on at start up and automatically load and go to full screen
  • I need a 30 second pause before focus changes
  • Computer is on 24x7
  • Users do not have access to the device is a display only device remotely manged
Link to comment
Share on other sites

  • Solution

Here's a simple example that should be enough to get you started --

AdlibRegister("Toggle", 2000)

Run("C:\Program Files\Google\Chrome\Application\chrome.exe www.google.com www.yahoo.com")
While True
    Sleep(500)
WEnd

Func Toggle()
Static $bFirst = True

WinActivate("Chrome")

If $bFirst Then
 Send("^2")
Else
 Send("^1")
EndIf

$bFirst = Not $bFirst
EndFunc

Some commentary --

  • Send() is generally frowned upon, but it should work ok in your controlled environment
  • The switch is currently set to every 2 secs. Adjust the value in the first line to meet your needs.
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...