pieman1968
08-15-2010, 07:17 PM
Been trying to organise a database of equipment we have but organising this into case and kits/jobs is a pain in most database systems, Mysql etc. So I thought perhaps using the finder might be a way.
Basically each "equipment" item is a folder, each piece of "equipment" is stored for transport in a "case"
Each "case" is a folder
Each "Kit" folder contains a number of "case" folders containing a number of "equipment" folder items.
The information necessary for the database is stored in the folder name and spotlight comments
eg
Kit/
case 1/
camera1
sound kit1
case 2/
camera2
soundkit2
I need to write a script that will look at the root folder Kit and then list all the folders into a file in a way that they can then be opened in openoffice as a CSV file and create a spreadsheet.
What I like about this approach is custom images can be added to the folders. Users can drag/copy items into "case" folders very easily without dealing with a database
The Spotlight comments could hold additional "," delimited info such as serial number, country of origin, value.
I have been testing a script I found on the net with text wrangler but perhaps it is the wrong approach
---------
tell application "Finder"
set selec to selection as alias
set conta to container of selec as alias
set item_Name to name of selec
end tell
tell application "TextWrangler"
activate
open conta
end tell
tell application "System Events"
tell process "TextWrangler"
end tell
end tell
tell application "Finder"
set selec to selection as alias
set conta to POSIX path of selec
end tell
tell application "TextWrangler"
activate
make new text document
tell application "System Events"
tell process "TextWrangler"
click menu item "Folder Listing…" of menu 1 of menu item ¬
"Insert" of menu 1 of menu bar item "Edit" of menu bar 1
keystroke "g" using {command down, shift down}
keystroke conta
repeat 2 times
keystroke return
end repeat
end tell
end tell
end tell
-------------
This looks like it could work. But I can't work out how to control the print out to the file or add the Spotlight comments fields. So they are a proper CSV format
Any ideas.
Cheers
Basically each "equipment" item is a folder, each piece of "equipment" is stored for transport in a "case"
Each "case" is a folder
Each "Kit" folder contains a number of "case" folders containing a number of "equipment" folder items.
The information necessary for the database is stored in the folder name and spotlight comments
eg
Kit/
case 1/
camera1
sound kit1
case 2/
camera2
soundkit2
I need to write a script that will look at the root folder Kit and then list all the folders into a file in a way that they can then be opened in openoffice as a CSV file and create a spreadsheet.
What I like about this approach is custom images can be added to the folders. Users can drag/copy items into "case" folders very easily without dealing with a database
The Spotlight comments could hold additional "," delimited info such as serial number, country of origin, value.
I have been testing a script I found on the net with text wrangler but perhaps it is the wrong approach
---------
tell application "Finder"
set selec to selection as alias
set conta to container of selec as alias
set item_Name to name of selec
end tell
tell application "TextWrangler"
activate
open conta
end tell
tell application "System Events"
tell process "TextWrangler"
end tell
end tell
tell application "Finder"
set selec to selection as alias
set conta to POSIX path of selec
end tell
tell application "TextWrangler"
activate
make new text document
tell application "System Events"
tell process "TextWrangler"
click menu item "Folder Listing…" of menu 1 of menu item ¬
"Insert" of menu 1 of menu bar item "Edit" of menu bar 1
keystroke "g" using {command down, shift down}
keystroke conta
repeat 2 times
keystroke return
end repeat
end tell
end tell
end tell
-------------
This looks like it could work. But I can't work out how to control the print out to the file or add the Spotlight comments fields. So they are a proper CSV format
Any ideas.
Cheers