• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
Sign in to follow this  
Followers 0
RogueSpear

Can AutoIt do this?

22 posts in this topic

I have yet to learn AutoIt because so far I've been able to accomplish everything I need to do through VBscript and repackaging/direct .msi editing. But this one has me stumped:

I have repacked SpywareBlaster into an msi file and it has the latest updates that were available at the time I made the custom package, but obviously it would be nice to automate an update at the time of OS installation. I don't want to schedule auto updates to run regularly because I get the feeling this would violate the EULA. Just a one time update so that when my OS install is complete.. it's complete.

SpywareBlaster uses a non-standard interface. I believe it is mandatory that you use a pointing device in order to use this application. I have been unable to find any way to navigate via the keyboard. One can only assume this was done on purpose so that they can sell subscriptions to the auto update service. So can AutoIt manipulate this kind of application?

I have nothing against AutoIt, but I don't want to spend a day or two checking it out only to find it can't do this one task - which is all I would ever really need it for. So I'm just wondering if anyone knows the answer off the top of their head.

Thanks.

0

Share this post


Link to post
Share on other sites

someone posted an auto it scrupt to do exactly what you're asking. I wish I had bookmarked it. it works off of the coord relative to the window *i think*.....

0

Share this post


Link to post
Share on other sites

you can tell autoit to manually send a mouse click to a particular coordinate in a window. the easiset way to generate this would be to use one of the autoitscript generators.

0

Share this post


Link to post
Share on other sites

hmmm.. sounds like it would be dependant upon the screen resolution maybe? Like the coordinates would be different on an 800x600 than on a 1024x768 screen. Or is it coordinates based on the open window itself? If that's the case then maybe I will break down and figure this thing out.

0

Share this post


Link to post
Share on other sites

It can do either.

CaretCoordMode = 0 - relative coords to the active window
CaretCoordMode = 1 - absolute screen coordinates (default)
CaretCoordMode = 2 - relative coords to the client area of the active window

AutoIt is extremely easy to learn, and the help file is excellent. I basically sat down and wrote my own program selection screen (like WPI), complete with .ini file reads, file log, and a purty, customizable interface, without ever having used this language before.

0

Share this post


Link to post
Share on other sites
AutoIt is extremely easy to learn, and the help file is excellent.  I basically sat down and wrote my own program selection screen (like WPI), complete with .ini file reads, file log, and a purty, customizable interface, without ever having used this language before.

Ok you've inspired me :thumbup

Now my wife :realmad: is really gonna kill me. One more thing to take up my time :whistle:

0

Share this post


Link to post
Share on other sites

You maybe right RogueSpear. It is a strange program to navigate. I tried some VBScript sendkeys, but kept getting mixed results. I did not have much like with AutoIt to directly operate the controls. Using the mouse, as you stated, may do this for you.

AutoIt can work by screen, window or client window coordinates. So this is could be achieved.

urie supplies a link the a customized version of Scite, which has all the onboard tools to help. Check the AU3Recorder in the tools menu.

AutoIt Download page (Scite4AutoIt3 link is also on the page, just look down the page)

You may want to look at this sometime. If you are good with VBScript, then the Com features would of some interest?

AutoIt Beta Download page (this has Com, ActiveX, and latest additions, Scite4AutoIt3 can support both release and beta versions installed, at the same time)

You can use VBScript as your primary language, but nothing wrong with a little AutoIt, to fill the gaps. ;)

0

Share this post


Link to post
Share on other sites

Ok I finally decided to sit down and get comfy with AutoIt. What an id*** I am for waiting so long, but you know when you got a million other things on your plate something just has to give. Well I'm on vacation this week so what do I do? Lol, I learn a new scripting language. Still don't quite have this SpywareBlaster down yet. I'm trying the whole CaretCoord thing as mentioned above. I'll post my findings shortly..

0

Share this post


Link to post
Share on other sites
Ok I finally decided to sit down and get comfy with AutoIt.  What an id*** I am for waiting so long, but you know when you got a million other things on your plate something just has to give.  Well I'm on vacation this week so what do I do?  Lol, I learn a new scripting language.  Still don't quite have this SpywareBlaster down yet.  I'm trying the whole CaretCoord thing as mentioned above.  I'll post my findings shortly..

Think you'll find it to be excellent. I'm certainly sold on usin it on my tricky ua software installs.

Good Luck.

Edited by MAVERICKS CHOICE
0

Share this post


Link to post
Share on other sites

Well if I have any advice to give it would be to make sure you don't have WindowBlinds or any other OS skinning app running. A lot of my first scripts ended up using a lot of "Send" commands...which I think is horid and very prone to fail.

I'm still just a beginner my self...my coding style changes a lot over time...still need to go back and redo a lot of scripts...if for no other reason than to serve as better examples of how to write install scripts.

0

Share this post


Link to post
Share on other sites

Ok guys.. I'm not getting anywhere with this. The mouse seems to be moving relative to the screen rather than relative to the window even though I've set it for window mode. Mind you, I'm an AutoIt noob, but I've been coding for a while now. Take a look at the code and see if I'm doing something totally wrong. I'd appreciate it. I know there's a redundancy in the beginning of the script, but I was basically flailing in the wind trying anything.

AutoItSetOption ("CaretCoordMode", 0)
WinMinimizeAll()
Run("C:\Program Files\Security\SpywareBlaster\spywareblaster.exe")
WinWaitActive("SpywareBlaster")
WinActivate("SpywareBlaster")
Sleep(5000)
MouseClick("left", 65, 371)
MouseClick("left", 381, 395)
Sleep(10000)
MouseClick("left", 65, 131)
MouseClick("left", 187, 363)
Sleep(5000)
WinClose("SpywareBlaster")

0

Share this post


Link to post
Share on other sites

AutoItSetOption ("CaretCoordMode", 0)

Is used for where the cursor is....

Opt	("MouseCoordMode",	0)

Is used for where the mouse is. :)

AutoItSetOption or Opt...ether one works.

0

Share this post


Link to post
Share on other sites
:blushing: yep, that did the trick! Thanks a million. I think I got a bit of tunnel vision and never would have found that line.
0

Share this post


Link to post
Share on other sites

Your welcome...another tip...instead of:

MouseClick("left", 65, 371)

Use

MouseClick("left", 65, 371, 1, 1)

Hehe makes the mouse haul a**. :)

Also

WinWaitActive("SpywareBlaster")

WinActivate("SpywareBlaster")

Sleep(5000)

As you have already said...there is redundancy in the script by activating a window that is already active...so secondline there is not needed....also...if its possible get rid of the sleep statements. Do this by checking to see if there is different visable text some where on the following window thats different from the prior.

WinWait("SpywareBlaster", "Bob")

...

WinWait("SpywareBlaster", "mark")

Now the above winwaits are different windows...so long as "mark" wasn't on the winwait that was looking for "bob"

If that fails...you could test to see if it refresh's the window title per window...if so...you could rename the first window's title to some thing else, example:

WinWait("SpywareBlaster")

WinSetTitle ( "SpywareBlaster", "", "Old Window" )

....

WinWait("SpywareBlaster")

....

Or

WinWait("SpywareBlaster")

WinSetTitle ( "SpywareBlaster", "", "Old Window" )

....

WinWaitClose("Old Window" )

...

Any ways a few ideas to play with

** Update **

Also its a good idea not to hard code paths if possible.

Run("C:\Program Files\Security\SpywareBlaster\spywareblaster.exe")

Would be better written like so:

Run( @ProgramFilesDir & "\Security\SpywareBlaster\spywareblaster.exe" )

That way should "Program Files" be set else where than C:\ the script would not fail

Edited by Nologic
0

Share this post


Link to post
Share on other sites

@Nologic,

That thing about harcoding the path.. yea I never do that in all actuality and that was one of the things on my shortlist to alter in the script. And thank you for pointing out how to do it.

Regarding the SpywareBlaster script; adding the 1, 1 to the MouseClick statements sure sped things up quite a bit. It took me a little while to understand what you meant at first in terms of eliminating the Sleep commands but I think I got the hang of that. Unfortunately I seem to be picking out all of the real doozies to try and automate.

My next victim is Symantec Client Security's ALEScan.exe. If you're not familiar with it, this app scans your drive for any applications that are defined in the firewall policy and then plugs the rules for them into your firewall configuration. The window is actually an Internet Explorer window running a script. I'm not exactly sure what they're doing to achieve this. The only way that I figured it out was when I had corrupted file somewhere and when I ran ALEScan.exe, I received an error message about script errors, "do you want to continue running scripts in this window..." that whole bit.

Soooo.. using AutoIt's window information tool on this little application gives you squat. Sending keyboard commands works, something more than I can say for SpywareBlaster, but the window title never changes, none of the buttons or anything at all gives a control name or ID. I tried the little trick WinSetTitle that you showed me, but the title never changes. And to make this completely maddening, there isn't any text that I'm able to key on. It really appears that Sleep is indeed the only option here. And that sucks, because this program's performance is incredibly dependant upon hard drive speed, fragmentation, the number of files in the drive, CPU speed, etc. So using a least common denominator philosophy, I'd have to let this thing sleep for like 5 minutes in order to account for a worst case scenario.

Last thing.. as good as the online help is for AutoIt, it sure is vast. There's just an awful lot there to absorb. At first I really thought I was going to go out and save the world with this thing, but I'm starting to realize now that it really takes a lot of tinkering and creativity sometimes to get AutoIt to do just what you want it to do.

0

Share this post


Link to post
Share on other sites

Yeah there is a lot of dinking around to get things to work just right...and AutoIT isn't some magic genie...but it does go a long way to solve a lot of issues.

As for your explorer issue...maybe show the status bar of the window and see if that changes...if so...you may have a way to key the script in to certain events.

Do

Sleep ( 100 )

$tatus = StatusbarGetText( "Internet Explorer" )

Until $tatus = "New Event #1"

ControlSend ( "Internet Explorer", "", "", "{DOWN 3}" )

Do

Sleep ( 100 )

$tatus = StatusbarGetText( "Internet Explorer" )

Until $tatus = "New Event #2"

....

Well some thing along those lines.

0

Share this post


Link to post
Share on other sites

For successfully automating an application within Internet Explorer. It maybe easier to use Window handles as to Window titles because the title can change. I would use the AutoIt Beta with Com capabilities. Some User Defined Functions have been made in this AutoIt Forum Thread. This will allow you to interact with the web content directly, rather then hoping for keyboard commands to do it.

Automating Internet Explorer successfully is no novice area indeed. Com should make it more of a possibility to accomplish. The 3.1.1 version of AutoIt will see nothing of a webpage, or of the controls of the browser.

HTH

0

Share this post


Link to post
Share on other sites

I have now reached a state of scripting nirvana (somehow I feel like a complete loser uttering that statement :P ). I just decided to dive inside AutoItX. Holy smokes! For a diehard VBscript freak like myself this is fantastic. There's plenty of things that VBscript can do that AutoIt cannot and vice versa. This gives me everything (except compiling to an exe file).

Now I'm afraid that I'm going to be going back to retool about a third of my scripts.

0

Share this post


Link to post
Share on other sites

Compiling to exe file?

AutoIt is my total solution, and not a single script is compiled. I use the interpreter AutoIt3.exe to run the Au3 files, like you would run CScript.exe to run VBS files. I use a main script with a For loop to execute each script in the software folder, one after the other. Writing a log file recording start and finish times of each install, as well as the exitcode. I would consider VBScript could do this as well. I also put up a full screen popup window, that displays a picture on it, with a scrolling list of software and a progress bar. VBScript can do the same.

Here is it running a T-12

125min4pa.png

And you are going to retool about a third of your scripts. I have done mine countless times. :)

Edited by MHz
0

Share this post


Link to post
Share on other sites

Not sure how AutoIt3 works but in AutioIt 2 if you

run the "AutoIt Reveal Mode" it shows all the window

titles and window text. Doing this is far more reliable

than using the mouse, at least ov v2. I think on v3 you're

OK because it can lock out the user from the mouse,

I mean in v2 if you moved the mouse that was it, it

threw the whole thing out.

Something like...

WinWait, Window Title v1.0b, Welcome to setup
WinActivate, Window Title v1.0b, Welcome to setup
Send, {TAB}
Send, {TAB}
Send, {TAB}
Send, n
WinWait, Window Title v1.0b, Please choose the destination
WinActivate, Window Title v1.0b, Please choose the destination
Send, {TAB}
Send, {TAB}
Send, n

etc etc (or in some cases etc etc etc etc etc etc etc etc, lol)

Where tab just moves to the correct button and sends

"n" which would be "Next" button.

I never use the mouse but then, I never use AutoIt3, was too

scared of all that new code :blushing:

Yes, just use the v2 to v3 converter I know, but it never works!

0

Share this post


Link to post
Share on other sites

@LeveL

The "AutoIt Reveal Mode" is almost the same as the AutoIt3 "AutoIt Info Tool".

And the MouseClick, why not go for the control directly as with AutoIt3 ControlClick.

When I used AutoIt2 years ago, it was inflexiable to control installations. Sure it was and perhaps still good compared to other automation scripts, but with AutoIt3, I can do so much more with structured programming techniques. Sorry, but the days of the AutoIt2 are long gone for me, and I say goodbye to it like a breath of fresh air just come along.

Don't be scared, if your going to waste your time, then waste it on improving your ability with AutoIt3. :)

General help is here for AutoIt users as well as the great unattended help here.

0

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

  • Recently Browsing   0 members

    No registered users viewing this page.