Sign in to follow this  
Followers 0
TigerKnee

N00b ControlSend Help

15 posts in this topic

Hi All

Here is the Control info for the field I am working with

sDBUfdv.png

I have the app open so my script is simple.  Just ControlSend the username "Kiosk".  I tried all three below to no avail.  Can you guys tell me what I'm doing wrong?

ControlSend("Autologon - Sysinternals", "", "[Edit1]", "Kiosk")
ControlSend("Autologon - Sysinternals", "", "[CLASS:Edit; INSTANCE:1]", "Kiosk")
ControlSend("Autologon - Sysinternals", "", "[CLASSNN:Edit1]", "Kiosk")

Share this post


Link to post
Share on other sites



Remove the square brackets from the first line, and that'll be all you need.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Remove the square brackets from the first line, and that'll be all you need.

Thank you for the quick response.  Tried this

ControlSend("Autologon - Sysinternals", "", "Edit1", "Kiosk")

And nothing happens :(

Share this post


Link to post
Share on other sites

Hmm. Could be that program doesn't accept 'automated input'. Try the ControlSetText or Send functions instead of ControlSend. The Send function will be a bit tricky to get to work. You'll need to set the focus (manually or with the ControlFocus function) to get it to work as you expect.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Hmm. Could be that program doesn't accept 'automated input'. Try the ControlSetText or Send functions instead of ControlSend. The Send function will be a bit tricky to get to work. You'll need to set the focus (manually or with the ControlFocus function) to get it to work as you expect.

 

I actually got the Send to work but the problem was that the window had to be active...  So you're telling me to make it active with ControlFocus then use Send?

Share this post


Link to post
Share on other sites

If that field automatically becomes active when the program get focus, you can use the WinActivate function to activate the program. Might I also suggest to read thru the Help file, several times even, to become familiar with all the native AutoIt functions and the language itself.

Please, only take that as a suggestion, not a hidden RTFM! :)


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

This works fine but guess you need to run with #RequireAdmin

#RequireAdmin
ControlSend("Autologon - Sysinternals", "", "Edit1", "Kiosk")

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

If that field automatically becomes active when the program get focus, you can use the WinActivate function to activate the program. Might I also suggest to read thru the Help file, several times even, to become familiar with all the native AutoIt functions and the language itself.

Please, only take that as a suggestion, not a hidden RTFM! :)

 

Haha if you were going to RTFM me, you probably would've done it in the first post!  I consider myself a 7.5/10 in batch files so I'm trying to learn this.  Believe me when I told you that I have scoured the Help menu and Google before posting here.  I'm still trying to get a handle on the language itself.  Thank you for your patience!

Share this post


Link to post
Share on other sites

This works fine but guess you need to run with #RequireAdmin

#RequireAdmin
ControlSend("Autologon - Sysinternals", "", "Edit1", "Kiosk")

Jos

 

#RequireAdmin worked!  Thanks!!!  (Help and Google did not mention this at all....)

Share this post


Link to post
Share on other sites

Arggg...  Now I can into another problem...   "Administrator" is prepopulated in Username: field.  ControlSend ADDS to this so instead of clearing the field, it adds to it making it "AdministratorKiosk"..  How do I clear it first before ControlSending?

Share this post


Link to post
Share on other sites

Try ControlSetText with "" to clear whatever is in there then put your username.

Share this post


Link to post
Share on other sites

Try ControlSetText with "" to clear whatever is in there then put your username.

 

That did it.  Cheers to everyone for all your help!

Share this post


Link to post
Share on other sites

Well now I have another problem....(never seems to stop!!!)

None of my ControlSetText commands are working now that I'm using RunAs :(  The executable runs but none of the text is getting sent like Run was.  Any ideas?

#RequireAdmin
RunAs("LocalAdminUserName", "", "LocalAdminPassword", 0, "C:\Install\AutoLogon\AutoLogon.exe /accepteula")
Sleep(100)
ControlSetText("Autologon - Sysinternals", "", "Edit1", "UserName")
ControlSetText("Autologon - Sysinternals", "", "Edit2", "Domain")
ControlSetText("Autologon - Sysinternals", "", "Edit3", "PaSsWoRd")
ControlClick("Autologon - Sysinternals", "", "Button1", "")
WinClose("Autologon - Sysinternals")

I tried 0,1,2 and 4 on the RunAs to no avail.

Thanks again in advanced for your patience!

Share this post


Link to post
Share on other sites

One, do you need to run "AutoLogin.exe" as an admin. Wouldn't it work just find as a normal user using "Run". You only need to run your script as admin with the #RequireAdmin.

Secondly, are you sure, 100ms is enough time for the application to load? Maybe, by the time the program loads, it's time to close it. You might want to use:

WinWait("Autologon - Sysinternals")

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