• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Timesaving Solution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Timesaving Solution


  • Subject: Timesaving Solution
  • From: Scott Lewis <email@hidden>
  • Date: Thu, 17 Apr 2003 01:10:05 -0400

I've recently been working on a project that uses about a dozen properties
across 6 different scripts. Whenever I would make the inevitable changes to
properties I would have to make the changes in each script. I came up with a
solution I thought might interest other scripters. It saves A LOT of time
since the changes only have to be made once. It also eleminates many errors.

create a library with all of the properties then create a subroutine like
this:

property myProp1: "red"
property myProp2: "blue"
property myProp3: "green"

on getProps()
return {xProp:myProp1, yProp:myProp2, zProp:myProp3}
end getProps

The benefit of naming each prop is that you don't have to remember what
number in the list each item is.

then at the beginning of each script:

set myLib to load script file myLibPath
tell myLib
set myProps to (getProps())
set x to firstProp of myProps
set y to secondProp of myProps
set z to thirdProp of myProps
end tell

tell app "any app"
-- do something with x, y, and z
end tell

this loads the properties into each script. If changes need to be made (file
paths, file names, etc.), you only have to make the changes once to the
library.

I hope this is useful to someone else. If anybody has an easier way of doing
this email me at the address below. Either way please send me some feedback.
I've never seen this solution before and am interested to know how useful it
is.

Thanks,
Scott Lewis
scott(at)lewisdesign(dot)net <-- foiling the spammer's spiders (he - he)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Getting the labels of a record
  • Next by Date: Average Color of JPG
  • Previous by thread: Re: Read file bug?
  • Next by thread: Average Color of JPG
  • Index(es):
    • Date
    • Thread