setFocus and Lock computer

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
scott

setFocus and Lock computer

Post by scott » Fri May 16, 2003 5:16 am

I wrote a script:

Run Program>C:\WINNT\system32\CMD.EXE
Run Program>C:\WINNT\system32\calc.exe
WindowAction>1,C:\WINNT\system32\CMD.EXE
Send Character/Text>d:\unison

I find it realy works in normal situation but failed when computer locked. It seemed setFoucus can not work when computer lock. Anybody help me?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri May 16, 2003 7:12 am

Hi,

When your computer is locked there are no windows. There is no console and windows do not exist. You can't see them, they aren't there. Therefore SetFocus isn't going to work.

Macro Scheduler works by simulating a user and needs the same same level of access and visibility. For GUI automation which involves sending keystrokes, mouse events and detecting and focusing windows the machine needs to be unlocked as it does if you were going to use the computer yourself.
MJT Net Support
[email protected]

scott

Re: Support

Post by scott » Fri May 16, 2003 8:40 am

Thanks for your reply.
I am in trouble in writing scrpit. I want to implement following function.
1. Open command window.
2. Key in command line to execute specify program.(This program can not execute by Run Program mode directly.)
3. Execute this command.
How can I do it? Thank you very very much.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri May 16, 2003 1:29 pm

Have you tried writing a batch file to perform those actions, and having Run Program> call the batch file?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

scott

Post by scott » Sat May 17, 2003 1:54 am

I tried to write a batch file like this:
d:\unison -batch
Then I put it in Run Program and call this file. Unfortunately, it cannot work. The DOS interface only flashed for one second then disappeared.
I am crazing. Now I have to execute the command manually.
Please help me to reslove it. Thanks a lot.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat May 17, 2003 3:42 am

(Assuming Windows OS)

Name of batch file can be like pgm_name.bat
Batch file could look something like this:
==================

c:
cd\program_path
command_to_run_program.exe
=======================

Macro Scheduler script commands could look like:
Label>Start
Let>RP_WINDOWMODE=1
Let>RP_WAIT=1
Run Program>command.com /c pgm_name.bat
If>RP_RESULT>31,Good,Bad

Label>Bad
MessageModal> Program did not run properly%CRLF%Error code was %RP_RESULT%.
Goto>End

Label>Good
MessageModal>Program ran successfully
Goto>End

Label>End
Notes:
1. You may also need to create a PIF file for the batch file to control other attributes when running the program. After the batch file has been created, just right click on the batch file in Explore, Click on Properties, and set values on tabbed pages as needed.
2. Read the MS Help section on Run Program command.
3. You can also activate logging and look at the log results. (Currently the log writes at the end of a command executing, not when it is initally called).
4. You can also debug from Editor, using Debug, turn on Show Watch List, Insert a **BREAKPOINT** at the end of the script, click on the RUN icon, and see the final values of the variables in the watch list. Or on a more complex script, use Single Step to see the result of the script commands after each line.

Hope this helps.........good luck.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

scott

Post by scott » Tue May 20, 2003 1:47 am

It is OK now. Thank you very much.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue May 20, 2003 2:15 am

That's good news Scott!

Curious about what you did to make it OK.....can you share some details with us? :?:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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