Jump to content

Need Help With Sending An Array To A Text File


Recommended Posts

does anyone know how to take information from an array to a text file? the idea is to have the following array spew out to a text file, which will be read by a flash file. the flash program is the front end of my application, and my autoit scripts are the backend. the following is the array:

#include <GUIConstants.au3>
#include <Array.au3>
Dim $diagnose[28]
Dim $n = 1
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB873333", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB885250", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB886185", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB888113", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB891781", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB893066", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896358", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896422", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896423", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896424", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896688", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896727", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899588", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899589", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB900725", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901017", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901214", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB902400", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB904706", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905414", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905915", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB910437", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB912919", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB908519", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901190", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB911927", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB913446", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB912812", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB908531", "Installed") Or 
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB911562", "Installed") then 
$diagnose[$n] = "Post Service Pack-2 Updates   Required"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\WINDOWS\Driver Cache\i386\sp2.cab") Then 
$diagnose[$n] = "WindowsXP Service Pack2       Required"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Cisco Systems\Clean Access Agent\CCAAgent.exe") then 
$diagnose[$n] = "Cisco Clean Access Agent     Required"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Symantec AntiVirus\VPTray.exe") then
$diagnose[$n] = "Norton Anti-Virus                Required"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Mozilla Firefox\firefox.exe") Then 
$diagnose[$n] = "Mozilla Firefox                      Optional"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe") Then 
$diagnose[$n] = "Spy-Bot Search and Destroy Optional"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe") Then 
$diagnose[$n] = "Ad-Aware SE Personal         Optional"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Adobe\Acrobat 7.0\Reader") Then
$diagnose[$n] = "Adobe Acrobat Reader 7.0    Optional"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Trillian\trillian.exe") Then 
$diagnose[$n] = "Trillian Instant Messenger   Optional"
$n = $n + 1
EndIf

I would really appreciate any input/advice on how to make this work. The flash program is supposed to read and display the text file(which will be deleted when the program quits. The array is a scanner that displays what the user needs on their machine.

"I wish I could say something that was classy and inspirational, but that just wouldn't be our style. Pain heals. Chicks dig scars. Glory lasts forever." - Shane Falco, The Replacements

Link to comment
Share on other sites

I have not read you script but from the description you could use _ArrayToClip and then ClipGet to paste into a file.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

HI,

does FileReadtoArray / FileWriteFromArray help?

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

HI,

does FileReadtoArray / FileWriteFromArray help?

So long,

Mega

would that be a user defined function? I'm having trouble finding FileWriteFromArray. If that exists/works that would probably be good, but I don't see it anywhere. Is it in the help file?

"I wish I could say something that was classy and inspirational, but that just wouldn't be our style. Pain heals. Chicks dig scars. Glory lasts forever." - Shane Falco, The Replacements

Link to comment
Share on other sites

would that be a user defined function? I'm having trouble finding FileWriteFromArray. If that exists/works that would probably be good, but I don't see it anywhere. Is it in the help file?

Hi,

I think you need beta and then search for _FileWriteFromArray().

Good luck!

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • Moderators

I saw a duplicate there in your RegRead:

NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") Or

NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") Or

Try this and see if it helps:
Dim $diagnose[28], $n = 1, $FileLocation = 'Location Of File To Write To'
Local $RegRead[32] = ['', 'KB873333', 'KB885250', 'KB886185', 'KB888113', 'KB891781', 'KB893066', 'KB896358', 'KB896422', _
        'KB896423', 'KB896424', 'KB896688', 'KB896727', 'KB899588', 'KB899589', 'KB900725', 'KB901017', 'KB901214', _
        'KB902400', 'KB904706', 'KB905414', 'KB905749', 'KB905915', 'KB910437', 'KB912919', 'KB908519', 'KB901190', _
        'KB911927', 'KB913446', 'KB912812', 'KB908531', 'KB911562']
For $RegCount = 1 To UBound($RegRead) - 1
    If Not RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\' & $RegRead[$RegCount], 'Installed') Then
        $diagnose[$n] = "Post Service Pack-2 Updates   Required"
        $n = $n + 1
        ExitLoop
    EndIf
Next
Sleep(200)
If Not FileExists("C:\WINDOWS\Driver Cache\i386\sp2.cab") Then
    $diagnose[$n] = "WindowsXP Service Pack2       Required"
    $n = $n + 1
EndIf
Sleep(200)
If Not FileExists("C:\Program Files\Cisco Systems\Clean Access Agent\CCAAgent.exe") Then
    $diagnose[$n] = "Cisco Clean Access Agent     Required"
    $n = $n + 1
EndIf
Sleep(200)
If Not FileExists("C:\Program Files\Symantec AntiVirus\VPTray.exe") Then
    $diagnose[$n] = "Norton Anti-Virus                Required"
    $n = $n + 1
EndIf
Sleep(200)
If Not FileExists("C:\Program Files\Mozilla Firefox\firefox.exe") Then
    $diagnose[$n] = "Mozilla Firefox                      Optional"
    $n = $n + 1
EndIf
Sleep(200)
If Not FileExists("C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe") Then
    $diagnose[$n] = "Spy-Bot Search and Destroy Optional"
    $n = $n + 1
EndIf
Sleep(200)
If Not FileExists("C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe") Then
    $diagnose[$n] = "Ad-Aware SE Personal         Optional"
    $n = $n + 1
EndIf
Sleep(200)
If Not FileExists("C:\Program Files\Adobe\Acrobat 7.0\Reader") Then
    $diagnose[$n] = "Adobe Acrobat Reader 7.0    Optional"
    $n = $n + 1
EndIf
Sleep(200)
If Not FileExists("C:\Program Files\Trillian\trillian.exe") Then
    $diagnose[$n] = "Trillian Instant Messenger   Optional"
    $n = $n + 1
EndIf

$FileOpen = FileOpen($FileLocation, 2); Look at file open, 2 erases everything, I imagine that's what you want.
For $FileWriteCount = 1 To 27; 27 being the number of elements in the $diagnose array
    If $diagnose[$FileWriteCount] <> '' Then; Make sure your only writing info you need
        FileWriteLine($FileOpen, $diagnose[$FileWriteCount])
    EndIf
Next
FileClose($FileOpen); Close the FileOpen handle
The array I'm using for $RegRead[] requires Beta.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

okay, I found the function in Beta, but can anyone tell me if this array can work like this?

#include <GUIConstants.au3>
#include <Array.au3>
Dim $diagnose[28]
Dim $n = 1
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB873333", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB885250", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB886185", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB888113", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB891781", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB893066", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896358", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896422", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896423", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896424", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896688", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896727", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899588", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899589", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB900725", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901017", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901214", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB902400", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB904706", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905414", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905915", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB910437", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB912919", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB908519", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901190", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB911927", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB913446", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB912812", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB908531", "Installed") Or
NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB911562", "Installed") then
$diagnose[$n] = "Post Service Pack-2 Updates   Required"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\WINDOWS\Driver Cache\i386\sp2.cab") Then
$diagnose[$n] = "WindowsXP Service Pack2       Required"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Cisco Systems\Clean Access Agent\CCAAgent.exe") then
$diagnose[$n] = "Cisco Clean Access Agent     Required"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Symantec AntiVirus\VPTray.exe") then
$diagnose[$n] = "Norton Anti-Virus                Required"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Mozilla Firefox\firefox.exe") Then
$diagnose[$n] = "Mozilla Firefox                      Optional"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe") Then
$diagnose[$n] = "Spy-Bot Search and Destroy Optional"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe") Then
$diagnose[$n] = "Ad-Aware SE Personal         Optional"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Adobe\Acrobat 7.0\Reader") Then
$diagnose[$n] = "Adobe Acrobat Reader 7.0    Optional"
$n = $n + 1
EndIf
Sleep (200)
If NOT FileExists ("C:\Program Files\Trillian\trillian.exe") Then
$diagnose[$n] = "Trillian Instant Messenger   Optional"
$n = $n + 1
EndIf

for the first section of it, all the regread's for windows updates, I want it to display that one line,

Post Service Pack-2 Updates   Required/[code=auto:0] if any of the windows updates aren't there. I want that one group of regread's to be a single entry in the array, and it seems that I can't use Or in the manner that I am. anyone have any suggestions?

"I wish I could say something that was classy and inspirational, but that just wouldn't be our style. Pain heals. Chicks dig scars. Glory lasts forever." - Shane Falco, The Replacements

Link to comment
Share on other sites

  • Moderators

This could work too (Also requires Beta) but I have no way of tesing it, it's your script just cut down a tad:

Dim $FileLocation = 'Location Of File To Write To'
Dim $RegRead[32] = ['', 'KB873333', 'KB885250', 'KB886185', 'KB888113', 'KB891781', 'KB893066', 'KB896358', 'KB896422', _
        'KB896423', 'KB896424', 'KB896688', 'KB896727', 'KB899588', 'KB899589', 'KB900725', 'KB901017', 'KB901214', _
        'KB902400', 'KB904706', 'KB905414', 'KB905749', 'KB905915', 'KB910437', 'KB912919', 'KB908519', 'KB901190', _
        'KB911927', 'KB913446', 'KB912812', 'KB908531', 'KB911562']
Dim $FileExists[10] = ['', False, FileExists(@WindowsDir & '\Driver Cache\i386\sp2.cab'), FileExists(@ProgramFilesDir & '\Cisco Systems\Clean Access Agent\CCAAgent.exe'), _
        FileExists(@ProgramFilesDir & '\Symantec AntiVirus\VPTray.exe'), FileExists(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe'), _
        FileExists(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe'), FileExists(@ProgramFilesDir & '\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe'), _
        FileExists(@ProgramFilesDir & '\Adobe\Acrobat 7.0\Reader'), FileExists(@ProgramFilesDir & '\Trillian\trillian.exe')]
Dim $Diagnose[10] = ['', '', 'WindowsXP Service Pack2' & @TAB & 'Required', 'Cisco Clean Access Agent' & @TAB & 'Required', 'Norton Anti-Virus' & @TAB & @TAB & 'Required', _
        'Mozilla Firefox' & @TAB & @TAB & @TAB & 'Optional', 'Spy-Bot Search and Destroy' & @TAB & 'Optional', 'Ad-Aware SE Personal' & @TAB & @TAB & 'Optional', _
        'Adobe Acrobat Reader 7.0' & @TAB & 'Optional', 'Trillian Instant Messenger' & @TAB & 'Optional']

For $RegCount = 1 To UBound($RegRead) - 1
    If Not RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\' & $RegRead[$RegCount], 'Installed') Then
        $FileExists[1] = True
        $Diagnose[1] = 'Post Service Pack-2 Updates' & @TAB & 'Required'
        ExitLoop
    EndIf
Next

$FileOpen = FileOpen($FileLocation, 2); Look at file open, 2 erases everything, I imagine that's what you want.
For $FileWriteCount = 1 To UBound($FileExists) - 1
    If $FileExists[$FileWriteCount] Then FileWriteLine($FileOpen, $Diagnose[$FileWriteCount])
Next
FileClose($FileOpen); Close the FileOpen handle

Edit:

Still had your $n = $n + 1 in there.

Edit2:

Found an error with one of the FileExists(), should work now.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

This could work too (Also requires Beta) but I have no way of tesing it, it's your script just cut down a tad:

CODE
Dim $FileLocation = 'Location Of File To Write To'

Dim $RegRead[32] = ['', 'KB873333', 'KB885250', 'KB886185', 'KB888113', 'KB891781', 'KB893066', 'KB896358', 'KB896422', _

'KB896423', 'KB896424', 'KB896688', 'KB896727', 'KB899588', 'KB899589', 'KB900725', 'KB901017', 'KB901214', _

'KB902400', 'KB904706', 'KB905414', 'KB905749', 'KB905915', 'KB910437', 'KB912919', 'KB908519', 'KB901190', _

'KB911927', 'KB913446', 'KB912812', 'KB908531', 'KB911562']

Dim $FileExists[10] = ['', False, FileExists(@WindowsDir & '\Driver Cache\i386\sp2.cab'), FileExists(@ProgramFilesDir & 'Cisco Systems\Clean Access Agent\CCAAgent.exe'), _

FileExists(@ProgramFilesDir & '\Symantec AntiVirus\VPTray.exe'), FileExists(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe'), _

FileExists(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe'), FileExists(@ProgramFilesDir & '\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe'), _

FileExists(@ProgramFilesDir & '\Adobe\Acrobat 7.0\Reader'), FileExists(@ProgramFilesDir & '\Trillian\trillian.exe')]

Dim $Diagnose[10] = ['', '', 'WindowsXP Service Pack2' & @TAB & 'Required', 'Cisco Clean Access Agent' & @TAB & 'Required', 'Norton Anti-Virus' & @TAB & @TAB & 'Required', _

'Mozilla Firefox' & @TAB & @TAB & @TAB & 'Optional', 'Spy-Bot Search and Destroy' & @TAB & 'Optional', 'Ad-Aware SE Personal' & @TAB & @TAB & 'Optional', _

'Adobe Acrobat Reader 7.0' & @TAB & 'Optional', 'Trillian Instant Messenger' & @TAB & 'Optional']

For $RegCount = 1 To UBound($RegRead) - 1

If Not RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\' & $RegRead[$RegCount], 'Installed') Then

$FileExists[1] = True

$Diagnose[1] = 'Post Service Pack-2 Updates' & @TAB & 'Required'

ExitLoop

EndIf

Next

$FileOpen = FileOpen($FileLocation, 2); Look at file open, 2 erases everything, I imagine that's what you want.

For $FileWriteCount = 1 To UBound($FileExists) - 1

If $FileExists[$FileWriteCount] Then FileWriteLine($FileOpen, $Diagnose[$FileWriteCount])

Next

FileClose($FileOpen); Close the FileOpen handle

Edit:

Still had your $n = $n + 1 in there.

Like SmOke_N, I have a favored technique for arrays like this. The point of my technique is to be easily updated later. The _AddArray() lines can be easily added, deleted, or edited as time goes by, and the arrays are automaticly sized correctly and still work as before. The following is your script tuned for easy maintenance:

#include <array.au3>

_SetupArrays()

For $n = 1 To $PostSP2Updates[0]
    If Not RegRead($PostSP2Updates[$n], "Installed") Then
        _ArrayAdd($diagnose, "Post Service Pack-2 Updates   Required")
        ExitLoop
    EndIf
Next

For $n = 1 To $CheckFiles[0]
    $SplitTemp = StringSplit($CheckFiles[$n], ",")
    If Not FileExists($SplitTemp[1]) Then _ArrayAdd($diagnose, $SplitTemp[2])
Next

_ArrayDisplay($diagnose, "Diagnostic Results")

; -------------------------------------------------------------------
;   Local Functions
; -------------------------------------------------------------------
; Setup Arrays Function
Func _SetupArrays()
; Array of diagnostic results
    Global $diagnose[1] = [0]
    
; Array of Post-SP2 Update reg keys to check
    Global $PostSP2Updates[1]
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB873333")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB885250")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB886185")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB888113")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB891781")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB893066")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896358")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896422")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896423")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896424")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896688")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896727")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899588")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899589")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB900725")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901017")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901214")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB902400")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB904706")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905414")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905915")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB910437")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB912919")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB908519")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901190")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB911927")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB913446")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB912812")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB908531")
    _ArrayAdd($PostSP2Updates, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB911562")
    $PostSP2Updates[0] = UBound($PostSP2Updates) - 1
    
; Array of files to check for existence, and associated update (comma delimited)
    Global $CheckFiles[1]
    _ArrayAdd($CheckFiles, '"C:\WINDOWS\Driver Cache\i386\sp2.cab","WindowsXP Service Pack2    Required"')
    _ArrayAdd($CheckFiles, '"C:\Program Files\Cisco Systems\Clean Access Agent\CCAAgent.exe","Cisco Clean Access Agent    Required"')
    _ArrayAdd($CheckFiles, '"C:\Program Files\Symantec AntiVirus\VPTray.exe","Norton Anti-Virus               Required"')
    _ArrayAdd($CheckFiles, '"C:\Program Files\Mozilla Firefox\firefox.exe","Mozilla Firefox                   Optional"')
    _ArrayAdd($CheckFiles, '"C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe","Spy-Bot Search and Destroy   Optional"')
    _ArrayAdd($CheckFiles, '"C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe","Ad-Aware SE Personal       Optional"')
    _ArrayAdd($CheckFiles, '"C:\Program Files\Adobe\Acrobat 7.0\Reader","Adobe Acrobat Reader 7.0    Optional"')
    _ArrayAdd($CheckFiles, '"C:\Program Files\Trillian\trillian.exe","Trillian Instant Messenger      Optional"')
    $CheckFiles[0] = UBound($CheckFiles) - 1
    
; Temp array of string splits
    Global $SplitTemp[1]
EndFunc  ;==>_SetupArrays

Just another way to skin that cat... :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

Cat don't have much skin left for sure lol... but out of curiousity, what does the _ArrayAdd() do that the Beta way of creating arrays doesn't provide

Dim $Array[2] = ['', 1];example only
, that if I wanted to change the 1st elements values, I could just remove the 1 and put what I needed?

I guess one advantage is not having to physically declare the number of elements?

Just seems like alot more code... but both meet at the same point so it's nice to see different alternatives :).

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

okay, let me re-iterate what I'm trying to do. first off, here's my original code, from an autoitv3 coded gui for my application, that started off with a progress bar scan, then displayed the results of the scan in the main gui. I want to have a similar effect with my flash interface(minus the pop-up progress bar), to have the scan occur before the application opens up, and then display the results of the scan(the whole point of thise thread) within the flash application. the flash app is supposed to read the results from a text file, from which the array is to be written to. Sorry if I might have confused anyone earlier with my intentions. I've tried the code you all have graciously provided but I get expression errors with all of them. so, here is the code of the autoit coded gui app w/ the scan:

#include <GUIConstants.au3>
#include <Array.au3>
Dim $diagnose[28]
Dim $n = 1
ProgressOn ("Now Diagnosing...","Please wait for the scan to finish")
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB873333", "Installed") then
$diagnose[$n] = "Windows Update KB873333       Required"
$n = $n + 1
EndIf
ProgressSet (4)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB885250", "Installed") then 
$diagnose[$n] = "Windows Update KB885250       Required"
$n = $n + 1
EndIf
ProgressSet (8)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB886185", "Installed") then 
$diagnose[$n] = "Windows Update KB886185       Required"
$n = $n + 1
EndIf
ProgressSet (12)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB888113", "Installed") then 
$diagnose[$n] = "Windows Update KB888113       Required"
$n = $n + 1
EndIf
ProgressSet (16) 
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB891781", "Installed") then 
$diagnose[$n] = "Windows Update KB891781       Required"
$n = $n + 1
EndIf
ProgressSet (20)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB893066", "Installed") then 
$diagnose[$n] = "Windows Update KB893066       Required"
$n = $n + 1
EndIf
ProgressSet (24)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896358", "Installed") then 
$diagnose[$n] = "Windows Update KB896358       Required"
$n = $n + 1
EndIf
ProgressSet (28)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896422", "Installed") then 
$diagnose[$n] = "Windows Update KB896422       Required"
$n = $n + 1
EndIf
ProgressSet (32)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896423", "Installed") then 
$diagnose[$n] = "Windows Update KB896423       Required"
$n = $n + 1
EndIf
ProgressSet (36)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896424", "Installed") then 
$diagnose[$n] = "Windows Update KB896424       Required"
$n = $n + 1
EndIf
ProgressSet (40)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896688", "Installed") then 
$diagnose[$n] = "Windows Update KB896688       Required"
$n = $n + 1
EndIf
ProgressSet (43)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896727", "Installed") then 
$diagnose[$n] = "Windows Update KB896727       Required"
$n = $n + 1
EndIf
ProgressSet (45)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899588", "Installed") then 
$diagnose[$n] = "Windows Update KB899588       Required"
$n = $n + 1
EndIf
ProgressSet (47)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899589", "Installed") then 
$diagnose[$n] = "Windows Update KB899589       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (50)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB900725", "Installed") then 
$diagnose[$n] = "Windows Update KB900725       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (54)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901017", "Installed") then 
$diagnose[$n] = "Windows Update KB901017       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (57)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901214", "Installed") then 
$diagnose[$n] = "Windows Update KB901214       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (61)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB902400", "Installed") then 
$diagnose[$n] = "Windows Update KB902400       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (64)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB904706", "Installed") then 
$diagnose[$n] = "Windows Update KB904706       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (68)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905414", "Installed") then 
$diagnose[$n] = "Windows Update KB905414       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (71)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then 
$diagnose[$n] = "Windows Update KB905749       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (75)
If NOT FileExists ("C:\Program Files\Symantec AntiVirus\VPTray.exe") then
$diagnose[$n] = "Norton Anti-Virus           Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (82)
If NOT FileExists ("C:\Program Files\Cisco Systems\Clean Access Agent\CCAAgent.exe") then 
$diagnose[$n] = "Cisco Clean Access Agent     Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (86)
If NOT FileExists ("C:\Program Files\Mozilla Firefox\firefox.exe") Then 
$diagnose[$n] = "Mozilla Firefox               Optional"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (89)
If NOT FileExists ("C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe") Then 
$diagnose[$n] = "Spy-Bot Search and Destroy Optional"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (93)
If NOT FileExists ("C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe") Then 
$diagnose[$n] = "Ad-Aware SE Personal         Optional"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (96)
If NOT FileExists ("C:\WINDOWS\Driver Cache\i386\sp2.cab") Then 
$diagnose[$n] = "WindowsXP Service Pack2       Required"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (97)
If NOT FileExists ("C:\Program Files\Adobe\Acrobat 7.0\Reader") Then
$diagnose[$n] = "Adobe Acrobat Reader 7.0     Optional"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (98)
If NOT FileExists ("C:\Program Files\Trillian\trillian.exe") Then 
$diagnose[$n] = "Trillian Instant Messenger Optional"
$n = $n + 1
EndIf
Sleep (200)
ProgressSet (100)
ProgressOff()

DirCreate ("C:\Ubertor Patch")
DirCreate ("C:\WINDOWS\system32\oobe\images\IMT")
GUICreate("The RezNet Setup Application",640,480) ; will create a dialog box that when displayed is centered
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\imtlogo.jpg", "C:\WINDOWS\system32\oobe\images\IMT\imtlogo.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\HelpFile.html", "C:\Ubertor Patch\HelpFile.html")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\Updating_Symantec_Antivirus.html", "C:\Ubertor Patch\Updating_Symantec_Antivirus.html")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\start.jpg", "C:\Ubertor Patch\start.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\end.jpg", "C:\Ubertor Patch\end.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\finish.jpg", "C:\Ubertor Patch\finish.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\LiveUpdate.jpg", "C:\Ubertor Patch\LiveUpdate.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\main.jpg", "C:\Ubertor Patch\main.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\tray.jpg", "C:\Ubertor Patch\tray.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\updating.jpg", "C:\Ubertor Patch\updating.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\windows.jpg", "C:\WINDOWS\system32\oobe\images\IMT\windows.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\symantec.jpg", "C:\WINDOWS\system32\oobe\images\IMT\symantec.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\firefox.jpg", "C:\WINDOWS\system32\oobe\images\IMT\firefox.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\ccaa.jpg", "C:\WINDOWS\system32\oobe\images\IMT\ccaa.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\sbsdlogo.jpg", "C:\WINDOWS\system32\oobe\images\IMT\sbsdlogo.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\adobereader.jpg", "C:\WINDOWS\system32\oobe\images\IMT\adobereader.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\trillian.jpg", "C:\WINDOWS\system32\oobe\images\IMT\trillian.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\adaware.jpg", "C:\WINDOWS\system32\oobe\images\IMT\adaware.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\apulogoteal.jpg", "C:\Windows\system32\oobe\images\IMT\apulogoteal.jpg")
FileInstall ("C:\Documents and Settings\Administrator\My Documents\Work\Ubertor Patch\bar.jpg", "C:\Windows\system32\oobe\images\IMT\bar.jpg")

GUISetFont(9, 300)
GUISetBkColor(0x415A57)
$tab=GUICtrlCreateTab (0,0,640,25)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0=GUICtrlCreateTabitem ("              Scan Results             ")
$tab0imtpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\imtlogo.jpg",320,26,320,237)
$tab0apupic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\apulogoteal.jpg",198,385,122,78)
$tab0scanlabel=GUICtrlCreateLabel ("The programs and updates that you need are listed below.",320,267,320,20)
GUICtrlSetColor (-1, 0xB1B1AD)

Local $List = ''
For $I = 1 To $N - 1
    $List = $List & $Diagnose[$I] & @CRLF
Next
$Font = "Times New Roman Bold"
$Tab0Edit = GUICtrlCreateEdit($List,320,285,320,152, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUICtrlSetColor (-1, 0xB1B1AD)
GUISetBkColor (-1, 0x415A57)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0ReScan=GUICtrlCreateButton ("Re-Scan",320,436,320,25,$BS_DEFPUSHBUTTON)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0InstructionsLabel=GUICtrlCreateLabel ("Instructions: PLEASE READ",1,26,320,20)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab0InstructionsLabel,15,450,0,$Font)
$tab0InfoLabel=GUICtrlCreateLabel ("This program gives you everything that you need to access the student networks here on campus. First, look at the list provided, and install any required updates and programs. The items that you must have are on the 'Required Updates and Programs' tab, while other items, that are important and/or useful, but not required, are on the 'Optional Programs' tab. Please read the information provided for the required programs for instruction. If you have any questions, please reference the Help File. If you require additional assistance, contact the Support Desk, as listed below.",0,48,320,450)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab0InfoLabel,11,150,0,$Font)
GUISetBkColor (-1, 0x415A57)
$tab0datelabel=GUICtrlCreateLabel ("The information contained in this CD is time sensitive. After Jan. 31st, this CD will not be guaranteed to have everything, but Clean Access will be able to give you anything else you need.",0,250,320,60)
$tab0SupportLabel=GUICtrlCreateLabel ("IMT Support Desk",0,308,320,20)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0PhoneLabel=GUICtrlCreateLabel("Phone: (626)815-5050",0,328,320,20)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0EmailLabel=GUICtrlCreateLabel("Email: support@apu.edu",0,348,320,20) 
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0MonLabel=GUICtrlCreateLabel ("Mon - Thur 7:00 AM to 10:00 PM",0,368,320,20) 
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0FriLabel=GUICtrlCreateLabel ("Fri 8:00 AM to 5:00 PM",0,388,320,20)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0SatLabel=GUICtrlCreateLabel ("Sat 12:00 PM to 6:00 PM",0,408,320,20)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab0SunLabel=GUICtrlCreatelabel ("Sun 2:00 PM to 8:00 PM",0,428,320,20)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab0SupportLabel,14,400,0,$Font)
GUICtrlSetFont ($tab0PhoneLabel,14,400,0,$Font)
GUICtrlSetFont ($tab0EmailLabel,14,400,0,$Font)
GUICtrlSetFont ($tab0MonLabel,14,400,0,$Font)
GUICtrlSetFont ($tab0FriLabel,14,400,0,$Font)
GUICtrlSetFont ($tab0SatLabel,14,400,0,$Font)
GUICtrlSetFont ($tab0SunLabel,14,400,0,$Font)


$tab1=GUICtrlCreateTabitem ("          Required Updates and Programs            ")
$tab1imtpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\imtlogo.jpg",320,26,320,237)
$tab1Edit = GUICtrlCreateEdit("",320,263,320,220,$ES_MULTILINE + $ES_AUTOVSCROLL + $WS_EX_TRANSPARENT)
GUISetBkColor (-1, 0x415A57)
GUICtrlSetColor (-1, 0xB1B1AD)

$tab1XPPatchLabel=GUICtrlCreateLabel ("1. Install Required Windows Updates",80,32,240,20,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab1XPPatchLabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab1windowspic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\windows.jpg",0,26,80,90)
$tab1XPPatch=GUICtrlCreateButton ("Install",80,51,240,30,$BS_DEFPUSHBUTTON)
$tab1XPPatchInfo=GUICtrlCreateButton ("Information",80,81,240,30,$BS_DEFPUSHBUTTON)

$tab1barpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\bar.jpg",0,115,320,3)
$tab1SP2Label=GUICtrlCreateLabel ("2. Install Windows XP Service Pack 2",80,126,240,20,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab1SP2Label,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab1SP2=GUICtrlCreateButton ("Install",80,146,240,30,$BS_DEFPUSHBUTTON)
$tab1SP2Info=GUICtrlCreateButton ("Information",80,176,240,30,$BS_DEFPUSHBUTTON)

$tab1CCAALabel=GUICtrlCreatelabel ("3. Install Cisco Clean Access Agent",80,221,240,20,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab1CCAALabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab1ccaapic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\ccaa.jpg",0,211,80,97)
$tab1barpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\bar.jpg",0,210,320,3)
$tab1CCAA=GUICtrlCreateButton ("Install",80,241,240,30,$BS_DEFPUSHBUTTON)
$tab1CCAAInfo=GUICtrlCreateButton ("Information",80,271,240,30,$BS_DEFPUSHBUTTON)

$tab1barpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\bar.jpg",0,310,320,3)
$tab1NortonLabel=GUICtrlCreateLabel ("4. Install APU's Norton AntiVirus",80,316,240,20,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab1NortonLabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab1nortonpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\symantec.jpg",0,313,80,92)
$tab1Norton=GUICtrlCreateButton ("Install",80,336,240,30,$BS_DEFPUSHBUTTON)
$tab1NortonInfo=GUICtrlCreateButton ("Click here for information",80,366,240,30,$BS_DEFPUSHBUTTON)

$tab1barpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\bar.jpg",0,402,320,3)
$tab1NortonUpdateLabel=GUICtrlCreateLabel ("5. Install the latest Virus Definitions",80,411,240,25,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab1NortonUpdateLabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab1NortonUpdates=GUICtrlCreateButton ("Install New Norton Virus Definitions",80,429,240,30,$BS_DEFPUSHBUTTON)


;tab2 creation
$tab2=GUICtrlCreateTabItem ("           Optional Programs            ")
$tab2imtpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\imtlogo.jpg",320,26,320,237)
$tab2Edit = GUICtrlCreateEdit("",320,263,320,220,$ES_MULTILINE + $ES_AUTOVSCROLL + $WS_EX_TRANSPARENT)
GUISetBkColor (-1, 0x415A57)
GUICtrlSetColor (-1, 0xB1B1AD)

$tab2AdAwareLabel=GUICtrlCreateLabel ("1. Install Ad-Aware SE Personal",80,32,240,20,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab2AdAwareLabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab2adawarepic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\adaware.jpg",0,26,80,90)
$tab2AdAware=GUICtrlCreateButton ("Install",80,51,240,30,$BS_DEFPUSHBUTTON)
$tab2AdAwareInfo=GUICtrlCreateButton ("Information",80,81,240,30,$BS_DEFPUSHBUTTON)

$tab2barpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\bar.jpg",0,115,320,3)
$tab2SpyBotLabel=GUICtrlCreatelabel ("2. Install SpyBot Search and Destroy",80,121,240,20,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab2SpyBotLabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab2sbsdpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\sbsdlogo.jpg",0,119,80,90)
$tab2SpyBot=GUICtrlCreateButton ("Install",80,140,240,30,$BS_DEFPUSHBUTTON)
$tab2SpyBotInfo=GUICtrlCreateButton ("Information",80,170,240,30,$BS_DEFPUSHBUTTON)

$tab2barpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\bar.jpg",0,204,320,3)
$tab2FireFoxLabel=GUICtrlCreateLabel ("3. Install Mozilla Firefox Version 1.5",80,211,240,20,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab2FireFoxLabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab2firefoxpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\firefox.jpg",0,214,80,70)
$tab2Firefox=GUICtrlCreateButton ("Install",80,228,240,30,$BS_DEFPUSHBUTTON)
$tab2FirefoxInfo=GUICtrlCreateButton ("Information",80,258,240,30,$BS_DEFPUSHBUTTON)

$tab2barpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\bar.jpg",0,292,320,3)
$tab2TrillianLabel=GUICtrlCreateLabel ("4. Install Trillian Instant Messenger",80,296,240,20,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab2TrillianLabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab2trillianpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\trillian.jpg",0,298,80,80)
$tab2Trillian=GUICtrlCreateButton ("Install",80,315,240,30,$BS_DEFPUSHBUTTON)
$tab2TrillianInfo=GUICtrlCreateButton ("Information",80,345,240,30,$BS_DEFPUSHBUTTON)

$tab2barpic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\bar.jpg",0,381,320,3)
$tab2AcrobatLabel=GUICtrlCreateLabel ("6. Install Adobe Acrobat Reader",80,392,240,25,$SS_CENTER)
GUICtrlSetColor (-1, 0xB1B1AD)
GUICtrlSetFont ($tab2AcrobatLabel,10,400,0,$Font)
GUICtrlSetColor (-1, 0xB1B1AD)
$tab2adobepic=GUICtrlCreatePic(@Systemdir & "\oobe\images\IMT\adobereader.jpg",0,392,80,70)
$tab2Acrobat=GUICtrlCreateButton ("Install",80,429,240,30,$BS_DEFPUSHBUTTON)
$tab2AcrobatInfo=GUICtrlCreateButton ("Information",80,410,240,27,$BS_DEFPUSHBUTTON)

GUICtrlCreateTabitem ("")  ; end tabitem definition

$filemenu = GUICtrlCreateMenu ("&File",-1,1)

$helpmenu = GUICtrlCreateMenu ("&Help")

$helpitem = GUICtrlCreateMenuitem ("Help",$helpmenu)
$exititem = GUICtrlCreateMenuitem ("Exit",$filemenu)
$abootitem = GUICtrlCreateMenuitem ("Aboot",$helpmenu)

GUISetState ()
Do
  $msg = GUIGetMsg ()

   Select
      Case $msg = $tab1XPPatch
         $url1 = "http://per1.apu.edu:8080/reznet/xppatch.exe"
         ProgressOn("", "")
         InetGet($url1, @scriptdir & "\xppatch.exe", 0, 1)
         Local $netDnFileSize = InetGetSize($url1)
         While @InetGetActive
             ProgressSet((@InetGetBytesRead / $netDnFileSize) * 100, "", "Downloading..." & "  " & Round((@InetGetBytesRead / $netDnFileSize) * 100) & "%")
             Sleep(250)
         Wend
         ProgressOff()
         Run (@scriptdir & "\xppatch.exe")
      Case $msg = $tab1Norton
         $url1 = "http://per1.apu.edu:8080/Norton_10_Setup.exe"
         ProgressOn("", "")
         InetGet($url1, @scriptdir & "\Norton_10_Setup.exe", 0, 1)
         Local $netDnFileSize = InetGetSize($url1)
         While @InetGetActive
             ProgressSet((@InetGetBytesRead / $netDnFileSize) * 100, "", "Downloading..." & "  " & Round((@InetGetBytesRead / $netDnFileSize) * 100) & "%")
             Sleep(250)
         Wend
         ProgressOff()
         MsgBox(0,"Download Complete", "Please Click OK to continue with the installation.",5000)
         Run (@scriptdir & "\Norton_10_Setup.exe")
      Case $msg = $tab2AdAware
         Run (@ScriptDir & "\Ubertor Patch\aawsepersonal.exe")
      Case $msg = $tab1CCAA
         Run (@ScriptDir & "\Ubertor Patch\CCAAgent_Setup_3_5_10.exe")
      Case $msg = $tab2Firefox
         Run (@ScriptDir & "\Ubertor Patch\Firefox Setup 1.5.exe")
      Case $msg = $tab2Acrobat
         Run (@ScriptDir & "\AcrobatSetup.exe")
      Case $msg = $tab2Trillian
         Run (@ScriptDir & "\Ubertor Patch\Trillian.exe")
      Case $msg = $tab2SpyBot
         Run (@ScriptDir & "\Ubertor Patch\spybotsd14.exe")
      Case $msg = $tab1SP2
         Run (@ScriptDir & "\Ubertor Patch\WindowsXP-KB835935.exe")
      Case $msg = $tab1XPPatchInfo
         GUICtrlSetData ($tab1Edit, "Windows Updates:   This program will automatically detect and install all of the post-Service Pack 2 updates that are required to access the network. If Windows XP Service Pack 2 showed up in your scan results, please install that before proceeding to these.")
      Case $msg = $tab1SP2Info
         GUICtrlSetData ($tab1Edit, "Windows XP Service Pack 2:   This is a very large package of updates and hotfixes for Windows XP. Most 'factory fresh' computers now come with it pre-installed, but if the 'Scan Results' tab indicates that you require it, please install it before proceeding to other Windows updates. Be aware that this installation will usually take between 30 minuntes and 2 hours, depending on your computer. It will require you to restart your computer once it is finished installing.")
      Case $msg = $tab1NortonInfo
         GUICtrlSetData ($tab1Edit, "Norton AntiVirus:   This is APU's corporate edition of Norton Anti-Virus. While you are required to have an antivirus program, and keep it updated, you do not necessarilly have to use ours. However, this version has a four-year subscription with it to Live-Update for up-to-date virus definitions. If you need to and are going to install this one, please un-install other versions of Norton, as well as other anti-virus programs before installing this one.")
      Case $msg = $tab1CCAAInfo
         GUICtrlSetData ($tab1Edit, "Cisco Clean Access Agent:   This is the program that you must use to log on to the student networks. Clean Access scans your computer, checking for required programs and updates. You must have Windows and you antivirus programs completly up to date to access the network so that we can ensure a safe working environment.")
      Case $msg = $tab1NortonUpdates
             $url3 = "http://per1.apu.edu:8080/reznet/nortondefs.exe"
             ProgressOn("", "")
             InetGet($url3, @scriptdir & "\nortondefs.exe", 0, 1)
             Local $netDnFileSize = InetGetSize($url3)
             While @InetGetActive
                ProgressSet((@InetGetBytesRead / $netDnFileSize) * 100, "", "Downloading..." & "  " & Round((@InetGetBytesRead / $netDnFileSize) * 100) & "%")
                Sleep(250)
             Wend
             ProgressOff()
             MsgBox(0,"Download Complete", "Please Click OK to continue with the installation.",15000)
             Run (@scriptdir & "\nortondefs.exe")
      Case $msg = $tab2AdAwareInfo
         GUICtrlSetData ($tab2Edit, "Ad-Aware SE Personal:   This program is a popular, effective anti-spyware program. While Optional for the network, it is still a wise program to have on hand for regular use.")
      Case $msg = $tab2FirefoxInfo
         GUICtrlSetData ($tab2Edit, "Mozilla Firefox 1.5:   This program is a web browser that is a very widely acceptable alternative to using Internet Explorer. Firefox is one of the best alternatives around, featuring tabbed browsing, better security, and a more enjoyable user experience. Please note that it is not a requirement, nor is it supported by APU yet.")
      Case $msg = $tab2TrillianInfo
         GUICtrlSetData ($tab2Edit, "Trillian Basic 3:   This program is a popular alternative to using AIM, MSN, and Yahoo! instant messenger programs. It combines all of them in to one program, and does not include spyware programs like WeatherBug in installation. This program is also not a requirement, but is a cool program to have on hand as an alternative that we feel should be suggested.")
      Case $msg = $tab2AcrobatInfo
         GUICtrlSetData ($tab2Edit, "Adobe Acrobat Reader:   You do not have the most current version of Acrobat Reader. This program is used to open .pdf files, which is a standard file type often used in web-publishing and document distribution. You will not be able to open these file types without Acrobat Reader. This is also not a requirement for network access.")
      Case $msg = $tab2SpyBotInfo
         GUICtrlSetData ($tab2Edit, "SpyBot Search and Destroy:   This program is a popular, effective anti-spyware program. While Optional for the network, it is still a wise program to have on hand for regular use.")
      Case $msg = $tab2
         GUICtrlSetData ($tab1Edit, " ")
      Case $msg = $tab1
         GUICtrlSetData ($tab2Edit, " ")
      Case $msg = $tab0ReScan
    GUICtrlSetData ($tab0Edit, "")
    Dim $diagnose2[28]
    Dim $p = 1
    ProgressOn ("Now Diagnosing...","Please wait while we scan your computer")
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB873333", "Installed") then
    $diagnose2[$p] = "Windows Update KB873333      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (4)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB885250", "Installed") then
    $diagnose2[$p] = "Windows Update KB885250      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (8)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB886185", "Installed") then
    $diagnose2[$p] = "Windows Update KB886185      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (12)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB888113", "Installed") then
    $diagnose2[$p] = "Windows Update KB888113      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (16)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB891781", "Installed") then
    $diagnose2[$p] = "Windows Update KB891781      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (20)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB893066", "Installed") then
    $diagnose2[$p] = "Windows Update KB893066      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (24)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896358", "Installed") then
    $diagnose2[$p] = "Windows Update KB896358      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (28)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896422", "Installed") then
    $diagnose2[$p] = "Windows Update KB896422      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (32)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896423", "Installed") then
    $diagnose2[$p] = "Windows Update KB896423      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (36)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896424", "Installed") then
    $diagnose2[$p] = "Windows Update KB896424      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (40)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896688", "Installed") then
    $diagnose2[$p] = "Windows Update KB896688      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (43)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB896727", "Installed") then
    $diagnose2[$p] = "Windows Update KB896727      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (45)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899588", "Installed") then
    $diagnose2[$p] = "Windows Update KB899588      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (47)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB899589", "Installed") then
    $diagnose2[$p] = "Windows Update KB899589      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (50)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB900725", "Installed") then
    $diagnose2[$p] = "Windows Update KB900725      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (54)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901017", "Installed") then
    $diagnose2[$p] = "Windows Update KB901017      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (57)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB901214", "Installed") then
    $diagnose2[$p] = "Windows Update KB901214      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (61)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB902400", "Installed") then
    $diagnose2[$p] = "Windows Update KB902400      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (64)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB904706", "Installed") then
    $diagnose2[$p] = "Windows Update KB904706      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (68)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905414", "Installed") then
    $diagnose2[$p] = "Windows Update KB905414      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (71)
    If NOT RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB905749", "Installed") then
    $diagnose2[$p] = "Windows Update KB905749      Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (75)
    If NOT FileExists ("C:\Program Files\Symantec AntiVirus\VPTray.exe") then
    $diagnose2[$p] = "Norton Anti-Virus          Required"
    $n = $n + 1
    EndIf
    Sleep (150)
    ProgressSet (80)
    If NOT FileExists ("C:\Program Files\Cisco Systems\Clean Access Agent\CCAAgent.exe") then
    $diagnose2[$p] = "Cisco Clean Access Agent    Required"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (86)
    If NOT FileExists ("C:\Program Files\Mozilla Firefox\firefox.exe") Then
    $diagnose2[$p] = "Mozilla Firefox              Optional"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (89)
    If NOT FileExists ("C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe") Then
    $diagnose2[$p] = "Spy-Bot Search and Destroy    Optional"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (93)
    If NOT FileExists ("C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe") Then
    $diagnose2[$p] = "Ad-Aware SE Personal        Optional"
    $p = $p + 1
    EndIf
    Sleep (150)
    ProgressSet (96)
    If NOT FileExists ("C:\WINDOWS\Driver Cache\i386\sp2.cab") Then
    $diagnose2[$p] = "WindowsXP Service Pack2      Required"
    $p = $p + 1
    EndIf
    ProgressSet (97)
    If NOT FileExists ("C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe") Then
    $diagnose2[$p] = "Adobe Acrobat Reader 6.0    Optional"
    $p = $p + 1
    EndIf
    ProgressSet (98)
    If NOT FileExists ("C:\Program Files\Trillian\trillian.exe") Then 
    $diagnose2[$p] = "Trillian Instant Messenger    Optional"
    $p = $p + 1
    EndIf
    ProgressSet (100)
    ProgressOff()
    Local $List2 = ''
    For $h = 1 To $p - 1
       $List2 = $List2 & $Diagnose2[$h] & @CRLF
    Next
    GUICtrlSetData ($tab0edit, $List2)
   EndSelect
      If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then
          FileRecycle ("C:\Ubertor Patch")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\imtlogo.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\adaware.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\adobereader.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\apulogoteal.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\ccaa.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\firefox.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\symantec.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\trillian.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\windows.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\sbsdlogo.jpg")
      FileRecycle ("C:\WINDOWS\system32\oobe\images\IMT\bar.jpg")
          Exitloop
      EndIf
      If $msg = $helpitem Then
              $url = "C:\Ubertor Patch\HelpFile.html"
        Run("c:\program files\internet explorer\iexplore.exe " & $url)
      EndIf
      If $msg = $abootitem Then MsgBox (0, "Aboot", "RezNet Setup Application Student V3.0. ")
Until $msg = $GUI_EVENT_CLOSE

so that is the original one, and attached is the exe. Any further help would be greatly appreciated. :)

"I wish I could say something that was classy and inspirational, but that just wouldn't be our style. Pain heals. Chicks dig scars. Glory lasts forever." - Shane Falco, The Replacements

Link to comment
Share on other sites

  • Moderators

You asked how to write an array to a file, we've all provided options to do that, PsaltyDS and myself simply shortened your "lengthy" code. I understood you wanted to use it as the backend operations via your first post, but you asked a specific question (even in the title) about writing an array to a file.

If you look at the bottom of each of my examples, I've provided how to do so what you specifically have requested, one with your original code, and one with IMHO more precise and efficient.

One reason why you probably have errors, is your not using the Beta correctly. I noticed that most of your functions are written just like they would have been if using the released version.

If you run the example that I wrote last: http://www.autoitscript.com/forum/index.ph...ndpost&p=184519

And just put in a dummy text file for testing, you'll see it does in fact work if using Beta properly.

But there is no way in hell I'm going through all that code to figure it out for you :)

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Cat don't have much skin left for sure lol... but out of curiousity, what does the _ArrayAdd() do that the Beta way of creating arrays doesn't provide

Dim $Array[2] = ['', 1];example only
, that if I wanted to change the 1st elements values, I could just remove the 1 and put what I needed?

I guess one advantage is not having to physically declare the number of elements?

Just seems like alot more code... but both meet at the same point so it's nice to see different alternatives :(.

You're absolutely right that declaring in a single line is "tighter". My problem with it comes from my circumstances, in that I go back and tweak lists like that a lot. The way I have it formatted, with the _ArrayAdd()'s, going back and doing maintenance on the script is easier. From a human-readable standpoint, I find it much simpler and less error-prone. As you pointed out, I never bother to count the lines in order to set the [0]=count, either, which saves me another place to maybe screw up an update.

None of that makes it run more efficiently, for sure, but readability and maintainability are huge in my little world.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

OKAY, some things work, and somethings are a little backwards. the registry check arrays work, but with the fileexist arrays are backwards, what I need them to do is check to see if files are not there. I'm still a noob, so I need some help. I don't know how to use UDF's, and I don't get how to use things in beta. I know you guys don't want to have to explain everything but I just need some help here. here's where I'm at, maybe someone can point my code in the right direction.

#include <GUIConstants.au3>
#include <Array.au3>
_FileWriteFromArray()
Dim $diagnose[9]
Dim $n = 1
Dim $FileLocation = 'C:\Documents and Settings\David Becker\My Documents\Work\Ubertor Patch\Student Distribution\flash version\testfile.txt'
Dim $RegRead[32] = ['', 'KB873333', 'KB885250', 'KB886185', 'KB888113', 'KB891781', 'KB893066', 'KB896358', 'KB896422', _
        'KB896423', 'KB896424', 'KB896688', 'KB896727', 'KB899588', 'KB899589', 'KB900725', 'KB901017', 'KB901214', _
        'KB902400', 'KB904706', 'KB905414', 'KB905749', 'KB905915', 'KB910437', 'KB912919', 'KB908519', 'KB901190', _
        'KB911927', 'KB913446', 'KB912812', 'KB908531', 'KB911562']
If NOT FileExists ("C:\WINDOWS\Driver Cache\i386\sp2.cab") Then 
$diagnose[$n] = "WindowsXP Service Pack2       Required"
$n = $n + 1
EndIf
If NOT FileExists ("C:\Program Files\Cisco Systems\Clean Access Agent\CCAAgent.exe") then 
$diagnose[$n] = "Cisco Clean Access Agent     Required"
$n = $n + 1
EndIf
If NOT FileExists ("C:\Program Files\Symantec AntiVirus\VPTray.exe") then
$diagnose[$n] = "Norton Anti-Virus           Required"
$n = $n + 1
EndIf
If NOT FileExists ("C:\Program Files\Mozilla Firefox\firefox.exe") Then 
$diagnose[$n] = "Mozilla Firefox               Optional"
$n = $n + 1
EndIf
If NOT FileExists ("C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe") Then 
$diagnose[$n] = "Spy-Bot Search and Destroy Optional"
$n = $n + 1
EndIf
If NOT FileExists ("C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe") Then 
$diagnose[$n] = "Ad-Aware SE Personal         Optional"
$n = $n + 1
EndIf
If NOT FileExists ("C:\Program Files\Adobe\Acrobat 7.0\Reader") Then
$diagnose[$n] = "Adobe Acrobat Reader 7.0     Optional"
$n = $n + 1
EndIf
If NOT FileExists ("C:\Program Files\Trillian\trillian.exe") Then 
$diagnose[$n] = "Trillian Instant Messenger Optional"
$n = $n + 1
EndIf

For $RegCount = 1 To UBound($RegRead) - 1
    If Not RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\' & $RegRead[$RegCount], 'Installed') Then
;       $FileExists[1] = False
        $Diagnose[1] = 'Post Service Pack-2 Updates' & @TAB & 'Required'
        ExitLoop
    EndIf
Next

Local $sFilePath
$sFilePath = "C:\Documents and Settings\David Becker\My Documents\Work\Ubertor Patch\Student Distribution\flash version\testfile.txt"
_FileWriteFromArray($sFilePath, $List)

$FileOpen = FileOpen($FileLocation, 2); Look at file open, 2 erases everything, I imagine that's what you want.
For $FileWriteCount = 1 To UBound($FileExists) - 1
    If $FileExists[$FileWriteCount] Then FileWriteLine($FileOpen, $Diagnose[$FileWriteCount])
Next
FileClose($FileOpen); Close the FileOpen handle

I know it's kind of jumbled, but I'm trying to get this in the right direction. Can anyone lend a hand to a newbie?

Edited by dbecker

"I wish I could say something that was classy and inspirational, but that just wouldn't be our style. Pain heals. Chicks dig scars. Glory lasts forever." - Shane Falco, The Replacements

Link to comment
Share on other sites

just a visual... quick look

maybe this....

For $RegCount = 1 To UBound($RegRead) - 1
    If Not RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\' & $RegRead[$RegCount], 'Installed') Then
;       $FileExists[1] = False
        $Diagnose[1] = 'Post Service Pack-2 Updates' & @TAB & 'Required'
        ExitLoop
    EndIf
Next

should be like this

For $RegCount = 1 To UBound($RegRead) - 1
    If Not RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\' & $RegRead[$RegCount], 'Installed') Then
;       $FileExists[$RegCount] = False
        $Diagnose[$RegCount] = 'Post Service Pack-2 Updates' & @TAB & 'Required'
        ExitLoop
    EndIf
Next

replaced "1" with $RegCount

EDIT

this

Dim $diagnose[9]

would need to to

Dim $diagnose[32]

..... $fileexists[32] also

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

OKAY, some things work, and somethings are a little backwards. the registry check arrays work, but with the fileexist arrays are backwards, what I need them to do is check to see if files are not there. I'm still a noob, so I need some help. I don't know how to use UDF's, and I don't get how to use things in beta. I know you guys don't want to have to explain everything but I just need some help here. here's where I'm at, maybe someone can point my code in the right direction.

I know it's kind of jumbled, but I'm trying to get this in the right direction. Can anyone lend a hand to a newbie?

...with the fileexist arrays are backwards, what I need them to do is check to see if files are not there.

That part looks right, in that you have the NOT operator in there for: If Not FileExists() Then

The code between Then and EndIf should run if the file does not exist.

I don't know how to use UDF's...

Baicly, you just declare the code between tags for Func and EndFunc. The first line gives the function its name, as in: Func _MyFunction(). All the code between that and EndFunc is then run by just putting in _MyFunction(). It can get more complicated where you pass parameters to the function, get retrun and @error values from the function, declare local vice global variables in the function... etc. See the exmples in the help file and the AutoIT123 tutorial (which can be found by searching the forum).

...and I don't get how to use things in beta.

Download and install the beta version of AutoIT and then you will have two versions: Production (or Prod) and beta. If you are running/compiling your scripts from inside the SciTE editor, then you have convienient hotkeys like:

- F5 = Run the script with Prod

- Alt-F5 = run the script with Beta

- F7 = Compile the script with Prod

- Alt-F7 = Compile the script with Beta

Most of the scripts on this board make use of functions that come in Beta, so you really can't get far without it in the AutoIT world... :)

P.S. I test my script for you in post #9 of this thread - if you run it under Beta and get an error, please post the exact error so we can figure it out...

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

OKAY, some things work, and somethings are a little backwards. the registry check arrays work, but with the fileexist arrays are backwards, what I need them to do is check to see if files are not there. I'm still a noob, so I need some help. I don't know how to use UDF's, and I don't get how to use things in beta. I know you guys don't want to have to explain everything but I just need some help here. here's where I'm at, maybe someone can point my code in the right direction.

I know it's kind of jumbled, but I'm trying to get this in the right direction. Can anyone lend a hand to a newbie?

Try this:
Dim $FileLocation = 'Location Of File To Write To'
Dim $RegRead[32] = ['', 'KB873333', 'KB885250', 'KB886185', 'KB888113', 'KB891781', 'KB893066', 'KB896358', 'KB896422', _
        'KB896423', 'KB896424', 'KB896688', 'KB896727', 'KB899588', 'KB899589', 'KB900725', 'KB901017', 'KB901214', _
        'KB902400', 'KB904706', 'KB905414', 'KB905749', 'KB905915', 'KB910437', 'KB912919', 'KB908519', 'KB901190', _
        'KB911927', 'KB913446', 'KB912812', 'KB908531', 'KB911562']
Dim $FileExists[10] = ['', True, FileExists(@WindowsDir & '\Driver Cache\i386\sp2.cab'), FileExists(@ProgramFilesDir & '\Cisco Systems\Clean Access Agent\CCAAgent.exe'), _
        FileExists(@ProgramFilesDir & '\Symantec AntiVirus\VPTray.exe'), FileExists(@ProgramFilesDir & '\Mozilla Firefox\firefox.exe'), _
        FileExists(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe'), FileExists(@ProgramFilesDir & '\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe'), _
        FileExists(@ProgramFilesDir & '\Adobe\Acrobat 7.0\Reader'), FileExists(@ProgramFilesDir & '\Trillian\trillian.exe')]
Dim $Diagnose[10] = ['', '', 'WindowsXP Service Pack2' & @TAB & 'Required', 'Cisco Clean Access Agent' & @TAB & 'Required', 'Norton Anti-Virus' & @TAB & @TAB & 'Required', _
        'Mozilla Firefox' & @TAB & @TAB & @TAB & 'Optional', 'Spy-Bot Search and Destroy' & @TAB & 'Optional', 'Ad-Aware SE Personal' & @TAB & @TAB & 'Optional', _
        'Adobe Acrobat Reader 7.0' & @TAB & 'Optional', 'Trillian Instant Messenger' & @TAB & 'Optional']

For $RegCount = 1 To UBound($RegRead) - 1
    If Not RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\' & $RegRead[$RegCount], 'Installed') Then
        $FileExists[1] = False
        $Diagnose[1] = 'Post Service Pack-2 Updates' & @TAB & 'Required'
        ExitLoop
    EndIf
Next

$FileOpen = FileOpen($FileLocation, 2); Look at file open, 2 erases everything, I imagine that's what you want.
For $FileWriteCount = 1 To UBound($FileExists) - 1
    If $FileExists[$FileWriteCount] = False Then FileWriteLine($FileOpen, $Diagnose[$FileWriteCount])
Next
FileClose($FileOpen); Close the FileOpen handle

Edit:

Valuater caught the mistake in mine I see.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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