Jump to content

Code not running


QOI
 Share

Recommended Posts

I'm really new to AutoIT but I have a bit of coding experience. I wrote this script to install some software that I have to install onto multiple machines. I have it on a USB and I'm planning to copy it onto the desktop as an .exe so it can install while I'm working on other computers. Every time I try to run it the script gets paused and I'm not sure what I am doing wrong.

Here are the files (they are too big to be attached) https://drive.google.com/drive/folders/1yyK7kwGBnTMIaplgoOkEkmqX11O0u853?usp=sharing

Link to comment
Share on other sites

  • Developers

You can simply just post the Script here in a codebox for starters:

This is all of it ...right?

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Fileversion=0.0.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <File.au3>

$cpu = @CPUArch
$os = @OSVersion
$restart = FileExists ( "restart.txt" )
$file_loc = "C:\Users\Administrator\Desktop\IBoss_Fix.exe"
$file_des = "C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
$framework = "Microsoft .NET Framework 4.5 Setup"
$powershell86 = "PowerShell 7x86 Setup"
$powershell64 = "PowerShell 7x64 Setup"

FileInstall ( "D:\Iboss_fix_Project\_SAA-Student-iBoss-cloud-Windows\install_ibsa.bat" , @ScriptDir )
FileInstall ( "D:\Iboss_fix_Project\_SAA-Student-iBoss-cloud-Windows\Win 7 prereq" , @ScriptDir )
FileInstall ("D:\Iboss_fix_Project\_SAA-Student-iBoss-cloud-Windows\msi_installers" , @ScriptDir )

If $restart = "1" Then
FileOpen ($framework)
ControlClick ($framework, "MICROSOFT SOFTWARE SUPPLEMENTAL LICENSE TERMS", 104)
ControlClick ($framework, "MICROSOFT SOFTWARE SUPPLEMENTAL LICENSE TERMS",  12324)
WinWait ( $framework, "Installation Is Complete")
ControlClick( $framework, "Installation Is Complete", 12325)
    If $cpu = "X86" Then
        FileOpen( "Win 7 prereq\PowerShell-7.0.3-win-x86.msi" )
        WinWait ( $powershell86 )
        ControlClick( $powershell86, "The Setup Wizard will install PowerShell 7-x86 on your computer. Click Next to continue or Cancel to exit the Setup Wizard." , 3470)
        ControlClick ( $powershell86, "Click Next to install to the default folder or click Change to choose another." , 3470)
        ControlClick ( $powershell86, "Initialization and Customization" , 3470)
        ControlClick ( $powershell86, "Ready to install PowerShell 7-x86", 3504)
        WinWait ( $powershell86, "Click the Finish button to exit the Setup Wizard." )
        ControlClick ( $powershell86, "Click the Finish button to exit the Setup Wizard.", 3409)
    Else
        FileOpen( "Win 7 prereq\PowerShell-7.0.3-win-x86.msi" )
        WinWait ( $powershell86 )
        ControlClick( $powershell64, "The Setup Wizard will install PowerShell 7-x64 on your computer. Click Next to continue or Cancel to exit the Setup Wizard." , 3470)
        ControlClick ( $powershell64, "Click Next to install to the default folder or click Change to choose another." , 3470)
        ControlClick ( $powershell64, "Initialization and Customization" , 3470)
        ControlClick ( $powershell64, "Ready to install PowerShell 7-x86", 3504)
        WinWait ( $powershell64, "Click the Finish button to exit the Setup Wizard." )
        ControlClick ( $powershell64, "Click the Finish button to exit the Setup Wizard.", 3409)
    EndIf

ElseIf $os = "WIN_7" Then
_FileCreate ("restart.txt")
FileMove ( $file_loc, $file_des )

    If $cpu = "X86" Then
        FileOpen ( "Win 7 prereq\1) Windows 7 Management Framework\Win7-KB3191566-x86\Win7-KB3191566-x86.msu" )
        WinWaitActive( "Windows Update Standalone Installer", "Yes" )
        ControlClick ( "Windows Update Standalone Installer", "Yes", 6)
        ControlClick ( "Download and Install Updates" , "I Accept" ,64409 )
        ControlClick ( "Download and Install Updates" , "Restart Now", 64421 )
    Else
        FileOpen ( "Win 7 prereq\1) Windows 7 Management Framework\Win7-KB3191566-x86\Win7AndW2K8R2-KB3191566-x64.msu" )
        WinWaitActive( "Windows Update Standalone Installer", "Yes" )
        ControlClick ( "Windows Update Standalone Installer", "Yes", 6)
        ControlClick ( "Download and Install Updates" , "I Accept" ,64409 )
        ControlClick ( "Download and Install Updates" , "Restart Now", 64421 )
        EndIf
    EndIf
FileOpen ( "install_ibsa.bat" )
Send ( "u {ENTER}" )
WinWaitActive ( "Internet Properties")
ControlClick ( "Internet Properties", " To set up an Internet connection, click Setup.", 1)
If $cpu = "X32" Then
    FileOpen ( "msi_installers\SAA-Stu-ibsa32.msi")
    WinWaitClose ( "IBSA")
Else
    FileOpen ( "msi_installers\SAA-Stu-ibsa64.msi")
    WinWaitClose ( "IBSA")
FileMove ($file_des, $file_loc)
EndIf

So what exactly is going wrong as I do not know what you mean by :

13 minutes ago, QOI said:

Every time I try to run it the script gets paused

You mean the script stop doing anything and seems to hang?

if so: Start with adding some debugging to see where it is hanging...eg: add this at the top of the script:

 Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info

Which allows you to hover the systemstray icon and see which line it is waiting/hanging.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Then you clicked it in stead of hover over it. ;) it as that would cause the pause to happen.  

Click the  tic mark before paused and the script will continue. Hover over the icon to see what line is being processed at that time.

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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