Aarstad Posted February 6, 2013 Share Posted February 6, 2013 (edited) 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 February 6, 2013 by Aarstad Link to comment Share on other sites More sharing options...
JohnOne Posted February 6, 2013 Share Posted February 6, 2013 What do you mean by "I rather use a chat"? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Aarstad Posted February 6, 2013 Author Share Posted February 6, 2013 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")EndifSleep 1000Wendhowever, 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. Link to comment Share on other sites More sharing options...
JohnOne Posted February 6, 2013 Share Posted February 6, 2013 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. Link to comment Share on other sites More sharing options...
Aarstad Posted February 6, 2013 Author Share Posted February 6, 2013 (edited) 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 fileSo 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 February 6, 2013 by Aarstad Link to comment Share on other sites More sharing options...
JohnOne Posted February 6, 2013 Share Posted February 6, 2013 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now