Sign in to follow this  
Followers 0
win2k

Comparing Text in Windows

7 posts in this topic

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.

Share this post


Link to post
Share on other sites



Oh 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

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

ClipPut ?

That copies to clipboard, But I dont know if that will work


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by BPBNA

Share this post


Link to post
Share on other sites

I basically had to end up doing that, the codes looks something like this, Thanks for the help though :D

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

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