Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Can AutoIt do this?

- - - - -

  • Please log in to reply
21 replies to this topic

#1
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
  • Joined 18-September 04
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.


How to remove advertisement from MSFN

#2
redfive19

redfive19

    Junior

  • Member
  • Pip
  • 96 posts
  • Joined 17-August 04
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*.....

#3
Swimming_Bird

Swimming_Bird

    I want the NHL Back

  • Member
  • PipPipPip
  • 378 posts
  • Joined 12-October 04
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.
AIM: laxcmx
MSN: roi_roy@hotmail.com
IRC: Swimming_Bird @ irc.rizon.net

#4
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
  • Joined 18-September 04
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.

#5
Achdine

Achdine

    Junior

  • Member
  • Pip
  • 97 posts
  • Joined 11-May 05
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.

#6
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
  • Joined 18-September 04

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.

<{POST_SNAPBACK}>


Ok you've inspired me :thumbup

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

#7
urie

urie

    Senior Member

  • Member
  • PipPipPipPip
  • 519 posts
  • Joined 30-July 03

RogueSpear you could try SciTE4AutoIt3 it has a lot of fuctions for autoit check it out here P.S. you still have to install autoit also


http://www.autoitscr.../autoit3/scite/

Edited by urie, 14 July 2005 - 06:00 PM.


#8
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,654 posts
  • Joined 02-August 04
  • OS:Windows 7 x64
  • Country: Country Flag
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. ;)

#9
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
  • Joined 18-September 04
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..

#10
MAVERICKS CHOICE

MAVERICKS CHOICE

    The Guy from Aus

  • Member
  • PipPipPipPipPipPipPip
  • 1,767 posts
  • Joined 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

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..

<{POST_SNAPBACK}>



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, 25 August 2005 - 02:44 PM.


#11
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
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.

#12
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
  • Joined 18-September 04
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")


#13
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
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.

#14
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
  • Joined 18-September 04
: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.

#15
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
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, 25 August 2005 - 11:43 PM.


#16
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
  • Joined 18-September 04
@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.

#17
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
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.

#18
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,654 posts
  • Joined 02-August 04
  • OS:Windows 7 x64
  • Country: Country Flag
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

#19
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
  • Joined 18-September 04
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.

#20
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,654 posts
  • Joined 02-August 04
  • OS:Windows 7 x64
  • Country: Country Flag
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

Posted Image

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

Edited by MHz, 28 August 2005 - 03:24 AM.


#21
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 551 posts
  • Joined 30-September 05
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!

#22
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,654 posts
  • Joined 02-August 04
  • OS:Windows 7 x64
  • Country: Country Flag
@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 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN