Jump to content
Sign in to follow this  
Aarstad

Controlgettext specific text

Recommended Posts

Aarstad

Hey. Since it seems like making 1 computer to command multiple computers to execute a file is a fucking impossible task, I figured perhaps I rather use a chat that the machines can react on when specific text from admin is input.

when admin logs on it says "(name) logged on as admin"

I have tried to play with Controlgettext,

$admin = controlgettext ("chat", "", (chatcontrolidhere)

msgbox (0, "", $admin)

This outputs everything that has been said in the chat so far, but to have it perhaps only show what the admin that logged on said? How do you go by doing that?

$admin = "Admin says : Hello I want you to make a message box now"

if controlgettext (chatinfo,controlid etc) = $admin then msgbox (0, "", "made message box because admin told me to")

This is sort of what I try to write, but the program doesnt seem to react properly. How do you make it so the script can save whoever were the last to log on as admin, and output a messagebox when the admin makes an input?

I am also wondering how you can only run whatever the admin asks of one time, then exclude it, so the computer doesnt keep repeating the same msgbox every time.

Thats all, thanks!

Edited by Aarstad

Share this post


Link to post
Share on other sites
Aarstad

What do you mean by "I rather use a chat"?

A basic chat that has been created in autoit. There is a lot of them in the example scripts, and they seem to work just fine out of the box. My thought is that I will modify a chat script, have it set up to automatically log in on computer startup, hide itself and periodically check the text box for new input from someone who logs on as admin.

Say for instance admin tells you to run an exe on dropbox, or perhaps launch a restart, the script will react accordingly. I think it sounds sort of cool in a way, but I am sure a couple of you guys are tearing your hair to shreds by reading this.

I have tried

While 1

$admin = Controlgettext ("", "", <controlid>)

if $admin = "Admin says : msgbox" Then msgbox (0, "", "test")

Endif

Sleep 1000

Wend

however, it does not seem to work. If I run a script with just $admin = controlgettext, then msgbox ($admin), it will show the part where admin says : msgbox, but it seems it disregards that because controlgettext also includes everything written in the window.

Share this post


Link to post
Share on other sites
JohnOne

What you need to do then is parse all the text.

There is StringRegExp which a lot of people use, or there are many more ways, for example _StringBetween which is a standard udf <- help file

So you could have $Array = _StringBetween($admin,'Admin says : ', @CRLF)

Which will give you an array of strings which occur between 'Admin says : ' and @CRLF, assuming @CRLF is the end of line character in the control.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Aarstad

What you need to do then is parse all the text.

There is StringRegExp which a lot of people use, or there are many more ways, for example _StringBetween which is a standard udf <- help file

So you could have $Array = _StringBetween($admin,'Admin says : ', @CRLF)

Which will give you an array of strings which occur between 'Admin says : ' and @CRLF, assuming @CRLF is the end of line character in the control.

Thanks for the reply.

Does that mean that the variable with $admin should be acquired by using controlgettext on the chat interface at first?

When you perform .login adminpw securitypw, the chat outputs:

NAME has logged on as admin.

How can you parse that line as storing NAME (at random) when "has logged on as admin." occurs? Thank you, JohnOne.

example:

(14.09) JohnOne connected.

(14.09) JohnOne has logged on as admin.

(14.09) Aarstad says : I recognized you "JohnOne" as admin! if you give me a command now, I will be sure to follow!

(14.09) JohnOne has logged off admin.

(14.09) Aarstad says : I no longer recognize you "JohnOne".

Pretty basic and might be confusing, but recognizing some text and then saving whatever was before it would be key here.

Edited by Aarstad

Share this post


Link to post
Share on other sites
JohnOne

You would need to test for the format and keywords of any and all strings you need to recognise and parse from there.

It's your code and you will be sending the strings, so I suggest you start studying string functions and do a bit of testing.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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  

×