Jump to content

Recommended Posts

Posted (edited)

Can any one help me for the below script, Where it was hanging if i skip 1 st installation...

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Func kill()
    Exit
EndFunc   ;==>kill

#Region ### START Koda GUI section ### Form=F:\Basic.kxf
    $Basic_Softwares_Form1 = GUICreate("Basic-Softwares- Ver-1.0", 446, 355, -1, -1)
    GUISetFont(8, 400, 0, "Verdana")
    GUISetBkColor(0x008080)
    $General_softwares = GUICtrlCreateGroup("Basic-Softwares", 8, 112, 425, 233)
    GUICtrlSetColor(-1, 0x000000)
    GUICtrlSetBkColor(-1, 0xC0C0C0)
    $Winrar = GUICtrlCreateButton("Winrar", 24, 144, 121, 25)
    GUICtrlSetBkColor(-1, 0xC8C8C8)
    $Acrobat_Reader = GUICtrlCreateButton("Acrobat-reader", 24, 176, 121, 25)
    GUICtrlSetBkColor(-1, 0xC8C8C8)
    $END = GUICtrlCreateButton("END", 296, 296, 112, 33)
    GUICtrlSetBkColor(-1, 0xC8C8C8)
    GUICtrlSetFont(-1, 7, 400, 0, "Verdana")
    GUICtrlSetBkColor(-1, 0xA6CAF0)
    GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Winrar
            Winrar()
        Case $Acrobat_Reader
            Acrobat_Reader()
        Case $END
            kill()
    EndSwitch
WEnd

;For Winrar installation
Func Winrar()
    Local $FFInstdest = ("F:\AX_Softwares\SOFTWARE_DUMP\Wrar.exe")
    Local $FFSetupWin = ("WinRAR 3.62")
    Local $FFSetupWin1 = ("WinRAR Setup")
    ShellExecute($FFInstdest)
    Sleep(300) ;
    WinActivate($FFSetupWin)
    WinWaitActive($FFSetupWin)
    Send("{ENTER}") ;
    Sleep(300) ;
    WinActivate($FFSetupWin1)
    WinWaitActive($FFSetupWin1)
    Send("{ENTER}") ;
    Sleep(300) ;
    Send("{ENTER}") ;
    Sleep(300)
EndFunc   ;==>Winrar

;For Acrobat-reader Installation
Func Acrobat_Reader()
    ShellExecute("F:\AX_Softwares\SOFTWARE_DUMP\Acrobat_Reader.exe")
    Sleep(8000) ;
    WinWaitActive("Adobe Reader X (10.1.1) - Setup", "Ready to Install Adobe Reader X (10.1.1)")
    WinActivate("Adobe Reader X (10.1.1) - Setup", "Ready to Install Adobe Reader X (10.1.1)")
    Sleep(200)
    Send("{ENTER}") ;
    Sleep(5000) ;
    WinWaitActive("Adobe Reader X (10.1.1) - Setup", "Setup Completed")
    WinActive("Adobe Reader X (10.1.1) - Setup", "Setup Completed")
    Sleep(200)
    Send("{ENTER}") ;
    Sleep(1000) ;
EndFunc   ;==>Acrobat_Reader

 

Edited by Melba23
Added code tags
Posted

You know you could just use RunWait() and silent switches for the installs?  For example Winrar.exe /S, just search for <product> silent install in Google.

Posted (edited)

Welcome to AutoIt and the forum!

Why do you automate the installation GUI? Most of the programs (in your case WiNRAR and PDF Reader) allow silent installation using command line switches.

Edit: Too slow ;)

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

BTW: When posting code, please use the editors code tag by clicking the "<>" button :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
1 minute ago, water said:

Welcome to AutoIt and the forum!

Why do you automate the installation GUI? Most of the programs (in your case WiNRAR and PDF Reader) allow silent installation using command line switches.

Friend,

Thanks for your prompt reply, i am preparing a script to install around 36 software's and few of them are need to define the installations paths. Our TL condition that to show all the software's installation graphically, So i have chosen GUI .. please help on the same shall i share you the complete script !!!!

Posted
11 minutes ago, Subz said:

You know you could just use RunWait() and silent switches for the installs?  For example Winrar.exe /S, just search for <product> silent install in Google.

My TL required every thing should display graphically, so i have chosen GUI...

Posted

Would recommend trying to find or create an msi otherwise you're going to have a lot of issues using Send keys, you're script will be very sensitive, to mouse clicks, focus changing etc...

If you want to go down the Send path, I would recommend looking up ControlSend function the help file.  You should use WinWait between windows rather than Sleep(300) as 300ms could be a hit or miss.

Anyway - Good luck.

Posted
2 minutes ago, Subz said:

Would recommend trying to find or create an msi otherwise you're going to have a lot of issues using Send keys, you're script will be very sensitive, to mouse clicks, focus changing etc...

If you want to go down the Send path, I would recommend looking up ControlSend function the help file.  You should use WinWait between windows rather than Sleep(300) as 300ms could be a hit or miss.

Anyway - Good luck.

Thanks for that ... As guided by you i ll use that options.. i ll let you know..

But my problem is with script where it was not responding if i skip one set up !!!

Posted

I would say the issue is probably related to WinWaitActive, the script will sit their waiting for that Window to appear, if it never appears the script will remain paused, so you'll need to have checks to see if the window exists for example:

Local $hWnd = WinWait($FFSetupWin, "", 5) ;~ Wait until window exists before continuing.
If $hWnd = 0 Then Return ;~ The Window didn't appear in the alotted time (5 seconds) so will return back to the main gui.

 

Posted
3 minutes ago, Subz said:

I would say the issue is probably related to WinWaitActive, the script will sit their waiting for that Window to appear, if it never appears the script will remain paused, so you'll need to have checks to see if the window exists for example:

Local $hWnd = WinWait($FFSetupWin, "", 5) ;~ Wait until window exists before continuing.
If $hWnd = 0 Then Return ;~ The Window didn't appear in the alotted time (5 seconds) so will return back to the main gui.

 

ill check this... Thanks

Posted

A good software installer can be found here:

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Easy to adopt :)
BTW: Please down shout !!!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
  • Recently Browsing   0 members

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