win2k Posted July 19, 2006 Posted July 19, 2006 Hi, I am new to the forums and im trying to figure out how to compare text. here is the code thus far, not much of it yet. Dim $i Send("#r") send("c:\windows\system32\services.msc") send("{enter}") WinWaitActive("services","",1) send("{TAB}") for $i=0 to 10 Send("{DOWN}") next If you run the script, it just opens up your services window and scrolls down through the first 10 services. Basically i want to figure out how to capture the highlighted text and compare it to a constant string variable if there is not a match, it goes down to the next service and compares the new text to the const string again. I eventually have to change an option with a certain service and well i dont want to do it manually 300 times. Any help with how to do that would be great.
Developers Jos Posted July 19, 2006 Developers Posted July 19, 2006 Think this is a lot easier to use : http://www.autoitscript.com/forum/index.ph...st&p=153791 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
win2k Posted July 19, 2006 Author Posted July 19, 2006 Think this is a lot easier to use : http://www.autoitscript.com/forum/index.ph...st&p=153791Oh yeah that will be handy here shortly, I actually have to go into the properties of a service then change the username and password to log into an Admin account, stop the service then start it. That page has been added to my favorites
win2k Posted July 19, 2006 Author Posted July 19, 2006 Ok, So maybe im not doing this right, In the services window i am trying to get the name of the service that i have highlighted. Its basically going to be a loop that will run down through all of them. I am using WinGetText but that is not returning what service the cursor has highlighted. im lost right now , any help ?
AzKay Posted July 19, 2006 Posted July 19, 2006 ClipPut ? That copies to clipboard, But I dont know if that will work # MY LOVE FOR YOU... IS LIKE A TRUCK- #
BPBNA Posted July 19, 2006 Posted July 19, 2006 (edited) If you go to the first service and send enter or double click it, It comes up with the service name highlighted, you could use Send("^c") then ClipGet() and you would have the service name. Another thing you could try if you know the service names to begin with, is the sc command in DOS. If you run "sc query | more" in a command prompt you will get a list of the services, their status, and their real names. Not sure how you could GET the information this way, but if you knew them you could restart them like this. Theres also net stop and net start. Edit: typo Edited July 19, 2006 by BPBNA
win2k Posted July 20, 2006 Author Posted July 20, 2006 I basically had to end up doing that, the codes looks something like this, Thanks for the help though Dim $i Dim $text ;Declaring the name of the service you are searching for Const $service= "Server" Send("#r") WinWaitActive("Run", "", 1) send("c:\windows\system32\services.msc") sleep(50) send("{enter}") WinWaitActive("services","",1) send("{TAB}") Do send("{ENTER}") sleep(200) send("^C") $text=ClipGet() If $text <> $service Then send("{ESC}") Endif send("{DOWN}") until $text==$service there is more code after this but it is irrelevant
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