Jump to content
UBot Underground

Windows Automation questions


Recommended Posts

Has anyone really starting playing with the new windows automation features?

 

Is it possible yet to be able to wait for a specific window to exist before running a function.

 

Maybe have a thread loop until a window with a specific title is found and then perform a function?

 

Any Idea's?

Link to post
Share on other sites

This is a way to do it - although not super elegant it does work. Run this and then open your calculator somtime before 30 seconds I put in a kill switch at 30 seconds so it doesn't loop forever.\

 

 

define tt1 {
plugin command("WindowsCommands.dll", "set active window", "Calculator", "CalcFrame")
set(#test, $plugin function("WindowsCommands.dll", "$scrape text", "Calculator", "CalcFrame", 64, 39), "Global")
}
thread {
set(#avail, "no", "Global")
set(#count, 0, "Global")
loop while($comparison(#avail, "=", "no")) {
tt1()
if($comparison(#test, "=", "Calculator")) {
then {
set(#avail, "yes", "Global")
}
else {
}
}
if($comparison(#count, "=", 6)) {
then {
stop script
}
else {
}
}
wait(5)
increment(#count)
}
alert("Success, program opened!")
}

 

  • Like 1
Link to post
Share on other sites

I am so glad this area of automation is starting to see some interest.  I have said for quite some time I thought UBot was more of a threat for other Windows Automation tool than previously considered.

 

NOTE TO SELF....Redo my Picasso bot showing MS Paint under UBot's control using UBot v4.x rather than v3.x.

Link to post
Share on other sites
ui text box("Path to save folder", #pathtofolder)
plugin command("WindowsCommands.dll", "set active window", "Untitled - Notepad", "Notepad")
wait(.5)
plugin command("WindowsCommands.dll", "type keys", "Untitled - Notepad", "Notepad", 42, 68, #pathtofolder)
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Down")
plugin command("WindowsCommands.dll", "keyboard event", "a", "Key Press")
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Up")
wait(.25)
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Down")
plugin command("WindowsCommands.dll", "keyboard event", "c", "Key Press")
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Up")
plugin command("WindowsCommands.dll", "keyboard event", "Backspace", "Key Press")
wait(.25)
plugin command("WindowsCommands.dll", "type keys", "Untitled - Notepad", "Notepad", 42, 68, "some text here")
wait(.5)
thread {
    plugin command("WindowsCommands.dll", "close window", "Untitled - Notepad", "Notepad")
}
wait(.5)
plugin command("WindowsCommands.dll", "click dialog button", "Notepad", "Save")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "F4", "Key Press")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Down")
plugin command("WindowsCommands.dll", "keyboard event", "a", "Key Press")
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Up")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Backspace", "Key Press")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Down")
plugin command("WindowsCommands.dll", "keyboard event", "v", "Key Press")
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Up")
wait(.4)
plugin command("WindowsCommands.dll", "click mouse", "Untitled - Notepad", "Notepad", 99, 270, "Left Click")

 

 

 

 

Try this its a good start but not perfect nor complete just open a blank notepad for it to interact with.

 

sweet thats a good starting base thanks

Link to post
Share on other sites

Thanks for the help, I was quite shocked too see that the new windows automation features did not spark more forum conversation.

Glad we have at least one thread now :)

 

On a side note anyone else notice that the type text feature is a bit finicky. On some boxes I have to run the command multiple times for it to actually type the text.

Link to post
Share on other sites

Okay it was bugging me that I couldn't get it to work right. I have no idea why the type keys didn't work properly yesterday (hence the funky way of copying/pasting the path to the folder) but nonetheless I got it working properly today. Here is the right code:

 

To use it just open a blank notepad file.

 

ui text box("Path to save folder", #pathtofolder)
ui text box("File Name:", #txtfilename)
plugin command("WindowsCommands.dll", "set active window", "Untitled - Notepad", "Notepad")
wait(.5)
plugin command("WindowsCommands.dll", "type keys", "Untitled - Notepad", "Notepad", 42, 68, "some text here")
wait(.5)
thread {
    plugin command("WindowsCommands.dll", "close window", "Untitled - Notepad", "Notepad")
}
wait(.5)
plugin command("WindowsCommands.dll", "click dialog button", "Notepad", "Save")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "F4", "Key Press")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Down")
plugin command("WindowsCommands.dll", "keyboard event", "a", "Key Press")
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Up")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Backspace", "Key Press")
wait(.5)
plugin command("WindowsCommands.dll", "type keys", "Untitled - Notepad", "Notepad", 208, 94, #pathtofolder)
wait(.4)
plugin command("WindowsCommands.dll", "click mouse", "Untitled - Notepad", "Notepad", 195, 482, "Left Click")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Backspace", "Key Press")
wait(.5)
plugin command("WindowsCommands.dll", "type keys", "Untitled - Notepad", "Notepad", 232, 480, #txtfilename)
plugin command("WindowsCommands.dll", "keyboard event", "Enter", "Key Press")
  • Like 2
Link to post
Share on other sites
  • 3 weeks later...

I've been playing with it for the last few days file exist command works a treat.

 

for example with a third party software that you want it to loop through modifying files and then saving them.

Link to post
Share on other sites
  • 3 weeks later...

Anyone have any idea's on scraping the skype chat window. Have not been able to solve this since the built in wizard kind of sucks for form detection.

 

I have tried some of the form Spy utilities out there and no go.

Link to post
Share on other sites
  • 3 months later...

any thoughts on changing save to path, and save to file name, then clicking save on the popup save to file windows using windows commands?

 

That is exactly what I am stuck on tonight. Clicking a download button on a web form is bringing up the Save As window. I'm stuck there.

 

 

 

Okay it was bugging me that I couldn't get it to work right. I have no idea why the type keys didn't work properly yesterday (hence the funky way of copying/pasting the path to the folder) but nonetheless I got it working properly today. Here is the right code:

 

To use it just open a blank notepad file.

ui text box("Path to save folder", #pathtofolder)
ui text box("File Name:", #txtfilename)
plugin command("WindowsCommands.dll", "set active window", "Untitled - Notepad", "Notepad")
wait(.5)
plugin command("WindowsCommands.dll", "type keys", "Untitled - Notepad", "Notepad", 42, 68, "some text here")
wait(.5)
thread {
    plugin command("WindowsCommands.dll", "close window", "Untitled - Notepad", "Notepad")
}
wait(.5)
plugin command("WindowsCommands.dll", "click dialog button", "Notepad", "Save")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "F4", "Key Press")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Down")
plugin command("WindowsCommands.dll", "keyboard event", "a", "Key Press")
plugin command("WindowsCommands.dll", "keyboard event", "Control", "Key Up")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Backspace", "Key Press")
wait(.5)
plugin command("WindowsCommands.dll", "type keys", "Untitled - Notepad", "Notepad", 208, 94, #pathtofolder)
wait(.4)
plugin command("WindowsCommands.dll", "click mouse", "Untitled - Notepad", "Notepad", 195, 482, "Left Click")
wait(.5)
plugin command("WindowsCommands.dll", "keyboard event", "Backspace", "Key Press")
wait(.5)
plugin command("WindowsCommands.dll", "type keys", "Untitled - Notepad", "Notepad", 232, 480, #txtfilename)
plugin command("WindowsCommands.dll", "keyboard event", "Enter", "Key Press")

 

 

That wouldn't work on computers with different screen sizes and resolutions would it?

Link to post
Share on other sites

 

That wouldn't work on computers with different screen sizes and resolutions would it?

 

 

Yes, I have tried it and it din't work, this the flaws of windows automation plugin,  is anyone have an idea to embed any windows application so we can have a same resolution..?

Link to post
Share on other sites

I played with the concept in the above code a bit and actually got it to work for my needs without relying on the x,y coordinates (i think). The "Save As" window seems to be a real pain to deal with, and of course since it's opening IN the Ubot Studio, you can't use the UBot Type Text Wizard to get coordinates and such.

 

I actually just made sure the active window for the Type Text command was "Save As", Left the Parent Class blank, made up some X,Y coordinates out of thin air (250,250), and used the F4 keystroke to select the folder location field within the "Save As" window, just like HelloInsomnia suggested above.

 

But then, since I don't want to rely on real X,Y coordinates that won't work on other computers, I didn't change the actual file name, because I don't know of any keystroke to select that area. Instead I'm changing the folder location as I described above and leaving the actual file name as whatever the default is that comes up with the Save As window.

 

Seems to be working so far, but maybe I'm just getting lucky and springs, sprockets and gears are going to come flying out any second. ;)

Link to post
Share on other sites
  • 11 months later...

I'm still having to use (another) program to do my windows stuff and then call that program from within ubot - But I'm hoping that over time ubot dev team will spend more time on providing a more stable and robust solution. In fact, I wish those guys would buy a copy of (that other program) and play with it a bit to see its power and functionality working with windows, and then set to updating that portion of ubot.

Link to post
Share on other sites

winautomation most recently ... The "problem" with all of them is that none are as intuitive as uBot, that's why i'm saying I can't wait for this particular set of controls to be tweaked. I'm constantly building little bots that I have to shell out to little helper programs created by other software. Just looking forward to ubot becoming the total one-stop solution.

Link to post
Share on other sites

Funny - I just downloaded winautomation yesterday to try and accomplish something I was not able to easily do with ubot.  I wish ubot could be my all in one also.

  • Like 1
Link to post
Share on other sites

I really wish some of the plugin developers would take to creating some windows automation plugins...

 

Would be nice to have some better features.  If someone could add in image recognotion to windows commands it would really open alot of possibilites...

Link to post
Share on other sites

I really wish some of the plugin developers would take to creating some windows automation plugins...

 

Would be nice to have some better features.  If someone could add in image recognotion to windows commands it would really open alot of possibilites...

its already on my list to look at in the future plenty of things you can do such as memory manipulation ,image rec etc.

Probably be a while before I even look at it so if anyone's got the time to jump in feel free.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...