Ive got a BIG problem, and Im in desperite need of anyone’s help.
I was wondering if there was a way to automate the task of running “Apple System Profiler”, creating a report of its data to a text file, and storing that file anywhere on the network.
Im trying to automate our inventory collection process, and finding something to capture some basic information for our mac’s is proving quite difficult. I can write something to read the data, I just can get anyting to export the information I need. I was hoping Applescipt might be my answer.
Im sure I can arrange for some financial compensation if anyone was capable of doing this for me.
Please feel free to email me at jvanosch@ucc.on.ca if you have any questions, or are interested in helping me out.
I have put together an AppleScript which should gather information from Apple Profiler and Save it to the Desktop of the Startup Disk, followed by changing it into a Microsoft Word 98 document (or a Simple Text document if the file is not TOO large)
The Automation of the Script should not be difficult because it can be set to run with various utilities that are available. You could even use an idle handler script to “run” it at a certain time of day.
with timeout of 300 seconds -- allows 5 minutes to gather all information
tell application "Finder"
set thePath to path to desktop as string -- Requires Standard Additions osaxen
end tell
tell application "Apple System Profiler"
activate
--Note if ALL report contents are listed the resulting file will be TOO LARGE for Siimple Text, Use Word Document
set report contents to {system profile, devices and volumes, extensions, control panels, applications, system folders}
--set report contents to {system profile}
set report view format to text
make new report at thePath with data report contents
set theName to the name of the result
repeat with reportNumber from 1 to count of reports
save report reportNumber in thePath & theName
end repeat
quit
end tell
tell application "Finder"
activate
set selection to every item of the desktop whose name is theName
--enter file type & creator in that order
--set file_info to {"TEXT", "ttxt"} -- Uncomment for Simple Text Document
set file_info to {"W8BN", "MSWD"} -- Uncomment for Microsoft Word 98 Document
Set File Info of selection change to first item of file_info creator second item of file_info
activate
end tell
end timeout
I hope this proves useful to you. The Script will need “Standard Additions” osaxen and was tested on OS 8.6
This is a very basic applescript that I place in the client computer’s shutdown items folder. When the client shuts down, the scipt runs, creates a profile, names it with the client’s computer name, deletes itself, and shuts the computer down.
tell application “Finder”
with timeout of 300 seconds
mount volume "afp://SomeVolume/" as user name "username" with password "password"
end timeout
end tell
tell application “Apple System Profiler”
activate
make at beginning new report
end tell
tell application “Finder”
set filename to (class (application “File Sharing”) owner name)
set ThisFile to “SomeVolume:” & filename as string
end tell
tell application “Apple System Profiler”
save report 1 in file ThisFile with replacing
end tell
tell application “Apple System Profiler”
quit
end tell
tell application “Finder”
put away disk “SomeVolume”
end tell
tell application “File Sharing”
try
quit
end try
end tell
tell application “Finder”
try
move file “ScriptName” of folder “shutdown items” of system folder of startup disk to trash
end try
end tell