Jump to content

Application Installer Script


Recommended Posts

Now, before you open SciTe4AutoIt3, Crimson or Notepad, please don't try the script until I have tried it (my server has a faulty power cable - it falls out of the back. I did use elastic bands for 1/2 year, but they snapped). Could you just have a look at it and give me suggestions?

#NoTrayIcon
IniRead("C:\"&@ComputerName&".ini","Server","Addr",@ComputerName)
TCPStartup()
ProgressOn("Application installer","Contacting Server...","Sending messsage to server...")
$myTCP=TCPConnect(TCPNameToIP($Server),8353)
Sleep(1000)
TCPSend($myTCP,@ComputerName&"|StartingAI|")
$datesSvr=IniReadSectionNames("\\"&$server&"\Rels\Restricted\Ins.ini")
$lia=Number(IniRead("\\"&@ComputerName&"\Rels\Ins.ini","Kora","LIA","0"))
$cra=IniRead("\\"&$Server&"\Rels\Restricted\Ins.ini","Kora","IU","main.admin")
$crd=IniRead("\\"&$Server&"\Rels\Restricted\Ins.ini","Kora","ID",@Computername)
$crp=IniRead("\\"&$Server&"\Rels\Restricted\Ins.ini","Kora","IP","zvm4p6s")
Dim $s[$datesSvr[0]],$k
For $a=1 to $datesSvr

If Not $datesSvr[$a] = "Kora" Then
If Number($datesSvr[$a]) > $lia Then
ProgressSet(($datesSvr[0]/100)*$a,"Retrieving app list for "&$datesSvr[$a]&"...")
TCPSend($myTCP,@ComputerName&"|ProgressAI|"&String(($datesSvr[0]/100)*$a)&"|"&$datesSvr[$a])
$s[$a] = IniReadSection("\\"&$Server&"\Rels\Restricted\Ins.ini",$datesSvr[$a])
Else
ProgressSet(($datesSvr[0]/100)*a)
TCPSend($myTCP,@ComputerName&"|ProgressAI|"&String(($datesSvr[0]/100)*$a)&"|"&$datesSvr[$a])
EndIf
For $b=1 to $s[$a][0]
$k=$k&$s[$a][$b]&"|"
Next

EndIf
Next
$j=StringSplit($k,"|")
Dim $mb[$j[0]+1][3]
For $c=1 to $j[0]
$mb[$c][0]=IniRead("\\"&$Server&"\Rels\Restricted\Ins.ini",$j[$c],"Appname",$j[$c])
ProgressSet(($j[0]/100)*$c,"Retrieving install information for "&$mb[$c][0]&"...")
TCPSend($myTCP,@ComputerName&"|ProgressAI|"&String(($datesSvr[0]/100)*$a)&"|"&$mb[$c][0])
$mb[$c][1]=IniRead("\\"&$Server&"\Rels\Restricted\Ins.ini",$j[$c],"Appipath","\\"&$Server&"\Setup\"&$mb[$c][0]&"\Igo.exe")
$mb[$c][2]=IniRead("\\"&$Server&"\Rels\Restricted\Ins.ini",$j[$c],"Appdesc","No other details come with this application")
Next
ProgressSet(0,"Initialising...","Installing...")
$ProgressPos=WinGetPos("Application Installer","Installing...")
SplashTextOn("Application Installer","Please wait while the Application Installer prepares for install...",$ProgressPos[2],$ProgressPos[3],$ProgressPos[0],$ProgressPos[1]+$ProgressPos[3],36)
RunAsSet($cra,$crd,$crp)
For $gs=1 to $j[0]
ProgressSet(($j[0]/100)*$gs,$mb[$gs][0])
ControlSetText("Application Installer","","Label1","Installing "&$mb[$gs][0]&@CRLF&$mb[$gs][2])
TCPSend($myTCP,@ComputerName&"|ProgressAI|"&String(($j[0]/100)*$gs)&"|"&$mb[$gs][0])
RunWait($mb[$gs][1])
ControlSetText("Application Installer","","Label1","Completed installation!")
Sleep(1000)
Next
TCPSend($myTCP,@ComputerName&"|ProgressAI|"&100&"|Done, restarting...")

IniWrite("\\"&@ComputerName&"\Rels\Ins.ini","Kora","LIA",String(@YEAR)&String(@MON)&String(@MDAY))
If $j[0] > 0 Then
Shutdown(2)
EndIf
TCPCloseSocket($myTCP)
TCPShutdown()
Exit

The first INI file mentiond does not need to exist unless you wish to use this with a proper server. If you do, it is set out like this:

[server]

addr=<MY SERVER NAME>

The second needs to be shared as \Rels\Restricted\Ins.ini on the server if using the script with a server, or on your computer.

It is set out like this:

[kora]

IU=<ADMIN USER MUST BE ADMIN>

ID=<DOMAIN>;<--- Do not include if using on non-domain setup. COMMENT OUT!

IP=<ADMIN PASSWORD>

 

[<DATE CODE: YYYYMMDD>]

<APP CODE N EG. TheGuy0000-AI or AIScript or ArtIntell...>=blank

 

[<APP CODE N>]

Appname=TheGuy0000's Artificial Intelligence Script

Appipath=\\<MY SERVER NAME>\<PATH>\<FILE>.EXE

Appdesc=An Artificial Intelligence script written by TheGuy0000 on the AutoIt Forums

The third file needs to be writable and shared on the local computer. It simply needs the syntax of:

[kora]

LIA=0

Please reply with your thoughts on the coding of the script.

NOTE: I did mention that I did not request anybody to test it. IF YOU TEST THIS SCRIPT, IT IS AT YOUR OWN RISK. I cannot take responsibility for any loss or damage caused by this script.

[size="4"]YOU SHALL NOT PARSE!![/size]
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...