Packages

Mark Smith mark at maseurope.net
Mon Dec 10 06:31:17 EST 2007


This is great! I couldn't find this anywhere. So here's a function  
that uses it - maybe someone has better code for converting the path   
to applescript.

function thePackages pFolder
     set the itemdelimiter to "/"
     if item 2 of pFolder is "Volumes" then
         delete item 1 to 2 of pFolder
     else
         put line 1 of the volumes before pFolder
     end if
     replace "/" with ":" in pFolder

     put "tell application" && quote & "Finder" & quote & cr &  
"packages of folder" && quote \
     & pFolder & quote & cr & "end tell" into tScr
     do tScr as applescript
     put the result into tList
     replace comma with cr in tList

     repeat for each line L in tList
         get wordoffset("file", L)
         put word it + 1 of L & cr after tPackages
     end repeat
     replace quote with empty in tPackages
     return char 1 to -2 of tPackages
end thePackages
On 10 Dec 2007, at 08:25, Kay C Lan wrote:

> On Dec 9, 2007 9:59 PM, Chipp Walters <chipp at chipp.com> wrote:
>
> Here's one example: I've got a product that resizes graphics, but I
>> don't want them to 'go into' a package and find and resize the
>> graphics there. How to know if you're in a 'package' or 'bundle'?
>>
>>
> Sorry, been out of the loop for a couple of days, but here's my  
> suggested
> starting point;
>
> put this in a do statement:
>
> tell application "AppleScript"
>   files of folder "Disc:folderA:folder1"
> end tell
>
> reports only Apple recognised files in the provided location
>
> tell application "AppleScript"
>   folders of folder "Disc:folderB:folder2"
> end tell
>
> reports only Apple recognised folders in the provided locations
>
> tell application "AppleScript"
>   packages of folder "Disc:folderC:folder3"
> end tell
>
> reports only Apple recognised packages in that location.
>
> For added convenience, but slightly confusing depending on which  
> side of the
> fence you're on, the packages are reported as either 'application  
> files'
> which are of course folders that are applications, and 'document  
> files'
> which are of course folders that look like files (.band,.rtfd,.key)
>
> One simple test I did, was that packages are the only folders that  
> seem to
> have a '.suffix', I've never thought anyone else would actually name a
> folder with a .suffix, so I did, and the above correctly identified  
> "test
> folder.test" as a simple folder.
>
> Sorry I haven't got around to producing the desired function, I'm a  
> little
> busy with my day job right know, but given time  I think I'd be  
> able to come
> up with something.
>
> As someone else has said, for me I've only ever needed to delve into
> packages that I've created so I know where I am and where I want  
> things to
> go. I've never really had a need to delve inside someone else's  
> package, but
> for those that do, I hope the above gets you on your way.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list