Sign in to follow this  
Followers 0
laidback01

First script, is this how you folks would do this?

6 posts in this topic

Hi folks,

this is my first audiIT script, Just testing proof of concept, and installing adobe acrobat reader 8.1.1

Anyway, any better ways to do this, questions as to why I did whatever, etc, all I'm sure would be helpful... I'm trying to make something useful for my work. Thanks!

One of the areas I've got questions on... when the install finished, sometimes it asks to restart, sometimes not. When it doesn't restart, all looks fine but it leaves a tray icon saying the script is paused. Is there a way to handle this better?

****** START OF SCRIPT *******

; Installing Acrobat Reader 8.1.1

; Run Application from \\tech_srv\cis_cmn\Applications\Adobe Applications\ACROBAT

Run ( "AdbeRdr811_en_US.exe" )

$return = 0

$count = 0

While 1

; This while loop is here because Adobe can take a long time to expand from the network drive...

$return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Change &Destination Folder...")

if $return = 1 Then

ExitLoop

Endif

$count = $count +1

if $count=10 Then

MsgBox( 0, "", "Script Stuck, exiting...", 2)

Exit

EndIf

WEnd

; you don't need the return of the function, but it sure is handy to sort out what happened.

$return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Click Next to install to this folder")

if $return = 0 Then

MsgBox (0, "", "Function Failed. WinWait starting Line 16.Contact Support")

Exit

EndIf

; if the above if didn't catch, well, click "Next"

$return = ControlClick ( "Adobe Reader 8.1.1 - Setup", "", "[iD:4276]" )

if $return = 0 Then

MsgBox (0, "", "Function Failed. ControlClick starting Line 23. Contact Support")

Exit

EndIf

; if the above if didn't catch, well, click "Install"

$return = ControlClick ( "Adobe Reader 8.1.1 - Setup", "", "[iD:4334]" )

if $return = 0 Then

MsgBox (0, "", "Function Failed. ControlClick starting Line 30. Contact Support")

Exit

EndIf

; if the above if didn't catch, well, click "Install"

$return = 0

$count = 0

While 1

; This while loop is here because Adobe can take a long time to install the actual application

$return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Setup has successfully installed Adobe Reader")

if $return = 1 Then

ExitLoop

Endif

$count = $count +1

if $count=10 Then

MsgBox( 0, "", "Script Stuck, exiting...", 2)

Exit

EndIf

WEnd

$return = ControlClick ( "Adobe Reader 8.1.1 - Setup", "", "[iD:4304]" )

if $return = 0 Then

MsgBox (0, "", "Function Failed. ControlClick starting Line 47. Contact Support")

Exit

EndIf

$return = WinWaitActive( "setup", "Setup needs to restart your system to complete the installation")

if $return = 0 Then

MsgBox (0, "", "Function Failed. WinWait starting Line 53. Contact Support")

Exit

Endif

$return = ControlClick ( "setup", "", "[iD:7]" )

if $return = 0 Then

MsgBox (0, "", "Function Failed. ControlClick starting Line 47. Contact Support", 5)

Exit

EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

; Installing Acrobat Reader 8.1.1
; Run Application from \\tech_srv\cis_cmn\Applications\Adobe Applications\ACROBAT
Run ( "AdbeRdr811_en_US.exe" )
$return = 0
$count = 0

While 1
; This while loop is here because Adobe can take a long time to expand from the network drive... 
$return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Change &Destination Folder...")
if $return = 1 Then
ExitLoop
Endif

$count = $count +1
if $count=10 Then
MsgBox( 0, "", "Script Stuck, exiting...", 2)
Exit
EndIf
WEnd

; you don't need the return of the function, but it sure is handy to sort out what happened.
$return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Click Next to install to this folder")
if $return = 0 Then
MsgBox (0, "", "Function Failed. WinWait starting Line 16.Contact Support")
Exit
EndIf

; if the above if didn't catch, well, click "Next"
$return = ControlClick ( "Adobe Reader 8.1.1 - Setup", "", "[ID:4276]" )
if $return = 0 Then
MsgBox (0, "", "Function Failed. ControlClick starting Line 23. Contact Support")
Exit
EndIf

; if the above if didn't catch, well, click "Install"
$return = ControlClick ( "Adobe Reader 8.1.1 - Setup", "", "[ID:4334]" )
if $return = 0 Then
MsgBox (0, "", "Function Failed. ControlClick starting Line 30. Contact Support")
Exit
EndIf

; if the above if didn't catch, well, click "Install"
$return = 0
$count = 0

While 1
; This while loop is here because Adobe can take a long time to install the actual application 
$return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Setup has successfully installed Adobe Reader")
if $return = 1 Then
ExitLoop
Endif

$count = $count +1
if $count=10 Then
MsgBox( 0, "", "Script Stuck, exiting...", 2)
Exit
EndIf
WEnd

$return = ControlClick ( "Adobe Reader 8.1.1 - Setup", "", "[ID:4304]" )
if $return = 0 Then
MsgBox (0, "", "Function Failed. ControlClick starting Line 47. Contact Support")
Exit
EndIf

$return = WinWaitActive( "setup", "Setup needs to restart your system to complete the installation")
if $return = 0 Then
MsgBox (0, "", "Function Failed. WinWait starting Line 53. Contact Support")
Exit
Endif

$return = ControlClick ( "setup", "", "[ID:7]" )
if $return = 0 Then
MsgBox (0, "", "Function Failed. ControlClick starting Line 47. Contact Support", 5)
Exit
EndIf

It was too hard to read, next time put some code tags around it like this:

[Autoit][/Autoit]
Edited by schilbiz

Share this post


Link to post
Share on other sites

Thanks, makes it much easier!

Share this post


Link to post
Share on other sites

You can also do a silent install with command line options:

#304049

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This may be a product of how you posted it but if not you should use tabs in your loops

While 1
; This while loop is here because Adobe can take a long time to expand from the network drive... 
$return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Change &Destination Folder...")
if $return = 1 Then
ExitLoop
Endif

Would become

While 1
; This while loop is here because Adobe can take a long time to expand from the network drive... 
     $return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Change &Destination Folder...")
     if $return = 1 Then
          ExitLoop
     Endif
WEND
Edited by GWmellon

Share this post


Link to post
Share on other sites

This may be a product of how you posted it but if not you should use tabs in your loops

While 1
; This while loop is here because Adobe can take a long time to expand from the network drive... 
$return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Change &Destination Folder...")
if $return = 1 Then
ExitLoop
Endif

Would become

While 1
; This while loop is here because Adobe can take a long time to expand from the network drive... 
     $return = WinWaitActive( "Adobe Reader 8.1.1 - Setup", "Change &Destination Folder...")
     if $return = 1 Then
          ExitLoop
     Endif
WEND

Oh, yeah, it was from posting. I'm using Scite, and it autotabs fine. Thanks though!

Also, the above post, the quiet installs, gee I really like that!

thanks for the tip there, it's right along the lines of what I'm looking for.

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