Ok, going to try and post it again.... Last time it messed up somehow
I am sure that there is lots of room for improvement within this script..
Code:
;Script Options
Dim $Bitmap,$BitMapComp[2,1],$Count,$TimeOutComp[4],$element,$String1,$String2,$String3
Global $SO ;my throwaway variable to supress any screen output
If NOT @LOGONMODE
Break On
EndIf
$SO=SETOPTION("Explicit", "ON")
$SO=SETOPTION("NoMacrosInStrings", "ON")
$SO=SETOPTION("NoVarsInStrings", "ON")
$SO=SETOPTION("WrapAtEOL", "ON")
;*************************************************************************
$BitMapComp[0,0] = "\\.\"
$BitMapComp[0,1] = "LOCAL_SYSTEM_Bitmap"
$BitMapComp[1,0] = "\\sacs\"
$BitMapComp[1,1] = "REMOTE_SYSTEM_2K_Bitmap"
$BitMapComp[2,0] = "\\srdc\"
$BitMapComp[2,1] = "REMOTE_SYSTEM_XP_2K3_Bitmap"
$TimeOutComp = "srdc","sacs","sutil","svhost04","x019678"
$String1 = "The quick or was it now slow fox ran in the snow"
$String2 = "The snow in France is now gone but will return again next Winter"
$String3 = "There is now a slow return on investments at the bank"
;*************************************************************************
;Create INI file and add the first value to it
$SO = WriteProfileString(@scriptdir+"\KiX-Lesson03.ini","LESSON_03","LOCAL_SYSTEM_MAIN_PID",@PID)
;Launch a second instance of KiX and get the PID for it
;The Second script contains this line
;Exit @PID
Shell "..\kix32 Round3_2.Kix"
$SO = WriteProfileString(@scriptdir+"\KiX-Lesson03.ini","LESSON_03","LOCAL_SYSTEM_SECOND_PID",@Error)
;Get the BitMap Entries
For $count = 0 to Ubound($BitMapComp)
$SO = Bitmap($BitMapComp[$Count,0],$BitMapComp[$Count,1])
Next
;Get the timeout values
$Count = 1
For each $element in $TimeOutComp
Timeouts($Element,$Count)
$Count = $Count + 1
Next
;Get the requested String info
FindInString($String1,"Now",1)
FindInString($String2,"Now",2)
FindInString($String3,"Now",3)
Function Bitmap($Comp, $Value)
;Now we need the Bitmap value to add to the INI file
$Bitmap = Readvalue($Comp+"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder","Bitmap")
;And since we can not include any variables in the output
;Not sure about this part for the remote systems.... It appears to be working correctly
;However how does one know for sure?
$Bitmap = ExpandEnvironmentVars($Bitmap)
;And write it to the ini
$SO = WriteProfileString(@scriptdir+"\KiX-Lesson03.ini","LESSON_03",$Value,$Bitmap)
EndFunction
Function Timeouts($Comp,$Count)
Dim $Time,$Date,$DateSplit
;Get the Timeout Value from specified computer
$Time = ReadProfileString("\\"+$Comp+"\"+"C$\Boot.ini","Boot Loader","TimeOut")
;Get the last Modified time of the Boot.ini file
$Date = GetFileTime("\\"+$comp+"\"+"C$\Boot.ini")
;Split the string in half so we can rearrange to specifications
$Date = Split($Date," ")
;Split the date apart so that it can be rearranged
$DateSplit = Split($Date[0],"/")
;Rearrange the date and write it back to the same variable
$DateSplit = $DateSplit[1] + $DateSplit[2]+$DateSplit[0]
;Now make a single variable from the 2 in the specified format
$Date = $DateSplit + "-" + Join(Split($Date[1],":"),"")
;Write the information to the INI file
$SO = WriteProfileString(@scriptdir+"\KiX-Lesson03.ini","LESSON_03","REMOTE_"+$Comp+"_0"+$Count+"_TIMEOUT",$Time+" "+$date)
EndFunction
Function FindInString($StringToRead,$SearchPhrase,$Count)
Dim $Array[],$Position,$ActualValue
;Split up the string
$Array = Split($StringToRead," ")
;Look For the phrase that was passed
$Position = Ascan($Array,$SearchPhrase)
;Now that we know where the phrase is, Get the requested info
$ActualValue = Right($Array[$Position-1],1) + Left($Array[$Position+1],1)
;Write the information to the INI file
$SO = WriteProfileString(@scriptdir+"\KiX-Lesson03.ini","LESSON_03","RANDOM_STRING"+$Count,$ActualValue)
EndFunction
The INI file contents
Code:
[LESSON_03]
LOCAL_SYSTEM_MAIN_PID=3824
LOCAL_SYSTEM_SECOND_PID=3356
LOCAL_SYSTEM_Bitmap=C:\WINDOWS\system32\SHELL32.dll,4
REMOTE_SYSTEM_2K_Bitmap=C:\WINNT\system32\shell32.dll,4
REMOTE_SYSTEM_XP_2K3_Bitmap=C:\WINDOWS\system32\SHELL32.dll,4
REMOTE_srdc_01_TIMEOUT=5 03142006-142913
REMOTE_sacs_02_TIMEOUT=30 11102004-091359
REMOTE_sutil_03_TIMEOUT=7 10262004-152634
REMOTE_svhost04_04_TIMEOUT=30 04172006-144216
REMOTE_x019678_05_TIMEOUT=30 07262006-134701
RANDOM_STRING1=ts
RANDOM_STRING2=sg
RANDOM_STRING3=sa