So I finally got my folder generator script to work fine on my development machine which is running Mountain Lion and xCode 4.4.1
script AppDelegate
property parent : class "NSObject"
--IBOutlets
property studioDept : missing value
property existingClient : missing value
property newClient : missing value
property sapNumber : missing value
property workOrder : missing value
property client : missing value
property testView : missing value
on setWindowValueFields_(sender)
log "Button clicked"
set studioDeptValue to (studioDept's selectedCell()'s |title|()) as text
set existingClientValue to existingClient's stringValue() as text
set newClientValue to newClient's stringValue() as text
set sapNumberValue to sapNumber's stringValue() as text
set workOrderValue to workOrder's stringValue() as text
-- display dialog existingClientValue
if existingClientValue is not equal to "" and newClientValue is equal to "" then
set client to existingClientValue
-- display dialog "got to here"
else if existingClientValue is equal to "" and newClientValue is not equal to "" then
set client to newClientValue
-- display dialog "got to there"
else
display dialog "Someting is wrong with your client selection."
end if
set firstChar to first character of client
set numFirstChar to ASCII number of firstChar
if (numFirstChar is greater than 64) and (numFirstChar is less than 72) then
set pathFolder to "A-G"
else if (numFirstChar is greater than 71) and (numFirstChar is less than 79) then
set pathFolder to "H-N"
else if (numFirstChar is greater than 78) and (numFirstChar is less than 85) then
set pathFolder to "O-T"
else if (numFirstChar is greater than 84) and (numFirstChar is less than 91) then
set pathFolder to "U-Z"
else
set pathFolder to 0
end if
--display dialog pathFolder
set fm to current application's NSFileManager's defaultManager()
set thePathOne to "/Volumes/print_studio" & "/" & pathFolder & "/" & client & "/" & sapNumberValue
set thePathTwo to thePathOne & "/mechanicals/" & workOrderValue & "/prepress"
set mechOne to thePathOne & "/mechanicals" & "/" & workOrderValue & "/final_collects"
set mechTwo to thePathOne & "/mechanicals" & "/" & workOrderValue & "/previous_rounds"
set mechThree to thePathOne & "/mechanicals" & "/comps"
set mechFour to thePathOne & "/mechanicals" & "/links"
set mechFive to thePathOne & "/mechanicals" & "/low_res_pdfs"
set designOne to thePathOne & "/design/collects"
set designTwo to thePathOne & "/design/low_res_pdfs"
set designThree to thePathOne & "/design/supplied"
set designFour to thePathOne & "/design/layouts/links"
set designFive to thePathOne & "/design/layouts/previous_rounds"
set prepressOne to thePathTwo & "/final_collects"
set prepressTwo to thePathTwo & "/master_files"
set prepressThree to thePathTwo & "/pdfx1a_for_release"
set prepressFour to thePathTwo & "/preflight_reports"
if studioDeptValue is "Mechs" then
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(thePathOne,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(mechOne,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(mechTwo,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(mechThree,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(mechFour,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(mechFive,1,missing value,missing value)
else if studioDeptValue is equal to "Design" then
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(designOne,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(designTwo,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(designThree,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(designFour,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(designFive,1,missing value,missing value)
else
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(prepressOne,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(prepressTwo,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(prepressThree,1,missing value,missing value)
fm's createDirectoryAtPath_withIntermediateDirectories_attributes_error_(prepressFour,1,missing value,missing value)
end if
--set concatentedString to current application's NSString's stringWithFormat_("%@%@%@%@%@", studioDeptValue, existingClientValue, newClientValue, sapNumberValue, workOrderValue)
--testView's setStringValue_(concatentedString)
end setWindowValueFields_
on applicationShouldTerminateAfterLastWindowClosed_(notif)
return true
end applicationShouldTerminateAfterLastWindowClosed_
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
-- return true
end applicationShouldTerminate_
end script
The problem is that most of my studio machines are still running Lion. So I changed my deployment target from 10.8 to 10.7 and build out the app again only to find that the radio button matrix had disappeared. I’m not really using anything exotic in my script. Does anyone see why it’s dropping the radio matrix and what I might do to fix it so it would work in Lion?
Thanks.
–jon