Jump to content

Creating an installer


trashy
 Share

Recommended Posts

I want to create an installer for Easy_DISM using AutoIt. The basic installer and a desktop shortcut not a problem. Win 8.1 and 10 to PIN to start is a different matter. I found this little snippet Pin a shortcut to StartMenu

@Subz you seem to be the man with the answers again, My Hero!

Time for work so won't get a chance to try this till tomorrow but will this work in both Windows 8.1 and 10?  I only have 2 or 3 programs to make shortcuts for, use the xml to arrange them and the powershell cmd to apply?

Link to comment
Share on other sites

Hey Trashy

Personally I would recommend InnoSetup for packaging a setup.exe, recommend using the Quick Start pack http://www.jrsoftware.org/isdl.php#qsp.  It's extremely easy to use and will create uninstall strings, an automatic uninstaller, shortcuts to the Start Menu, Desktop (you can make this optional).  This is the same software installer that AutoIT uses.

With regards to Pin shortcuts to menu, it's no longer supported in Windows 10, Microsoft view the pinned areas to be personal and have made it difficult to pin items.  In a company situation, you can use the PowerShell method for setting up a Windows build for deploying to staff, but would not recommend this for an installer.

Just my 2 cents.

Thanks

Link to comment
Share on other sites

Thanks Subz

I took a quick look at InnoSetup and thought I may end up going that route eventually, biggest reason because of uninstall. I just wanted to see what I could accomplish with Autoit. Place shortcut in appdata\microsoft\windows\startmenu and it shows up in all apps in windows 8.1. I didn't think it would be so difficult to pin to the start page.

Functions like Export ESD to WIM only available with DISM 10 make it necessary to have DISM 10 files available in Win 7 and 8.1. JFX has agreed to let me include GetWaikTools with Easy_DISM. This means I can fully automate the DISM 10 download and install process, only 10 mb download using GetWaik. I wanted to add the DISM download feature to the installer but no worries. 

Link to comment
Share on other sites

9 hours ago, Subz said:

Personally I would recommend InnoSetup for packaging a setup.exe, [...].  This is the same software installer that AutoIT uses.

No, AutoIt installer is made from NSIS.

 

Edited by jguinch
Link to comment
Share on other sites

@jguinch Sorry stand corrected

@trashy Its better to configure your installer, shortcuts, ini, exe files via InnoSetup, so that during uninstall it can remove them correctly, if you install them with AutoIT then they will remain after you uninstall.

One thing you need to check is compression, I have found that AutoIT scripts that use compression or are compressed with a third party tool are likely to get false positives from Virus Scanners.  So you may want to submit your exe after compilation along with the setup.exe to anti-virus companies.

InnoSetup.jpg

Link to comment
Share on other sites

Quote

Subz said:

Hey Trashy

Personally I would recommend InnoSetup for packaging a setup.exe,

 

I agree.  I used to add some style elements to the install dialog using the free ISSkin tool for Inno.  Also if you know Pascal you can do quite a bit with the Inno scripting if there is something not covered by other options.  Last time I tried the skin styler it added maybe 1/4 MB to the size of the installer.  It puts a Dll in the install folder to supply the customized resources.  You can easily delete the Dll when the install is done.  Very cool for a free installer.

 

Edited by MilesAhead
quote attribution added
Link to comment
Share on other sites

Thanks everyone

Just finished updating the installer I made with Autoit ( got a few people testing the new program layout ). Updated program Easy_DISM and created new app EZ Download DISM 10 to download and install Dism 10.

Installer

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Install Easy_DISM", 305, 163, 269, 126)
$Button1 = GUICtrlCreateButton("Install", 48, 72, 80, 25)
$Button2 = GUICtrlCreateButton("Cancel", 176, 72, 80, 25)
$Label1 = GUICtrlCreateLabel("Create Shortcuts", 112, 8, 83, 17)
$Checkbox1 = GUICtrlCreateCheckbox("DeskTop", 56, 32, 65, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox2 = GUICtrlCreateCheckbox("StartMenu", 184, 32, 65, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("After Install you may be prompted to install DISM 10 ", 32, 112, 249, 17)
$Label3 = GUICtrlCreateLabel("Windows 7 REQUIRED   Windows 8.1 RECOMMEND", 24, 136, 262, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Button2
            Exit
        Case $Button1
            If FileExists(@ProgramFilesDir & "\Easy_DISM") Then
                DirRemove(@ProgramFilesDir & "\Easy_DISM", 1)
            EndIf
            If Not FileExists(@ProgramFilesDir & "\Easy_DISM") Then
                DirCreate(@ProgramFilesDir & "\Easy_DISM")
            EndIf
            If FileExists(@HomeDrive & "\ProgramData\EZDISM\7z.exe") Then
                FileDelete(@HomeDrive & "\ProgramData\EZDISM\7z.exe")
            EndIf
            If FileExists(@HomeDrive & "\ProgramData\EZDISM\7z.dll") Then
                FileDelete(@HomeDrive & "\ProgramData\EZDISM\7z.dll")
            EndIf
            If FileExists(@HomeDrive & "\ProgramData\EZDISM\EZ_config.ini") Then
                FileDelete(@HomeDrive & "\ProgramData\EZDISM\EZ_config.ini")
            EndIf
            If FileExists(@HomeDrive & "\ProgramData\EZDISM\GetWaikTools.exe") Then
                FileDelete(@HomeDrive & "\ProgramData\EZDISM\GetWaikTools.exe")
            EndIf
            If FileExists(@HomeDrive & "\ProgramData\EZDISM\ReadME.txt") Then
                FileDelete(@HomeDrive & "\ProgramData\EZDISM\ReadME.txt")
            EndIf
            FileInstall("C:\Program Files\Easy_DISM 2\Easy_DISM.exe", @ProgramFilesDir & "\Easy_DISM\Easy_DISM.exe", 1)
            FileInstall("C:\Program Files\Easy_DISM 2\Easy_DISM_x64.exe", @ProgramFilesDir & "\Easy_DISM\Easy_DISM_x64.exe", 1)
            FileInstall("C:\Program Files\Easy_DISM 2\EZ Download DISM 10.exe", @ProgramFilesDir & "\Easy_DISM\EZ Download DISM 10.exe", 1)
            FileInstall("C:\Program Files\Easy_DISM 2\GetWaikTools.exe", @ProgramFilesDir & "\Easy_DISM\EGetWaikTools.exe", 1)
            If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
                If @OSArch = "x86" Then
                    FileCreateShortcut(@ProgramFilesDir & "\Easy_DISM\Easy_DISM.exe", @DesktopDir & "\Easy_DISM.exe")
                ElseIf @OSArch = "x64" Then
                    FileCreateShortcut(@ProgramFilesDir & "\Easy_DISM\Easy_DISM_x64.exe", @DesktopDir & "\Easy_DISM.exe")
                EndIf
            EndIf
            Run(@ProgramFilesDir & "Easy_DISM\EZ Download DISM 10.exe")
            Exit
    EndSwitch
WEnd

This will get the ball rolling. Already downloaded InnoSetup should be no prob, if there is "I'll be Back".

Link to comment
Share on other sites

  • 1 year later...

Hi,

I propose a solution to package an AutoIt application and create a Windows Installer with InnoSetup, as describe here : https://v20100v.github.io/autoit-gui-skeleton/documentation/creating-setup-package-autoit-application

Some great features have been implemented within :

  • Generate package (archive zip) and Windows setup.
  • Support internationalization (i18n).
  • Check if application is already install.
  • Configure additional messages in the setup like: license agreement, prerequisites and history project.
  • Add icons application into Windows start menu.
  • Launch custom command after the end of the installation.
  • Easy to customize and change graphic elements of the Windows installer (setup).

A Windows batch is used to generate the Windows Setup (create output temp directory, compilation Au3, copy assets, and make setup with ISS script)

AGS-package-and-deployment-process.gif

Have Fun,
++

Link to comment
Share on other sites

I tend to use my own "installer" wizard. I use it for a lot of single-purpose scripts (like clearing out temp files) because users are so familiar with that kind of interface. Here's the template that I start with. Note: It uses the "ExtMsgBox.au3" UDF by Mebla23.

One other thing. I tend to use variables for the sizing of the windows so that when I need to make the window a bit larger, I only have to change one variable and the rest are resized automatically. This is especially helpful because I don't have to go back and replace buttons or dividers positions.

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=img\icon.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_UseX64=N
#AutoIt3Wrapper_Res_Description=description
#AutoIt3Wrapper_Res_Fileversion=2016.8.25.0
#AutoIt3Wrapper_Res_LegalCopyright=@ Something
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;================================================================================
; AutoIt Script                                         {filename}.au3
;
; Script that
;================================================================================

#NoTrayIcon
#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StringSize.au3>
#include <ExtMsgBox.au3>

;==============================================================================
; Globals
$theVersion = "2015.12.21"
$theFont = "Segoe UI"
$theFontSize = 11
$theBkColor = "0xF8F8F8"
$theButtonBarBkColor = BitXOR($theBkColor,"0x222222")
$theSource = @TempDir & __RandomTempFolder()
$thePrgName = "name"

; The form elements
$theFormWidth = 520
$theFormHeight = 370
$theTextMargin = 10
$theButtonWidth = 90
$theButtonHeight = 25
$theButtonVMargin = 8
$theButtonBarHeight = $theButtonHeight + 2 * $theButtonVMargin
$theButtonTop = $theFormHeight - $theButtonHeight - $theButtonVMargin
$theBannerWidth = 120
$theBannerHeight = $theFormHeight - $theButtonBarHeight
$theLeftMargin = $theBannerWidth + $theTextMargin
$theTitleTop = 10 ; Title is 10 from top, height of 30
$theMessageTop = 50 ; Message area is 10 from bottom of Title
$theMessageHeight = 100 ; Good first height
$theMessageWidth = $theFormWidth - $theLeftMargin - $theTextMargin
$theFirstLine = $theMessageTop + $theMessageHeight + 10
$theProgressLine = ($theFormHeight / 2) - 10
$theProgressWidth = $theFormWidth - ($theLeftMargin + (5 * $theTextMargin))

_ExtMsgBoxSet(-1,-1,$theBkColor,-1,$theFontSize,$theFont,$theFormWidth * 0.85,$theFormWidth)

__Initialize()

$frmMain = GUICreate($thePrgName,$theFormWidth,$theFormHeight)
GUISetBkColor($theBkColor,$frmMain)
GUISetFont($theFontSize,400,0,$theFont,$frmMain)
; Button bar
GUICtrlCreateGraphic(0,$theFormHeight - $theButtonBarHeight,$theFormWidth,$theButtonBarHeight)
GUICtrlSetBkColor(-1,$theButtonBarBkColor)
GUICtrlSetState(-1,$GUI_DISABLE)
GUICtrlCreatePic($theSource &"\reg.jpg",0,0,$theBannerWidth,$theBannerHeight)
$lblTitle = GUICtrlCreateLabel("",$theLeftMargin,$theTitleTop,$theMessageWidth,30)
GUICtrlSetFont(-1,$theFontSize * 1.6,800,2,$theFont)
; version
$u = _StringSize("v"& $theVersion,$theFontSize * 0.9,400,0,$theFont)
GUICtrlCreateLabel("v"& $theVersion,5,$theFormHeight - $u[3],$u[2],$u[3])
GUICtrlSetFont(-1,10,400,1,$theFont)
GUICtrlSetColor(-1,BitXOR($theButtonBarBkColor,"0x444444"))
GUICtrlSetBkColor(-1,$theButtonBarBkColor)

$lblMessage = GUICtrlCreateLabel("",$theLeftMargin,$theMessageTop,$theMessageWidth,$theMessageHeight)
;GUICtrlSetBkColor(-1,0x008800)
$prgStatus = GUICtrlCreateProgress($theLeftMargin + (2 * $theTextMargin),$theProgressLine,$theProgressWidth,20)
GUICtrlSetState(-1,$GUI_HIDE)

$btnCancel = GUICtrlCreateButton("Cancel",$theFormWidth - 100,$theButtonTop,$theButtonWidth,$theButtonHeight)
$btnNext = GUICtrlCreateButton("Next",$theFormWidth - 200,$theButtonTop,$theButtonWidth,$theButtonHeight)
$btnDone = GUICtrlCreateButton("Done",$theFormWidth - 200,$theButtonTop,$theButtonWidth,$theButtonHeight)
GUICtrlSetState(-1,$GUI_HIDE)

GUICtrlSetData($lblTitle,"Welcome")
GUICtrlSetData($lblMessage,"Welcome to the Outlook 365 Dynamics Fix. This will reset the Outlook 365 view to show Microsoft Dynamics. NOTE: You must close Outlook first!"& @CRLF & @CRLF &"Click the Next button to begin.")

GUISetState(@SW_SHOW,$frmMain)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            If _ExtMsgBox(32,"Yes|No",$thePrgName &" - Verify","Are you sure you want to exit?",0,$frmMain,0,False) = 1 Then
                ExitLoop
            EndIf
    Case $btnCancel
            If _ExtMsgBox(32,"Yes|No",$thePrgName &" - Verify","Are you sure you want to exit?",0,$frmMain,0,False) = 1 Then
                ExitLoop
            EndIf
    Case $btnNext
    Case $btnDone
      ExitLoop
  EndSwitch
WEnd

DirRemove($theSource,1)

Exit

;==============================================================================
;  Nothing beyond here except functions called above
;==============================================================================

;==============================================================================
; Function Name:   __RandomTempFolder()
;
; Creates a random temp folder to use while this is running in order to store
; any files needed and included in the script run
;==============================================================================
Func __RandomTempFolder()
  Local $f,$i,$c
  $f = "\~"
  For $i = 1 To 10
    $c = Random(97,122,1)
    $f = $f & Chr($c)
  Next
  Return $f
EndFunc ; ==> End of __RandomTempFolder

;==============================================================================
; Function Name:   __Intialize()
;
; This initializes all graphics for GUI items
;==============================================================================
Func __Initialize()
  Local $i,$j,$num,$type
  ; First check the temp folder existence
  If NOT FileExists($theSource) Then
    DirCreate($theSource)
  Endif
  FileInstall("C:\Program Files (x86)\AutoIt3\MyScripts\folder\img\jpg",$theSource &"\jpg",1)
EndFunc ; ==> End of __Initialize()

 

Who lied and told you life would EVER be fair?

Link to comment
Share on other sites

  • Moderators

benched42,

Quote

Mebla23

Having a dyslexic day?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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