?
Solved

Script to swap active programs in Windows 7

Posted on 2014-07-29
15
Medium Priority
?
605 Views
Last Modified: 2014-08-01
Hello, Wondering if someone can help me?

I would like a script which can swap two open applications on a display machine which we have running a wallboard screen PC.

We have one program shows the call stats for a team called DisplayX and the other is our internal website with company information which will be displayed on Internet explorer.

So the DisplayX gets maximised and is displayed as the main program full screen for approx. 30-40 seconds and then it minimizes the DisplayX software and maximizes an internet explorer page and then minimizes and switches back to the DisplayX.

Both applications will be loaded on the machine start-up.

Anyone out there have a solution for this?

Thank you in advance.

Darren
0
Comment
Question by:DarrenEley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 4
15 Comments
 
LVL 55

Accepted Solution

by:
Joe Winograd, EE MVE 2015&2016 earned 2000 total points
ID: 40226904
Hi Darren,

I'm a big fan of a (free!) programming language called AutoHotkey. Here's an EE article that shows where/how to download and install it:
http://www.experts-exchange.com/Web_Development/Document_Imaging/A_13315-How-to-Combine-Merge-PDF-Files-in-Many-Subfolders.html

The article is about a different topic — you may safely ignore most of it — use it just for the sections on downloading, installing, and compiling AutoHotkey (you don't need the other program, PDFtk).

Here's the program that does exactly what you want:
SetTitleMatchMode,2 ; title must contain specified text
Loop
{
  WinActivate,DisplayX ; title is case sensitive
  Sleep,30000 ; wait 30 seconds
  WinActivate,Internet Explorer ; title is case sensitive
  Sleep,30000; wait 30 seconds
}

Open in new window

After you've installed AutoHotkey, it will own the file type AHK. So simply double-click on the AHK file with the above code in it (I attached it for your convenience). This will loop forever. If you want to exit the program, simply right-click on the AutoHotkey icon in the system tray and select Exit. The icon looks like this:

AutoHotkey default icon
You could get a lot fancier with the program, such as making the swap time an input parameter (it is now hard-coded at 30,000 milliseconds=30 seconds), making the windows titles input params (hard-coded now as "DisplayX" and "Internet Explorer"), making it easier to terminate (although right-click/Exit is pretty easy), etc.

But those 8 lines of code do what you want. Btw, if you want to compile the program into an executable (an EXE file), the article mentioned above shows how to do it. Regards, Joe
SwapPrograms.ahk
0
 

Author Comment

by:DarrenEley
ID: 40226906
Excellent Thank you. I will give it a try now, and report back.

Regards

Darren
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40226922
Darren,
In copying/pasting the code from the post to the AHK file, I made an error (the Loop statement wound up on the wrong line). Attached is the corrected AHK file. Also, here's the code with some better comments:
SetTitleMatchMode,2 ; the "2" option means title must CONTAIN specified text
Loop
{
  WinActivate,DisplayX ; title is case sensitive
  Sleep,30000 ; wait 30 seconds (time is specified in milliseconds)
  WinActivate,Internet Explorer ; title is case sensitive
  Sleep,30000 ; wait 30 seconds (time is specified in milliseconds)
}

Open in new window

Also, if you do want to get fancier, the article shows how to do it. Regards, Joe
SwapPrograms.ahk
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Author Comment

by:DarrenEley
ID: 40226957
Hiya, Thank you, Works kind of perfectly. If you could possibly offer some advice.

DisplayX is run in full screen mode (F11), so I need it to come out of Full screen (F11) before it does the switch to IE which then needs to be put in to full screen mode (F11) and then out of full screen and back to DisplayX in Full screen.... That's a lot of Full Screens.. :)

How would I achieve this if its not too much trouble.

I will have a read though the manual as I can see this is a very handy tool, but if you are able to help I would be very grateful, so I can get this completed.

Regards

Darren
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40226992
It swaps them fine if both windows are maximized, but I haven't tested full-screen mode (which I never use). If you want to send an F11, put this statement in the program:

Send {F11}

Regards, Joe
0
 

Author Comment

by:DarrenEley
ID: 40227077
Excellent Help!! Cant thank you enough. Regards Darren
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40227099
Darren,
You're very welcome! You could do me a big favor by clicking the Request Attention link under the question and asking to re-open the question and then selecting my first or second post as the answer. The reason is that my article, which is referenced in both of those first two posts, will then get some credit (points) as being part of the Accepted Solution. That would thank me enough. :)  Regards, Joe

P.S. And if it's not asking too much, you could give the article a Helpful=Yes vote.
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40234190
Hi eenookami,
It's still showing http:#a40226992 as the Accepted Solution. Regards, Joe
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40234247
Perfect! Thanks much.
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40234283
Darren,
Thanks for making the extra effort to do that — I really appreciate it! Next step is to give the article a Helpful=Yes vote. :)  And thanks again to eenookami for reopening it. Regards, Joe
0
 

Author Comment

by:DarrenEley
ID: 40234304
Hiya, Joe, Sorry to be a bit dim here but I cant find anything about Helpful=Yes vote button or anything... Where do I find it, and I will for sure press it :)

Regards

Darren
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40234352
Go to the article that was helpful and scroll to the bottom of it, but before the reader comments begin. On the right side, you'll see this:

article helpful
Just click the green check-mark. Thanks!
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40234876
Darren,
Thanks for the "upvote" (the short name for a Helpful=Yes vote) — on both articles! Much appreciated! Regards, Joe
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Make the most of your online learning experience.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question