Kan inte låta bli att fippla...
Nu jagas Acrobat 7-9, InD -, PS - och AI CS2-4 i respektive mapp.
Dessutom letar det efter dessa program i andra mappar eller direkt i programmappen och redovisar alla förekomster av resp program i en accumulerande kolumn. Man kan alltså i Excel lägga ihop kolumn 3, 4 och 5 och subtrahera resultatet från värdet i kolumn 6. Detta ska bli 0. Om det blir mer än 0 finns det installationer av programmet som avviker från hur Adobes installerare gör.
Jag letar fortfarande inte efter fall där programfilerna heter något annat än de gör vid installation.
set myAcrobat7 to 0
set myAcrobat8 to 0
set myAcrobat9 to 0
set myAcrobatTotal to 0
set myAICS2 to 0
set myAICS3 to 0
set myAICS4 to 0
set myAITotal to 0
set myInDCS2 to 0
set myInDCS3 to 0
set myInDCS4 to 0
set myInDTotal to 0
set myPSCS2 to 0
set myPSCS3 to 0
set myPSCS4 to 0
set myPSTotal to 0
set myDate to current date
set myShortDate to short date string of myDate
set myTime to time string of myDate
set myDate to myShortDate & ", " & myTime
tell application "Finder"
set myDisk to name of startup disk
set myAppFolder to folder (myDisk & ":Applications")
set myApps to application files of myAppFolder
repeat with K from 1 to count myApps
if displayed name of item K of myApps contains "Adobe Acrobat" then
set myAcrobatTotal to myAcrobatTotal + 1
else if displayed name of item K of myApps contains "Adobe Illustrator CS" then
set myAITotal to myAITotal + 1
else if displayed name of item K of myApps contains "Adobe inDesign CS" then
set myInDTotal to myInDTotal + 1
else if displayed name of item K of myApps contains "Adobe Photoshop CS" then
set myPSTotal to myPSTotal + 1
end if
end repeat
set mySubFolders to folders of myAppFolder
repeat with I from 1 to (count mySubFolders)
if displayed name of item I of mySubFolders contains "Acrobat" or displayed name of item I of mySubFolders contains "Illustrator" or displayed name of item I of mySubFolders contains "InDesign" or displayed name of item I of mySubFolders contains "Photoshop" then
set myApps to application files of item I of mySubFolders
repeat with R from 1 to count myApps
set myApp to displayed name of item R of myApps
set myAppContainer to displayed name of container of item R of myApps
set myVersion to version of item R of myApps
if myApp contains "Adobe Acrobat" and myAppContainer contains "7" then
set myAcrobat7 to 1
set myAcrobatTotal to myAcrobatTotal + 1
else if myApp contains "Adobe Acrobat" and myAppContainer contains "8" then
set myAcrobat8 to 1
set myAcrobatTotal to myAcrobatTotal + 1
else if myApp contains "Adobe Acrobat" and myAppContainer contains "9" then
set myAcrobat9 to 1
set myAcrobatTotal to myAcrobatTotal + 1
else if myApp contains "Adobe Illustrator CS" and myAppContainer contains "CS2" then
set myAICS2 to 1
set myAITotal to myAITotal + 1
else if myApp contains "Adobe Illustrator CS" and myAppContainer contains "CS3" then
set myAICS3 to 1
set myAITotal to myAITotal + 1
else if myApp contains "Adobe Illustrator CS" and myAppContainer contains "CS4" then
set myAICS4 to 1
set myAITotal to myAITotal + 1
else if myApp contains "Adobe inDesign CS" and myAppContainer contains "CS2" then
set myInDCS2 to 1
set myInDTotal to myInDTotal + 1
else if myApp contains "Adobe inDesign CS" and myAppContainer contains "CS3" then
set myInDCS3 to 1
set myInDTotal to myInDTotal + 1
else if myApp contains "Adobe inDesign CS" and myAppContainer contains "CS4" then
set myInDCS4 to 1
set myInDTotal to myInDTotal + 1
else if myApp contains "Adobe Photoshop CS" and myAppContainer contains "CS2" then
set myPSCS2 to 1
set myPSTotal to myPSTotal + 1
else if myApp contains "Adobe Photoshop CS" and myAppContainer contains "CS3" then
set myPSCS3 to 1
set myPSTotal to myPSTotal + 1
else if myApp contains "Adobe Photoshop CS" and myAppContainer contains "CS4" then
set myPSCS4 to 1
set myPSTotal to myPSTotal + 1
else if myApp contains "Adobe Acrobat" then
set myAcrobatTotal to myAcrobatTotal + 1
else if myApp contains "Adobe Illustrator CS" then
set myAITotal to myAITotal + 1
else if myApp contains "Adobe InDesign CS" then
set myInDTotal to myInDTotal + 1
else if myApp contains "Adobe Photoshop CS" then
set myPSTotal to myPSTotal + 1
end if
end repeat
end if
end repeat
-- tell me to set text item delimiters to " "
set myApps to (myAcrobat7 & " " & myAcrobat8 & " " & myAcrobat9 & " " & myPSTotal & " " & myAICS2 & " " & myAICS3 & " " & myAICS4 & " " & myAITotal & " " & myInDCS2 & " " & myInDCS3 & " " & myInDCS4 & " " & myInDTotal & " " & myPSCS2 & " " & myPSCS3 & " " & myPSCS4 & " " & myPSTotal) as string
set myComputer to (computer name of (system info))
set myInventory to myComputer & " " & myDate & " " & myApps
-- ta bort följande rad, den visar bara vad kolumnerna innehåller:
set myInventory to "myComputer myDate myAcrobat7 myAcrobat8 myAcrobat9 myAcrobatTotal myAICS2 myAICS3 myAICS4 myAITotal myInDCS2 myInDCS3 myInDCS4 myInDTotal myPSCS2 myPSCS3 myPSCS4 myPSTotal" & return & myInventory
set myLognameDialog to text returned of (display dialog "Vad ska loggfilen heta?" default answer "Apps_in_" & myComputer)
set myLogFile to (((choose folder with prompt "Peka ut var du vill spara filen " & myLognameDialog) as string) & myLognameDialog & ".txt") as string
end tell
try
set myLogFileRef to (open for access file myLogFile with write permission)
-- Ta bort kommenteringen på följande rad om du vill radera loggfilen varje gång du kör skriptet:
-- set eof of myLogFileRef to 0
write myInventory & return to myLogFileRef starting at eof
close access myLogFileRef
on error
try
close access myLogFileRef
end try
end try