Blockinput...but not all....

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Blockinput...but not all....

Post by mileswilliams » Mon Aug 07, 2006 8:41 pm

Using the latest version btw...


I have a load of Macros that run quite happily and are pretty stable... thanks to blocking the input of my less informed colleagues.

The problem is that when blockinput is running SHIFT-ESC won't run and as a result if there is a problem for whatever reason the only way out is CTRL-ALT-Del...

But have you every tried killing a process while the macro is tabbing about and pressing enter ?!
:shock:
I thought about adding IfWindowOpen 's throught out the script looking for task manager but I don't know if that will work, and it sounds messy...

Is it possible to blockinput to everything except a certain key ?

Has anyone else thought of a way around this ?

Thanks guys.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Mon Aug 07, 2006 8:49 pm

Try this from the help files....

OnEvent>EventType,EventParm,ExtraParm,Subroutine



EventType has several choices, one of which is KEY_DOWN. So you might build a statement that waits for the F10 key to be pressed or then send control to a EndOfProgram loop.

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Tue Aug 08, 2006 1:16 am

Thanks for the reply SkunkWorks however even that seems to fail....

Here is a test script I am using :


Label>start

Blockinput>1
//Do stuff when ALT+SPACE are pressed
OnEvent>KEY_DOWN,VK32,3,keypress

Message>the macro is running, try and kill it.

SRT>keypress
Message>It only went and worked !!!!!
blockinput>0
Goto>END
END>keypress

wait>10
Message>The macro failed to be killed.
Blockinput>0
Label>END

I have tried putting the OnEvent line before the Blockinput>1 that didn't make any difference.

I am assuming that the Blockinput>1 disregards any other commands and does what is says on the tin.

Anyone else come up with any novel ideas regarding blocking all keys bar a "kill switch" ?

Thanks again SkunkWorks.
don't be a chicken little

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Tue Aug 08, 2006 1:21 am

I use another method to kill macros which does not even require ON_EVENT.

Place a line in the macro which checks for the existence of a file. If the file is found, then stop the macro.

...do something
Iffileexists>KillMe.txt
goto>EndOfProgram
else>
keep working....
endif>

There are many many ways to stop a macro by means of "outside intervention".....

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

been away, still have the problem...

Post by mileswilliams » Thu Aug 24, 2006 11:05 am

The problem with using a file to stop a macro from tabbing around an application is that you need the macro to stop while you create one... it isn't possible to do that.

I have looked into and the only solution appears to be a total block (blockinput) followed by an unblock of a key or combo of keys.

I want to be able to run the macro without users messing it up. But want them to be able to still press SHIFT -ESC or other key / combo to stop the macro should an unexpected event take place.

How come CTRL-ALT-DELETE still works dispite blockinput is pressed ? Can't another key combo be added to the exception to this command ?
don't be a chicken little

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

Post by JRL » Thu Aug 24, 2006 1:12 pm

I've never used Blockinput> but have thought about it. One of my concerns was just what you've been discussing. Doing a little experimenting this morning and I found that the act of pressing Ctrl+Alt+Del not only calls up task manager but also cancels the blockinput function.

run the following script, then press Ctrl+Alt+Del. Close Task manager (notice your mouse is working) then press Shift+Esc to stop the script.

Hope this is helpful,
Dick

Edit
When all else fails read the help. This is from help for BlockInput>:
Be aware that this prevents all user input apart from CTRL-ALT-DEL. If you need to stop a running script that has blocked input press CTRL-ALT-DEL and then stop the script.

Code: Select all

Blockinput>1

Let>k=0
Repeat>k
add>k,1
message>the macro is running, try and kill it.%CRLF%Looping for %k% of 30 seconds
Wait>1
Until>k,30

Blockinput>0

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Aug 24, 2006 1:30 pm

Do you have very tight loops? If so add a wait (as in JRL's example) otherwise it can be very difficult to get the PC's attention.

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Thu Aug 24, 2006 1:47 pm

Well spotted.... but there is a further problem...

As soon as I press CTRL-ALT-DEL the macro tabs around task manager pressing all sorts of buttons and is... well... dangerous, it could kill reports that are running in the foreground etc...

Not sure but do you think that Blockinput should be adjusted to not include SHIFT-ESC, like it doesn't block CTRL-ALT-DEL ? Is that worthy of a suggestion in further updates ?

What do you think ?
don't be a chicken little

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Thu Aug 24, 2006 1:51 pm

Didn't see your update....

I have pretty tight loops there is about 100 steps to the macro and it needs to run quickly as it helps the team take calls quickly.

It doesn't make any difference though, as blockinput appears to block SHIFT-ESC which is the default macro killer combo.
don't be a chicken little

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

Post by JRL » Thu Aug 24, 2006 1:55 pm

Then use OnEvent to detect task manager and close it.

Press Ctrl+Alt+Del to start task manager, Onevent should see the window and immediately close task manager. After task manager closes, press Shift+Esc to stop the script.

Like this:
Later,
Dick

Code: Select all

OnEvent>WINDOW_OPEN,Windows Task Manager,0,CloseTM

SRT>CloseTM
WindowAction>3,Windows Task Manager
END>CloseTM


Blockinput>1
Let>timer=30
Let>k=0
Repeat>k
add>k,1
message>the macro is running, try and kill it.%CRLF%Looping for %k% of %timer% seconds
Wait>1
Until>k,%timer%
Blockinput>0

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Thu Aug 24, 2006 2:17 pm

JRL you have hit the nail on the head, Automation Wizard indeed. I adjusted it slightly to suit the situation I was trying to resolve :

Code: Select all

OnEvent>WINDOW_OPEN,Windows Task Manager,0,CloseTM

SRT>CloseTM
WindowAction>3,Windows Task Manager
goto>Finish
END>CloseTM

Blockinput>1
Let>timer=30
Let>k=0
Repeat>k
add>k,1
message>the macro is running, try and kill it.%CRLF%Looping for %k% of %timer% seconds
Wait>1
Until>k,%timer%

Label>Finish
Blockinput>0

This removes the need to Press SHIFT ESC while the macro is still causing mayhem.

Thanks everyone for your responses, as always the best support I have had for any piece of software ever, very much appreciated.
don't be a chicken little

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Thu Aug 24, 2006 5:28 pm

One last thing... in order to make this work perfectly, does anyone know the name for the system window that networked computers get in XP, before Task Manager.

It looks like is should be called "Windows Security" but it isn't...

For those of you wondering what I am talking about, it is a window that appears when you hit CTRL-ALT-DEL and has Lock computer, Log off, Shut Down, change password Task Manager and Cancel on it.

I can't see it in System window monitor as it isn't there till you press CTRL-ALT-DEL, when you have pressed it, you can't refresh the system window monitor.... Catch 22.
don't be a chicken little

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

Post by JRL » Thu Aug 24, 2006 6:19 pm

I don't know the name of the window but for Windows XP the "Windows Security" panel can be disabled. Its appearance is tied to the Windows Welcome screen. The Microsoft site with the information is located here:

http://support.microsoft.com/kb/q281980/

Or perhaps you can use the Onevent> trigger WINDOW_NEWACTIVE? If the Security Window pops up, pressing esc will close it and using the technique that you employed the script will be closed before you get back to the desktop.

I think that this trigger has obvious drawbacks but it might work for your situation.

Hope this helps,
Dick

Code: Select all

OnEvent>WINDOW_NEWACTIVE,0,0,CloseTM

SRT>CloseTM
Press Esc
Goto>end
END>CloseTM

Blockinput>1
Let>timer=30
Let>k=0
Repeat>k
add>k,1
message>the macro is running, try and kill it.%CRLF%Looping for %k% of %timer% seconds
Wait>1
Until>k,%timer%
Blockinput>0

Label>end
Blockinput>0

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Aug 25, 2006 1:44 am

....So! OnEvent was the key to this puzzle!

I wish I had thought of that.... :wink:

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

Post by JRL » Fri Aug 25, 2006 2:23 am

Yes, you deserve a pat on the back

Good idea Paul :!:

I hope this is the solution to the problem. We'll have to wait for his response to find out.

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