template.applescript 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. on run (volumeName)
  2. tell application "Finder"
  3. tell disk (volumeName as string)
  4. open
  5. set theXOrigin to WINX
  6. set theYOrigin to WINY
  7. set theWidth to WINW
  8. set theHeight to WINH
  9. set theBottomRightX to (theXOrigin + theWidth)
  10. set theBottomRightY to (theYOrigin + theHeight)
  11. set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
  12. tell container window
  13. set current view to icon view
  14. set toolbar visible to false
  15. set statusbar visible to false
  16. set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
  17. set statusbar visible to false
  18. REPOSITION_HIDDEN_FILES_CLAUSE
  19. end tell
  20. set opts to the icon view options of container window
  21. tell opts
  22. set icon size to ICON_SIZE
  23. set text size to TEXT_SIZE
  24. set arrangement to not arranged
  25. end tell
  26. BACKGROUND_CLAUSE
  27. -- Positioning
  28. POSITION_CLAUSE
  29. -- Hiding
  30. HIDING_CLAUSE
  31. -- Application and QL Link Clauses
  32. APPLICATION_CLAUSE
  33. QL_CLAUSE
  34. close
  35. open
  36. -- Force saving of the size
  37. delay 1
  38. tell container window
  39. set statusbar visible to false
  40. set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10}
  41. end tell
  42. end tell
  43. delay 1
  44. tell disk (volumeName as string)
  45. tell container window
  46. set statusbar visible to false
  47. set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
  48. end tell
  49. end tell
  50. --give the finder some time to write the .DS_Store file
  51. delay 3
  52. set waitTime to 0
  53. set ejectMe to false
  54. repeat while ejectMe is false
  55. delay 1
  56. set waitTime to waitTime + 1
  57. if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true
  58. end repeat
  59. log "waited " & waitTime & " seconds for .DS_STORE to be created."
  60. end tell
  61. end run