Window not visible !

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Okapi
Junior Coder
Posts: 28
Joined: Wed Dec 29, 2010 1:22 am

Window not visible !

Post by Okapi » Thu Mar 10, 2011 1:55 pm

Hi all,
I want to launch a program without being visible, I make that :

Code: Select all

Let>RP_WINDOWMODE=0
RunProgram>C:\program.exe
It works for some programs but not for some others (like Calculator and my program). Any solution ? thanks.

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Mar 10, 2011 5:43 pm

One way would be to wait for the window to open then immediately move it off the visible desktop.

Code: Select all

Run>C:\windows\System32\calc.exe

//Wait for the window to open
WaitWindowOpen>Calculator*

//Then move the window off screen
MoveWindow>Calculator*,-32000,-32000

//Do what ever you are doing while its not visible
//In this case its just a 3 second wait.
Wait>3

//Then move the window back to the visible portion of the desktop.
MoveWindow>Calculator*,100,100

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Mar 10, 2011 5:48 pm

Some windows may be forcing themselves to be visible after they are started, so asking Run to run them hidden may get overridden by the app itself once it has started.

So as JRL suggests you could "hide" it after it has started.

Rather than move it off screen you could try hiding it altogether using the Win API ShowWindow function:

GetWindowHandle>The_Windows_Title,handle
LibFunc>User32,ShowWindow,swres,handle,0
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts