Sign in to follow this  
Followers 0
MrBeatnik

Send Fails If Blockinput (1)?

8 posts in this topic

Hi all,

I've had a look around, and not found much so here is a new post :)

Overview:

When running BLOCKINPUT from one script, the second script cannot use the SEND command.

Goal:

Currently, I Blockinput (in a loop) and then Send text commands to a window.

Now, the important bit is - the users on the workstations that this script will run, have low rights (they are students), but I will be running a new windows as an administrator. The last thing I want a user to do is have access to this window, cancel the run, and have a cmd window available with full system rights.

Current situation:

The main script calls the Blockinput script (which is just a loop, always blocking).

The main script then continues to open windows, etc, successfully.

The main script then tries to Send some text, but it never appears.

I am presuming that the Blockinput script is blocking all input from other programs as well.

Would there be a way to allow input (send commands) from a particular PID? I can start the blockinput script with a parameter of the PID of the original prog.

I hope that is not too confusing.

I am aware of the CTRL-ALT-DEL problem... users can still hit this with Blockinput (we currently use Novell Gina, so we don't want to make our own to stop this), but I can of course distro the reg keys to disable the buttons on the ctrl-del screen....

Script is still being changed by the hour here, but just so you know I am seeking an admin installation solution for those with no admin rights (naturally this still requires passwords etc). Saves us closing labs and getting admins to log in / schedule NAL runs.

Any advice would be great!


Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have some scripts that are run as the administrator, but they are done via the command prompt and are hidden. How about if you run the entire thing (BlockInput) from just the one script? That way you can set BlockInput to 1 when you are running the app and then set BlockInput to 0 when you are attempting to input data into another window.

Edit: Removed quote--too long

Edited by SerialKiller

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Did you take a look at the table in the BlockInput documentation? It would help to know which OS and version of AutoIt you are using :)

Also, an example is helpful. I confirm the behavior you describe on XP Pro sp2 with latest AutoIt beta.

;=== One.au3 ===
Run("notepad.exe")
WinWait("Untitled - Notepad")

blockinput(1)
RunWait(@AutoItExe & " " & "two.au3")
Send("abcde")
Send("this sends find on XP...")

;=== Two.au3 ===
Send("12345")
Send("this seems it should print but does not...")
Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Could you call BlockInput(0) in the parent script right before you run the child?

Then have the child script do BlockInput(1).

Also, is there a reason you need to use Send instead of ControlSend, batch files, etc?

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

SK: I'm also calling this RUNAS as Admin via command prompt. I was planning on hiding them, but was running into issues. The BlockInput has to loop, as setting it to 1 can be escaped with CTRL-ALT-DEL, and the script takes time when processing other exe's.

CS: Yep, I read the BlockInput documentation, and my apologies for not stating my O/S. Indeed XP SP2.

As for the ControlSend; I didn't realise I could use that on a CMD prompt window (as AU3Info wasn't giving any controls within), but that works fine with the Title. As it is invoked during RUNONCEEX, and no shell, then there is no other CMD window possible to be open.

Could you call BlockInput(0) in the parent script right before you run the child?

Then have the child script do BlockInput(1).

I haven't tried it, assuming the same problem.... Could be interesting, but getting around that shouldn't be too difficult really...

At least my main question was answered - Send is blocked with BlockInput!.

Another post to make, but a new topic I think...

Thanks!


Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

At least my main question was answered - Send is blocked with BlockInput!.

Well, any child process (such as a VBScript that calls SendKeys) would be affected.

I never said ControlSend would work with a Command Prompt window :)

Could you use AutoIt's RunAsSet function instead of RUNAS?

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

A messy way to do a work around is to use _ispressed, and make it so if anything is done, it would cause a short sleep statement. You could build in a function to allow the keystrokes sent so it would by-pass the _ispressed. Like I said, it is messy, but it may solve the problem. Then again, what do I know. I'm just a padawan...

Share this post


Link to post
Share on other sites

CS - Apologies, I wasn't clear - using RunAsSet ot emulate RUNAS :)

VM - _ispressed might work quite well, in the same way the child script was a BlockInput Script - the only way it would work is if send/controlsend does not send the string as "key presses".... which I think it may well do, considering it's using the Gina? Not sure... but easy to try when I have a few moments :(


Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Share this post


Link to post
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
Sign in to follow this  
Followers 0