Jump to content

Trying to invent the wheel?


Recommended Posts

I am going mad since yesterday. As a beginner with Autoit I start with automatic installation

of tools like Ad-Aware. This program opens at the end the last screen - named Ad-Aware 2007 -

just like the first one.

I dont see the way to end this last screen - the script works fine until to the marked point:

Run("aaw2007.exe")

WinWait("Ad-Aware", "Please select")

Sleep(100)

Send("{ENTER}")

WinWait("Ad-Aware", "WARNING")

Sleep(100)

Send("!n")

WinWait("Ad-Aware", "Lavasoft")

Sleep(100)

Send("!a")

Sleep(100)

Send("!n")

WinWait("Ad-Aware", "The settings")

Send("!n")

WinWait("Ad-Aware", "Please choose")

Send("!n")

WinWait("Ad-Aware", "The Lavasoft")

Send("!n")

WinWait("Ad-Aware", "Click the Back")

Send("!n")

WinWaitActive ( "Product registration")

Sleep(100)

Send("!{F4}")

WinWait("Ad-Aware", "Click the Finish")

Sleep(100)

Send("!f")

; * * * * here stops the program in the last following screen and does not close

WinWaitActive ("Ad-Aware 2007")

Sleep(300)

Send("{F4}")

Does anyone have a working solution or / and idea?

Thank you !

Link to comment
Share on other sites

I am going mad since yesterday. As a beginner with Autoit I start with automatic installation

of tools like Ad-Aware. This program opens at the end the last screen - named Ad-Aware 2007 -

just like the first one.

I dont see the way to end this last screen - the script works fine until to the marked point:

Run("aaw2007.exe")

WinWait("Ad-Aware", "Please select")

Sleep(100)

Send("{ENTER}")

WinWait("Ad-Aware", "WARNING")

Sleep(100)

Send("!n")

WinWait("Ad-Aware", "Lavasoft")

Sleep(100)

Send("!a")

Sleep(100)

Send("!n")

WinWait("Ad-Aware", "The settings")

Send("!n")

WinWait("Ad-Aware", "Please choose")

Send("!n")

WinWait("Ad-Aware", "The Lavasoft")

Send("!n")

WinWait("Ad-Aware", "Click the Back")

Send("!n")

WinWaitActive ( "Product registration")

Sleep(100)

Send("!{F4}")

WinWait("Ad-Aware", "Click the Finish")

Sleep(100)

Send("!f")

; * * * * here stops the program in the last following screen and does not close

WinWaitActive ("Ad-Aware 2007")

Sleep(300)

Send("{F4}")

Does anyone have a working solution or / and idea?

Thank you !

Try changing that Send("!f") to Send("{enter}") if that control is the default.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

To clearify

The

send("!f")

works and switches to the last screen - the old disappears and a new one appears

with the same title : Ad-Aware 2007

It just gives the option to <scan> or <update> but has no option to quit.

Thats why I try to close it with send("!{F4}")

I tried several options at that end, but I somehow have the impression that the

window is not active...?

Thks

Link to comment
Share on other sites

Hello falther,

Few thoughts about your predicament:

0) Add this line in before the line where the script stops:

Sleep(1000)
$result = WinExists( "Ad-Aware 2007" )
MsgBox(0, 'Test', $result )

If the message box says 1, then the window should be retreivable. The problem may simply be a matter of window focus.

1) It appears that you're just wanting to exit the program altogether after sending "!f". Could you send "!f!{F4}" and accomplish the same thing?

2) If (1) isn't an option, how about using ProcessKill() after sending "!f"?

3) Are you sure the title of the window is what is used in the script? Depending on the window title matching option used, a small inconsistency in spelling can be problematic. I assume that if you didn't specify the WinTitleMatchMode, then the script is using the default.

4) Similar to (3), there are alternate ways to retrieve a reference to the window. Check out the Window Titles and Test (Advanced) in the Help.

4) Just because a window is visible doesn't necessarily mean it is active. Try something like WinActivate( "Ad-Aware 2007" ) prior to the WinWaitActive( "Ad-Aware 2007" ).

5) Be advised that WinWaitActive provides you with a timeout and a return value. You should be able to use that to determine the state of things and react accordingly.

Edited by zfisherdrums
Link to comment
Share on other sites

Install Ad-Aware SILENTLY...

http://www.appdeploy.com/packages/detail.asp?id=187

Run Ad-Aware SILENTLY...

#366121

Thks for the info - but as I want to run several tools out of one keystroke (one script) to leave the pc then for

a coffee or so.... its not the way for me to start one of the tools seperately....

And its the Ad-Aware 2007 which I use ..

but again - thks for info.

Link to comment
Share on other sites

Hello falther,

Few thoughts about your predicament:

0) Add this line in before the line where the script stops:

Sleep(1000)
$result = WinExists( "Ad-Aware 2007" )
MsgBox(0, 'Test', $result )

If the message box says 1, then the window should be retreivable. The problem may simply be a matter of window focus.

--> returns 1

1) It appears that you're just wanting to exit the program altogether after sending "!f". Could you send "!f!{F4}" and accomplish the same thing?

--> does not help

2) If (1) isn't an option, how about using ProcessKill() after sending "!f"?

--> reverts an error (I do not find that command.?) The ProcessClose("Ad-Aware 2007") does not help.

3) Are you sure the title of the window is what is used in the script? Depending on the window title matching option used, a small inconsistency in spelling can be problematic. I assume that if you didn't specify the WinTitleMatchMode, then the script is using the default.

--> ???

4) Similar to (3), there are alternate ways to retrieve a reference to the window. Check out the Window Titles and Test (Advanced) in the Help.

--> checked with Auto Window Info

4) Just because a window is visible doesn't necessarily mean it is active. Try something like WinActivate( "Ad-Aware 2007" ) prior to the WinWaitActive( "Ad-Aware 2007" ).

--> tried - no solution

5) Be advised that WinWaitActive provides you with a timeout and a return value. You should be able to use that to determine the state of things and react accordingly.

--> I put your small code - with WinWaitActive - at the end and the message did not appear until I clicked into the new

window. this gives me the same impression: When this last screen appears, the program checkes whether Ad-Aware

is a sold or a free version and (in my case its the free version) switches within the window the status for a part of the

programm (= Ad-Watch 2007) from on to off. The top bar is grey like for a non active window - I click into the

window anywhere and the top bar changes to blue - like for an active window.

Thks
Link to comment
Share on other sites

  • Moderators

If you're really gluten for punishment, you could maybe get some ideas from: http://www.autoitscript.com/forum/index.ph...c=20133&hl=

However, I really like WeaponX's idea of running it from command lines... Makes life so much simpler and far less mistakes.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thks - Lavasoft has changed the installation procedure completely with the Ad-Aware 2007.

The silent options haven't changed, the graphical installation may have though. This is why its easier to rely on the silent option.

Link to comment
Share on other sites

  • Moderators

Thks - Lavasoft has changed the installation procedure completely with the Ad-Aware 2007.

You missed the point. I used Control functions.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Run("aaw2007.exe")

WinWait("Ad-Aware", "Please select")

Sleep(100)

Send("{ENTER}")

WinWait("Ad-Aware", "WARNING")

Sleep(100)

Send("!n")

WinWait("Ad-Aware", "Lavasoft")

Sleep(100)

Send("!a")

Sleep(100)

Send("!n")

WinWait("Ad-Aware", "The settings")

Send("!n")

WinWait("Ad-Aware", "Please choose")

Send("!n")

WinWait("Ad-Aware", "The Lavasoft")

Send("!n")

WinWait("Ad-Aware", "Click the Back")

Send("!n")

WinWaitActive ( "Product registration")

Sleep(100)

Send("!{F4}")

WinWait("Ad-Aware", "Click the Finish")

Sleep(100)

Send("!f")

Send("{F1}")

Sleep(9000)

Send("!{F4}")

Sleep(200)

Send("!{F4}")

; ;

; Thank you all for the hints, but please bear in mind that I am a beginner - any kind

; of sophisticated code is still far out of my understanding. I found a solution which

; is somehow strange: Line 27 opens with F1 the Windows Help Window - in closing it, the

; Ad-Aware 2007 - Window becomes active - and only then its possible to close the program.

;

; Perhaps someone sees now the problem and has a nicer solution - thank you !

;

Link to comment
Share on other sites

Falther,

The tenacity you are showing will help you tremendously in moving up from beginner quickly.

To help with the immediate problem, which I interpret as "I need Ad Aware 2007 to close", try these instead:

1) ProcessClose()

---> Sorry about mis-naming it earlier; I got it confused with something in C#. In order for this command to work, you need to know the name of the process. This usually isn't the name of the window. If I had to bet on it, I'd say that it is called "aaw2007.exe" based on the Run signature. You can confirm this by opening the Windows TaskManager and observing what it is called under the "Processes" tab. Easier still is to grab its identifier when you first start it. You can do this like so:

$PID = Run("aaw2007.exe")
;...rest of your code
ProcessClose( $PID )

2) WinClose()

---> Since you've confirmed that the window could be retrieved with AutoIt, using this command is the equivalent of sending alt-F4 to the specified window.

WinClose( "Ad Aware 2007" )

3) WinKill()

---> For windows that do not respond to WinClose(), this command is a lot more aggressive. Applications may not have the opportunity to execute their shutdown processes when you invoke this. But if the application is already installed, it may be sufficent.

WinKill( "Ad Aware 2007" )

Finally, if the problem you are trying to solve is a distributed installation of Ad Aware 2007, then I must concur with the other posts regarding silent installations. Those would be much less brittle that GUI automation.

You appear to be using this application as a self-teaching mechanism for the AutoIt API. That is a great way to learn. Don't forget contextual searches in the AutoIt Help, a healthy dose of forum trolling, and Valuater's teaching tool will help you tremendously as well. I hope this helped.

Good Luck and Happy Easter!

Zach Fisher...

Edited by zfisherdrums
Link to comment
Share on other sites

Falther,

The tenacity you are showing will help you tremendously in moving up from beginner quickly.

To help with the immediate problem, which I interpret as "I need Ad Aware 2007 to close", try these instead:

1) ProcessClose()

---> Sorry about mis-naming it earlier; I got it confused with something in C#. In order for this command to work, you need to know the name of the process. This usually isn't the name of the window. If I had to bet on it, I'd say that it is called "aaw2007.exe" based on the Run signature. You can confirm this by opening the Windows TaskManager and observing what it is called under the "Processes" tab. Easier still is to grab its identifier when you first start it. You can do this like so:

$PID = Run("aaw2007.exe")
;...rest of your code
ProcessClose( $PID )

2) WinClose()

---> Since you've confirmed that the window could be retrieved with AutoIt, using this command is the equivalent of sending alt-F4 to the specified window.

WinClose( "Ad Aware 2007" )

3) WinKill()

---> For windows that do not respond to WinClose(), this command is a lot more aggressive. Applications may not have the opportunity to execute their shutdown processes when you invoke this. But if the application is already installed, it may be sufficent.

WinKill( "Ad Aware 2007" )

Finally, if the problem you are trying to solve is a distributed installation of Ad Aware 2007, then I must concur with the other posts regarding silent installations. Those would be much less brittle that GUI automation.

You appear to be using this application as a self-teaching mechanism for the AutoIt API. That is a great way to learn. Don't forget contextual searches in the AutoIt Help, a healthy dose of forum trolling, and Valuater's teaching tool will help you tremendously as well. I hope this helped.

Good Luck and Happy Easter!

Zach Fisher...

First - again thank you for your assistance!

For your info - and for those (beginners) who might also look for a script for Ad-Aware 2007 my last script only works

on Windows 2000. I traced that Windows XP reacts differently at - naturally - the complicated end, and at another point

within the script. Here is the code which works for xp:

Run("aaw2007.exe")

; WinWait("Ad-Aware", "Please select")

Sleep(100)

; the next 4 lines: Program under XP does not react on only one ENTER

WinSetState("Ad-Aware 2007", "", @SW_ENABLE)

Send("{ENTER}")

Sleep(100)

Send("{ENTER}")

WinWait("Ad-Aware", "WARNING")

Sleep(200)

Send("!n")

WinWait("Ad-Aware", "Lavasoft")

Sleep(200)

Send("!a")

Sleep(200)

Send("!n")

WinWait("Ad-Aware", "The settings")

Sleep(200)

Send("!n")

WinWait("Ad-Aware", "Please choose")

Sleep(200)

Send("!n")

WinWait("Ad-Aware", "The Lavasoft")

Send("!n")

WinWait("Ad-Aware", "Click the Back")

Sleep(200)

Send("!n")

WinWaitActive ( "Product registration")

Sleep(200)

Send("!{F4}")

WinWait("Ad-Aware", "Click the Finish")

Sleep(200)

Send("!f")

Sleep(9000)

; the 4 following lines, where the script works as it should - but only with XP

WinWait("Ad-Aware 2007")

Send("!{TAB}")

Sleep(200)

Send("!{F4}")

Nice Easter Sunday

Walter Fangl - Vienna / Austria

Edited by falther
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...