Jump to content
Sign in to follow this  
Janus

I am trying to make a open Source installer in autoit3

Recommended Posts

Janus

Hay

I am trying to make a Windows Installer in autoit3. My idear is to make a windows installer for web app. and or normal app.

The installer have to have the funktions listed:

- Create a IIS web

- List all Sites in IIS

- Delete a IIS site

- Download some files from ftp (Specifide in a text file)

- Use "Component Services" to reg. COM+ elements (for asp site VB COM) or other way

- List alle Component Services COM+ - elements

- Write som keys to the reg- database. (Listed in a text file)

Can someone help my some of the way here?

Thanks for a nice forum here

Best Reggards from

Janus S. Andersen

Share this post


Link to post
Share on other sites
Nahuel

You could start by showing us what you have done so far and telling us what your doubts or problems are <_< It'll make it a lot easier for everyone, I think.

Share this post


Link to post
Share on other sites
Janus

I have done the ftp part and the reg. database part (It is realy simpel)

But not the IIS part

and the COM + part

My problems are

- In the IIS the list all site, and to create a new site, and the rename a site

- In the COM+ (Component Services) registrationen to create a registrationen of a COM+ and set this to run with a user and a password.

I have tryed the WMIC (WMI) but I cant brake the ice here ! (maby it is not the way to do it)

Best Regards

Janus S. Andersen

Share this post


Link to post
Share on other sites
Janus

Thanks for all the help posted in this post.

I have made a COM+ installer and are using nsis installer to do the rest of the work for me.

My code is

Dim $packageName,$catalog,$packages,$putil,$numPackages,$i,$newPackage,$components, $util, $n, $dll_path, $strUsername,$strPassword 

#include <GUIConstants.au3>
Dim $brugernavn, $kodeord, $COMNavn, $dllsti

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=c:\documents and settings\tester\desktop\complus_gui.kxf
Global $AForm1 = GUICreate("COM plus installer", 547, 230, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "AForm1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "AForm1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "AForm1Restore")
Global $ALabel1 = GUICtrlCreateLabel("Brugernavn", 16, 48, 59, 17)
GUICtrlSetOnEvent($ALabel1, "ALabel1Click")
Global $AInput1 = GUICtrlCreateInput("", 96, 48, 329, 21)
GUICtrlSetOnEvent($AInput1, "AInput1Change")
GUICtrlSetTip($AInput1, "Brugernavn")
Global $ALabel2 = GUICtrlCreateLabel("Kodeord", 32, 80, 44, 17)
GUICtrlSetOnEvent($ALabel2, "ALabel2Click")
Global $AInput2 = GUICtrlCreateInput("", 96, 80, 329, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
GUICtrlSetOnEvent($AInput2, "AInput2Change")
GUICtrlSetTip($AInput2, "Kodeord")
Global $ALabel3 = GUICtrlCreateLabel("Sti til dll", 32, 112, 39, 17)
GUICtrlSetOnEvent($ALabel3, "ALabel3Click")
Global $AInput3 = GUICtrlCreateInput("", 96, 112, 329, 21)
GUICtrlSetOnEvent($AInput3, "AInput3Change")
GUICtrlSetTip($AInput3, "Sti til den dll fil der anvndes")
Global $AButton1 = GUICtrlCreateButton("Gennemse", 440, 112, 75, 25, 0)
GUICtrlSetOnEvent($AButton1, "AButton1Click")
GUICtrlSetTip($AButton1, "Åbner en dialog til at finde dll filen med")
Global $AInput4 = GUICtrlCreateInput("EposHR", 96, 144, 329, 21)
GUICtrlSetOnEvent($AInput4, "AInput4Change")
GUICtrlSetTip($AInput4, "Navn på pakken for dll COM+ elementet")
Global $AButton2 = GUICtrlCreateButton("Udfør", 168, 184, 75, 25, 0)
GUICtrlSetOnEvent($AButton2, "AButton2Click")
GUICtrlSetTip($AButton2, "Udør program")
Global $AButton3 = GUICtrlCreateButton("Fortryd", 272, 184, 75, 25, 0)
GUICtrlSetOnEvent($AButton3, "AButton3Click")
GUICtrlSetTip($AButton3, "Stop udførelsen af COM +")
Global $AEdit1 = GUICtrlCreateEdit("", 16, 8, 497, 25, $ES_WANTRETURN)
GUICtrlSetData($AEdit1, "Dette er et program til at installere COM+ med")
GUICtrlSetOnEvent($AEdit1, "AEdit1Change")
GUICtrlSetState($AEdit1, $GUI_DISABLE)
Global $Label1 = GUICtrlCreateLabel("COM + Navn", 8, 144, 66, 17)
GUICtrlSetOnEvent($Label1, "Label1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
ControlSetText("", "", $AInput1, "" & @UserName)
Send("{TAB}")
Dim $loop_status = 1

While 1
    Sleep(100)
    If $loop_status = 0 Then
        WinSetTrans("","",0)
        ProgressOn("Epos HR COM", "Status", "0 pct")
        ExitLoop
    EndIf
WEnd

Func AButton1Click()
    $message = "Vælg den mappe hvor dll filen ligger" 
    $dll_path = FileOpenDialog($message, @ScriptDir & "\", "Dll filer (*.dll)|Alle filer (*.*)", 1)
    If @error = 0 Then  ; Tjekker om der er valgt en fil eller cancel
        ControlSetText("", "", $AInput3, $dll_path)     ; Sætter den sti filen har samt filens navn
    EndIf

EndFunc   ;==>AButton1Click
Func AButton2Click()
;~  MsgBox(0, "", "Brugernavn:" & ControlGetText("", "", $AInput1) & @CRLF & "Kodeord:" & ControlGetText("", "", $AInput2) & @CRLF & "Sti til dll:" & ControlGetText("", "", $AInput3) & @CRLF & "COM+ navn:" & ControlGetText("", "", $AInput4))
    $strUsername = ControlGetText("", "", $AInput1)
    $strPassword = ControlGetText("", "", $AInput2)
    $dll_path = ControlGetText("", "", $AInput3)
    $packageName = ControlGetText("", "", $AInput4)

    $loop_status=0
EndFunc   ;==>AButton2Click
Func AButton3Click()
    Exit
EndFunc   ;==>AButton3Click
Func AEdit1Change()
    
EndFunc   ;==>AEdit1Change
Func AForm1Close()
    Exit
EndFunc   ;==>AForm1Close
Func AForm1Maximize()
    
EndFunc   ;==>AForm1Maximize
Func AForm1Minimize()
    
EndFunc   ;==>AForm1Minimize
Func AForm1Restore()
    
EndFunc   ;==>AForm1Restore
Func AInput1Change()
    
EndFunc   ;==>AInput1Change
Func AInput2Change()
    
EndFunc   ;==>AInput2Change
Func AInput3Change()
    
EndFunc   ;==>AInput3Change
Func AInput4Change()
    
EndFunc   ;==>AInput4Change
Func ALabel1Click()
    
EndFunc   ;==>ALabel1Click
Func ALabel2Click()
    
EndFunc   ;==>ALabel2Click
Func ALabel3Click()
    
EndFunc   ;==>ALabel3Click
Func Label1Click()
    
EndFunc   ;==>Label1Click

TrayTip("COM+ Installer", "Starter COM + ",60)
ProgressSet( 1, 1 & " pct")
;$packageName="EposHR"
$catalog=ObjCreate("MTSAdmin.Catalog.1")
TrayTip("COM+ Installer", "Opretter MTSAdmin.Catalog.1 ",60)
ProgressSet( 2, 2 & " pct")

$packages=$catalog.GetCollection("Packages")
TrayTip("COM+ Installer", "Henter Packages",60)
ProgressSet( 3, 3 & " pct")

$packages.populate
TrayTip("COM+ Installer", "Henter Packages interface",60)
ProgressSet( 4, 4 & " pct")

$putil = $packages.GetUtilInterface
TrayTip("COM+ Installer", "Henter antal Packages",60)
ProgressSet( 5, 5 & " pct")

;Remove all packages that go by the same name as the package we wish to uninstall
$numPackages = $packages.Count
;MsgBox(0,""&$numPackages,""&$numPackages)
ProgressSet( 6, 6 & " pct")

For $i = $numPackages - 1 To 0 Step -1
    TrayTip("COM+ Installer", "Gennem søger pakker for at finde den rigtige pakke : "&$i&" af "&$numPackages,60)

    If $packages.Item($i).Value("Name") = $packageName Then
        TrayTip("COM+ Installer", "Pakke fundet : "&$i&" af "&$numPackages&" pakke slette osv.",60)
        ;WScript.Echo("Stopper pakken: " & packageName )'& " ID " & packages.Item(i).Value("ID") & vbNewLine)
        $putil.ShutdownPackage($packages.Item($i).Value("ID"))
        ;'WScript.Echo("Shutdown done" &vbNewLine)
        ;WScript.Echo("Sletter objekter i pakken: " & packageName & vbNewLine)
        $packages.Remove ($i)
        ;'WScript.Echo("Remove done" &vbNewLine &vbNewLine)
        ;' Commit our deletions
        $packages.savechanges
        ProgressSet( 7, 7 & " pct")
        ExitLoop
    EndIf
Next
TrayTip("COM+ Installer", "Sætter navn og andre oplysninger på COM+",60)
ProgressSet( 8, 8 & " pct")

;Install package
$newPackage = $packages.Add
$newPackage.Value("Name") = $packageName

$newPackage.Value("Identity") = $strUsername
$newPackage.Value("Password") = $strPassword

$newPackage.Value("SecurityEnabled") = "Y"
$newPackage.Value("ShutdownAfter") = "20"

TrayTip("COM+ Installer", "Gemmer data", 60)
; Commit new package
$packages.SaveChanges
ProgressSet( 9, 9 & " pct")

TrayTip("COM+ Installer", "Opdatere pakker", 60)

; Refresh packages
$packages.Populate

; Get components collection for new package
TrayTip("COM+ Installer", "Hent alle pakker igen",60)
ProgressSet( 10, 10 & " pct")

$components = $packages.GetCollection("ComponentsInPackage",$newPackage.Value("ID"))

; Install components
$util = $components.GetUtilInterface

; on error resume next
;$util.InstallComponent "C:\EposHR.dll", "", ""
TrayTip("COM+ Installer", "Installere dll fra den file der indeholder COM+", 60)
ProgressSet( 11, 11 & " pct (Dette step tager noget tid)")

$util.InstallComponent($dll_path, "", "")
ProgressSet( 50, 50 & " pct")

$components.SaveChanges
TrayTip("COM+ Installer", "Gemmer ændringerne",60)
$components.Populate
TrayTip("COM+ Installer", "Tilføjer metoder mm.",60)

$n = $Components.Count
TrayTip("COM+ Installer", "COM+ Antal Elementer : "&$n,60)
ProgressSet( 90, 90 & " pct")
ProgressOff()

MsgBox(0,"Antal elementer installeret : "&$n,"Antal elementer "&$n&" installeret"&@CRLF&"Valider dette tal ikke er 0",30)
ProgressOn("Epos HR COM", "Status", "100 pct")

$components.SaveChanges
ProgressSet( 100, 100 & " pct")
Sleep(2000)
Thanks for all the help in this post.

Best Regards from

Janus S. Andersen

Denmark

Share this post


Link to post
Share on other sites
Janus

A script to find a COM+ and delete it and the create it. The COM element is run with a user from the server.

Dim $packageName,$catalog,$packages,$putil,$numPackages,$i,$newPackage,$components, $util, $n, $dll_path, $strUsername,$strPassword,$file,$search 

#include <GUIConstants.au3> 
Dim $brugernavn, $kodeord, $COMNavn, $dllsti
 
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=c:\documents and settings\tester\desktop\complus_gui.kxf\\\\
Global $AForm1 = GUICreate("COM plus installer", 547, 230, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "AForm1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "AForm1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "AForm1Restore")
Global $ALabel1 = GUICtrlCreateLabel("Brugernavn", 16, 48, 59, 17)
GUICtrlSetOnEvent($ALabel1, "ALabel1Click")
Global $AInput1 = GUICtrlCreateInput("", 96, 48, 329, 21)
GUICtrlSetOnEvent($AInput1, "AInput1Change")
GUICtrlSetTip($AInput1, "Brugernavn")
Global $ALabel2 = GUICtrlCreateLabel("Kodeord", 32, 80, 44, 17)
GUICtrlSetOnEvent($ALabel2, "ALabel2Click")
Global $AInput2 = GUICtrlCreateInput("", 96, 80, 329, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
GUICtrlSetOnEvent($AInput2, "AInput2Change")
GUICtrlSetTip($AInput2, "Kodeord")
Global $ALabel3 = GUICtrlCreateLabel("Sti til dll", 32, 112, 39, 17)
GUICtrlSetOnEvent($ALabel3, "ALabel3Click")
Global $AInput3 = GUICtrlCreateInput("", 96, 112, 329, 21)
GUICtrlSetOnEvent($AInput3, "AInput3Change")
GUICtrlSetTip($AInput3, "Sti til den dll fil der anvndes")
Global $AButton1 = GUICtrlCreateButton("Gennemse", 440, 112, 75, 25, 0)
GUICtrlSetOnEvent($AButton1, "AButton1Click")
GUICtrlSetTip($AButton1, "Åbner en dialog til at finde dll filen med")
Global $AInput4 = GUICtrlCreateInput("EposHR", 96, 144, 329, 21)
GUICtrlSetOnEvent($AInput4, "AInput4Change")
GUICtrlSetTip($AInput4, "Navn på pakken for dll COM+ elementet")
Global $AButton2 = GUICtrlCreateButton("Udfør", 168, 184, 75, 25, 0)
GUICtrlSetOnEvent($AButton2, "AButton2Click")
GUICtrlSetTip($AButton2, "Udør program")
Global $AButton3 = GUICtrlCreateButton("Fortryd", 272, 184, 75, 25, 0)
GUICtrlSetOnEvent($AButton3, "AButton3Click")
GUICtrlSetTip($AButton3, "Stop udførelsen af COM +")
Global $AEdit1 = GUICtrlCreateEdit("", 16, 8, 497, 25, $ES_WANTRETURN)
GUICtrlSetData($AEdit1, "Dette er et program til at installere COM+ med")
GUICtrlSetOnEvent($AEdit1, "AEdit1Change")
GUICtrlSetState($AEdit1, $GUI_DISABLE)
Global $Label1 = GUICtrlCreateLabel("COM + Navn", 8, 144, 66, 17)
GUICtrlSetOnEvent($Label1, "Label1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
ControlSetText("", "", $AInput1, "" & @UserName)
Send("{TAB}")
Dim $loop_status = 1

$search = FileFindFirstFile("*.dll")
$file = FileFindNextFile($search)
;~ MsgBox(4096, "File:"&@ScriptDir&"\"&$file, @ScriptDir&"\"&$file)
FileClose($search)

ControlSetText("", "", $AInput3, @ScriptDir&"\"&$file)  ; Sætter den sti filen har samt filens navn

While 1
    Sleep(100)
    If $loop_status = 0 Then
        WinSetTrans("","",0)
        ProgressOn("Epos HR COM", "Status", "0 pct")
        ExitLoop
    EndIf
WEnd

Func AButton1Click()
    $message = "Vælg den mappe hvor dll filen ligger" 
    $dll_path = FileOpenDialog($message, @ScriptDir & "\", "Dll filer (*.dll)|Alle filer (*.*)", 1)
    If @error = 0 Then  ; Tjekker om der er valgt en fil eller cancel
        ControlSetText("", "", $AInput3, $dll_path)     ; Sætter den sti filen har samt filens navn
    EndIf

EndFunc   ;==>AButton1Click
Func AButton2Click()
;~  MsgBox(0, "", "Brugernavn:" & ControlGetText("", "", $AInput1) & @CRLF & "Kodeord:" & ControlGetText("", "", $AInput2) & @CRLF & "Sti til dll:" & ControlGetText("", "", $AInput3) & @CRLF & "COM+ navn:" & ControlGetText("", "", $AInput4))
    $strUsername = ControlGetText("", "", $AInput1)
    $strPassword = ControlGetText("", "", $AInput2)
    $dll_path = ControlGetText("", "", $AInput3)
    $packageName = ControlGetText("", "", $AInput4)

    $loop_status=0
EndFunc   ;==>AButton2Click
Func AButton3Click()
    Exit
EndFunc   ;==>AButton3Click
Func AEdit1Change()
    
EndFunc   ;==>AEdit1Change
Func AForm1Close()
    Exit
EndFunc   ;==>AForm1Close
Func AForm1Maximize()
    
EndFunc   ;==>AForm1Maximize
Func AForm1Minimize()
    
EndFunc   ;==>AForm1Minimize
Func AForm1Restore()
    
EndFunc   ;==>AForm1Restore
Func AInput1Change()
    
EndFunc   ;==>AInput1Change
Func AInput2Change()
    
EndFunc   ;==>AInput2Change
Func AInput3Change()
    
EndFunc   ;==>AInput3Change
Func AInput4Change()
    
EndFunc   ;==>AInput4Change
Func ALabel1Click()
    
EndFunc   ;==>ALabel1Click
Func ALabel2Click()
    
EndFunc   ;==>ALabel2Click
Func ALabel3Click()
    
EndFunc   ;==>ALabel3Click
Func Label1Click()
    
EndFunc   ;==>Label1Click

TrayTip("COM+ Installer", "Starter COM + ",60)
ProgressSet( 1, 1 & " pct")
;$packageName="EposHR"
$catalog=ObjCreate("MTSAdmin.Catalog.1")
TrayTip("COM+ Installer", "Opretter MTSAdmin.Catalog.1 ",60)
ProgressSet( 2, 2 & " pct")

$packages=$catalog.GetCollection("Packages")
TrayTip("COM+ Installer", "Henter Packages",60)
ProgressSet( 3, 3 & " pct")

$packages.populate
TrayTip("COM+ Installer", "Henter Packages interface",60)
ProgressSet( 4, 4 & " pct")

$putil = $packages.GetUtilInterface
TrayTip("COM+ Installer", "Henter antal Packages",60)
ProgressSet( 5, 5 & " pct")

;Remove all packages that go by the same name as the package we wish to uninstall
$numPackages = $packages.Count
;MsgBox(0,""&$numPackages,""&$numPackages)
ProgressSet( 6, 6 & " pct")

For $i = $numPackages - 1 To 0 Step -1
    TrayTip("COM+ Installer", "Gennem søger pakker for at finde den rigtige pakke : "&$i&" af "&$numPackages,60)

    If $packages.Item($i).Value("Name") = $packageName Then
        TrayTip("COM+ Installer", "Pakke fundet : "&$i&" af "&$numPackages&" pakke slette osv.",60)
        ;WScript.Echo("Stopper pakken: " & packageName )'& " ID " & packages.Item(i).Value("ID") & vbNewLine)
        $putil.ShutdownPackage($packages.Item($i).Value("ID"))
        ;'WScript.Echo("Shutdown done" &vbNewLine)
        ;WScript.Echo("Sletter objekter i pakken: " & packageName & vbNewLine)
        $packages.Remove ($i)
        ;'WScript.Echo("Remove done" &vbNewLine &vbNewLine)
        ;' Commit our deletions
        $packages.savechanges
        ProgressSet( 7, 7 & " pct")
        ExitLoop
    EndIf
Next
TrayTip("COM+ Installer", "Sætter navn og andre oplysninger på COM+",60)
ProgressSet( 8, 8 & " pct")

;Install package
$newPackage = $packages.Add
$newPackage.Value("Name") = $packageName
$newPackage.Value("Description")="Dette er et COM element til EposHR som er en del af pbj program til styring af HR - systemet"

$newPackage.Value("Activation") = "Local"
$newPackage.Value("Identity") = $strUsername
$newPackage.Value("Password") = $strPassword

;$newPackage.Value("Identity") = "Interactive User"
;~ $newPackage.Value("Identity") = "This user:"

$newPackage.Value("SecurityEnabled") = "N"
$newPackage.Value("ShutdownAfter") = "20"

TrayTip("COM+ Installer", "Gemmer data", 60)
; Commit new package
$packages.SaveChanges; Her mangler nnoget hvis brugeren taster et forkert kodeord

ProgressSet( 9, 9 & " pct")

TrayTip("COM+ Installer", "Opdatere pakker", 60)

; Refresh packages
$packages.Populate

; Get components collection for new package
TrayTip("COM+ Installer", "Hent alle pakker igen",60)
ProgressSet( 10, 10 & " pct")

$components = $packages.GetCollection("ComponentsInPackage",$newPackage.Value("ID"))

; Install components
$util = $components.GetUtilInterface

; on error resume next
;$util.InstallComponent "C:\EposHR.dll", "", ""
TrayTip("COM+ Installer", "Installere dll fra den file der indeholder COM+", 60)
ProgressSet( 11, 11 & " pct (Dette step tager noget tid)")

$util.InstallComponent($dll_path, "", "")
ProgressSet( 50, 50 & " pct")

$components.SaveChanges
TrayTip("COM+ Installer", "Gemmer ændringerne",60)
$components.Populate
TrayTip("COM+ Installer", "Tilføjer metoder mm.",60)

$n = $Components.Count
TrayTip("COM+ Installer", "COM+ Antal Elementer : "&$n,60)
ProgressSet( 90, 90 & " pct")
ProgressOff()

MsgBox(0,"Antal elementer installeret : "&$n,"Antal elementer "&$n&" installeret"&@CRLF&"Valider dette tal ikke er 0",30)
ProgressOn("Epos HR COM", "Status", "100 pct")

$components.SaveChanges
ProgressSet( 100, 100 & " pct")
Sleep(2000)

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  

×