Hi everyone,
Although
I've
been using macs for 15 years now I'm a newbie to scripting. I never knew it was so accessable. I wish I had delved
into
it before as I'm here now out of neccessity and need to solve a work flow issue quick.
To that end if anyone
can
give me some pointers on angle of attack to the follwing workflow that I need to script it will be very
much
appreciated.
START OF TASK
I have 142 folders on a disk.
Inside these folders are quark
documents,
varying amounts of 3 to 7 documents.
While all the document filenames are individual, there is 7 ways and 7
ways
only that the filenames end in all the documents in the 142 folders:
"(100x192)" "(80x75)" "(180x192)"
"(200x114)"
"(230x36)" "(280x75)" "(280x153)"
Now, for example, all the files ending with "(100x193)" I need to resize
that
quark document using Proscale to another set amount of sizes... eg 130mm x 193mm, 80mm x 193mm etc etc. Every new
sized
version has to be saved into the same folder as the original file with a new file name... a number relating to the
size
e.g. 130mm x 193mm could be file size 8 and have "8" as it's filename.
END OF TASK
I know the
quarkxpress
xtension proscale will be a sticky point in the script, but I am going to talk to GLUON who produced proscale
about
making it scriptable.
Even for me to get the point of being able to put together a script that opens
documents
with a certain partial filename will be a step forward for me.
Thanks in advance to anybody who
can
help.
Tim
On Mon, 26 Jan 2009 04:59:30 -0800 (PST)
email@hidden
wrote:
> Send AppleScript-Users mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.apple.com/mailman/listinfo/applescript-users
>
or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
>
When replying, please edit your Subject line so it is more specific
> than "Re: Contents of AppleScript-Users
digest..."
>
>
> Today's Topics:
>
> 1. Flattening Nested Lists (Rick Gordon)
>
2. Re: Flattening Nested Lists (Barry Wainwright)
> 3. Re: Flattening Nested Lists (Rick Gordon)
> 4.
Re: Flattening Nested Lists (Brian Christmas)
> 5. Re: Flattening Nested Lists (Michael Schmidt (BRT))
>
6. Re: Flattening Nested Lists (Philip Aker)
> 7. Re: Flattening Nested Lists (Mark J. Reed)
> 8. Re:
Flattening Nested Lists (Philip Aker)
> 9. resizing quark docs script (email@hidden)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
>
Date: Mon, 26 Jan 2009 01:30:31 -0800
>From: Rick Gordon <email@hidden>
> Subject: Flattening
Nested Lists
> To: email@hidden
> Message-ID: <
p06230910c5a3323036cf@[192.168.1.69]>
>
Content-Type: text/plain; charset="us-ascii"
>
> I'm spending too much time trying to do something that I
think
>should be easy enough: flattening a list of lists (of lists (of
>lists)), so that the the result is
a list containing no list
>elements. Can someone point me to some code or instruction on
>handling this?
I'm figuring that it probably takes a recursive
>handler, but I'm getting recursed in my own mind, at this
point.
> --
>
> ___________________________________________________
>
> RICK
GORDON
> EMERALD VALLEY GRAPHICS AND CONSULTING
> ___________________________________________________
>
> WWW: http://www.shelterpub.com
>
>
> ------------------------------
>
>
Message: 2
> Date: Mon, 26 Jan 2009 09:52:27 +0000
>From: Barry Wainwright <email@hidden>
>
Subject: Re: Flattening Nested Lists
> To: Applescript Applescript Users
><email@hidden>
>
Message-ID: <
email@hidden>
> Content-Type: text/plain; charset=US-ASCII;
format=flowed; delsp=yes
>
>
> On 26 Jan 2009, at 09:30, Rick Gordon wrote:
>
>> I'm
spending too much time trying to do something that I think
>> should be easy enough: flattening a list of
lists (of lists (of
>> lists)), so that the the result is a list containing no list
>> elements.
Can someone point me to some code or instruction on
>> handling this? I'm figuring that it probably takes a
recursive
>> handler, but I'm getting recursed in my own mind, at this point.
>> --
>
>
> set aList to {{"item 1", "item 2", {"item 1", "item 2", "item 3"}},
>
> {"item 1", "item
2", "item 3"}, "item 3"}
> set newList to {}
> my flattenList(aList)
> newList
>
> on
flattenList(theList)
> global newList
> repeat with anItem in theList
> if class of anItem is list
then
> my flattenList(anItem)
> else
> copy anItem to end of newList
> end if
>
end repeat
> end processList
>
>
> --
> Barry
>
>
>
>
------------------------------
>
> Message: 3
> Date: Mon, 26 Jan 2009 02:15:16 -0800
>From:
Rick Gordon <email@hidden>
> Subject: Re: Flattening Nested Lists
> To: Applescript Applescript
Users
><email@hidden>
> Message-ID: <
p06230911c5a33d7cdc8d@[192.168.1.69]>
>
Content-Type: text/plain; charset="us-ascii"
>
> Thanks, Barry.
>
> ------------------
>
> On 1/26/09 at 9:52 AM +0000, Barry Wainwright wrote in a message
>entitled
> "Re: Flattening
Nested Lists":
>
>>On 26 Jan 2009, at 09:30, Rick Gordon wrote:
>>
>>>I'm spending
too much time trying to do something that I think should
>>>be easy enough: flattening a list of lists (of
lists (of lists)), so
>>>that the the result is a list containing no list elements. Can
>>>someone point me to some code or instruction on handling this? I'm
>>>figuring that it
probably takes a recursive handler, but I'm getting
>>>recursed in my own mind, at this
point.
>>
>>
>>set aList to {{"item 1", "item 2", {"item 1", "item 2", "item 3"}},
>>{"item 1", "item 2", "item 3"}, "item 3"}
>>set newList to {}
>>my
flattenList(aList)
>>newList
>>
>>on flattenList(theList)
>> global
newList
>> repeat with anItem in theList
>> if class of anItem is list then
>> my
flattenList(anItem)
>> else
>> copy anItem to end of newList
>> end if
>> end
repeat
>>end flattenList
>
> --
>
> ___________________________________________________
>
> RICK GORDON
> EMERALD VALLEY GRAPHICS AND CONSULTING
> ___________________________________________________
>
> WWW: http://www.shelterpub.com
>
>
> ------------------------------
>
>
Message: 4
> Date: Mon, 26 Jan 2009 22:13:01 +1100
>From: Brian Christmas <email@hidden>
>
Subject: Re: Flattening Nested Lists
> To: applescript-users-request <email@hidden>
>
Message-ID: <
email@hidden>
> Content-Type: text/plain;
charset="us-ascii"
>
>
> On 26/01/2009, at 9:15 PM, Rick Gordon wrote:
>
>> Thanks,
Barry.
>>
>> ------------------
>>
>> On 1/26/09 at 9:52 AM +0000, Barry Wainwright
wrote in a message
>> entitled
>> "Re: Flattening Nested Lists":
>>
>>> On 26
Jan 2009, at 09:30, Rick Gordon wrote:
>>>
>>>> I'm spending too much time trying to do
something that I think
>>>> should be easy enough: flattening a list of lists (of lists (of
>>>> lists)), so that the the result is a list containing no list
>>>> elements. Can
someone point me to some code or instruction on
>>>> handling this? I'm figuring that it probably takes
a recursive
>>>> handler, but I'm getting recursed in my own mind, at this
point.
>>>
>>>
>>> set aList to {{"item 1", "item 2", {"item 1", "item 2", "item
3"}},
>>>
>>> {"item 1", "item 2", "item 3"}, "item 3"}
>>> set newList to
{}
>>> my flattenList(aList)
>>> newList
>>>
>>> on
flattenList(theList)
>>> global newList
>>> repeat with anItem in theList
>>> if
class of anItem is list then
>>> my flattenList(anItem)
>>> else
>>> copy
anItem to end of newList
>>> end if
>>> end repeat
>>> end
flattenList
>>
>
> Of course, if you want the list flattened as a list of items,
>instead
> of an expanded list of lists, just coerce the variable, so...
>
> global newList
> set aList
to {{"item 1", "item 2", {"item 1", "item 2", "item 3"}},
>
> {"item 1", "item 2", "item 3"}, "item
3"}
> set newList to {}
> set extendlist to {}
> my flattenList(aList)
> newList
>
>
> on flattenList(theList)
> repeat with anItem in theList
> if class of anItem is list
then
> my flattenList(anItem)
> else
> set end of newList to anItem as text
> end
if
> end repeat
> end flattenList
>
>
> Regards
>
> Santa
>
-------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>http://lists.apple.com/mailman/private/applescript-users/attachments/20090126/dfbd62cf/attachment.html
>
> ------------------------------
>
> Message: 5
> Date: Mon, 26 Jan 2009 13:30:15
+0100
>From: "Michael Schmidt (BRT)" <email@hidden>
> Subject: Re: Flattening
Nested Lists
> To: Applescript Liste <email@hidden>
> Message-ID:
<
email@hidden>
> Content-Type: text/plain; charset=MACINTOSH;
delsp=yes;
>format=flowed
>
> @Brian Christmas:
> But that does not work on a list
like
> set aList to {{"item 1", 5, {"item 1", "item 2", "item 3"}}, {"item
>
> 1", "item 2", "item
3"}, "item 3"}
> because everything is coerced to text.
>
> If you have a list of strings only, you
can also use this:
>
> on flattenList(theList)
> set retour to {}
> if theList {}
then
> set AppleScript's text item delimiters to "\", \""
> set retour to run script "{\"" & theList
& "\"}"
> set AppleScript's text item delimiters to ""
> end if
> return retour
> end
flattenList
>
> Greetings from Hamburg,
> Michael Schmidt
>
> Am 26.01.2009 um 12:13
schrieb Brian Christmas:
>
>>
>> On 26/01/2009, at 9:15 PM, Rick Gordon
wrote:
>>
>>> Thanks, Barry.
>>>
>>> ------------------
>>>
>>>
On 1/26/09 at 9:52 AM +0000, Barry Wainwright wrote in a message
>>> entitled
>>> "Re:
Flattening Nested Lists":
>>>
>>>> On 26 Jan 2009, at 09:30, Rick Gordon
wrote:
>>>>
>>>>> I'm spending too much time trying to do something that I think
>>>>> should be easy enough: flattening a list of lists (of lists (of
>>>>>
lists)), so that the the result is a list containing no list
>>>>> elements. Can someone point me to
some code or instruction on
>>>>> handling this? I'm figuring that it probably takes a recursive
>>>>> handler, but I'm getting recursed in my own mind, at this point.
>>>>
>>>>
>>>>
set aList to {{"item 1", "item 2", {"item 1", "item 2", "item
>>>> 3"}}, {"item 1", "item 2", "item
3"}, "item 3"}
>>>> set newList to {}
>>>> my flattenList(aList)
>>>>
newList
>>>>
>>>> on flattenList(theList)
>>>> global
newList
>>>> repeat with anItem in theList
>>>> if class of anItem is list
then
>>>> my flattenList(anItem)
>>>> else
>>>> copy anItem to end
of newList
>>>> end if
>>>> end repeat
>>>> end
flattenList
>>>
>>
>> Of course, if you want the list flattened as a list of items,
>> instead of an expanded list of lists, just coerce the variable,
>>so...
>>
>>
global newList
>> set aList to {{"item 1", "item 2", {"item 1", "item 2", "item 3"}},
>>
>>
{"item 1", "item 2", "item 3"}, "item 3"}
>> set newList to {}
>> set extendlist to {}
>> my
flattenList(aList)
>> newList
>>
>>
>> on flattenList(theList)
>> repeat
with anItem in theList
>> if class of anItem is list then
>> my flattenList(anItem)
>>
else
>> set end of newList to anItem as text
>> end if
>> end repeat
>> end
flattenList
>>
>>
>> Regards
>>
>> Santa
>>
_______________________________________________
>> Do not post admin requests to the list. They will be
ignored.
>> AppleScript-Users mailing list (applescript-
>> email@hidden)
>>
>> email@hidden
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>>
This email sent to email@hidden
>
>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 26 Jan 2009 04:35:38 -0800
>From: Philip Aker
<email@hidden>
> Subject: Re: Flattening Nested Lists
> To: "Michael Schmidt (BRT)"
<email@hidden>
> Cc: Scriptease <email@hidden>
>
Message-ID: <
email@hidden>
> Content-Type: text/plain;
charset="utf-8"
>
> On 2009-01-26, at 04:30:15, Michael Schmidt (BRT) wrote:
>
>> If you
have a list of strings only, you can also use this:
>
>> on flattenList(theList)
>> set retour
to {}
>> if theList â {} then
>> set AppleScript's text item delimiters to "\",
\""
>> set retour to run script "{\"" & theList & "\"}"
>> set AppleScript's text item
delimiters to ""
>> end if
>> return retour
>> end flattenList
>
> Try
this:
>
> global gFlatList
> on FlattenList(theList)
> global gFlatList
> repeat with i
in theList
> if (class of i is list) then
> my FlattenList(i)
> else
> set end of
gFlatList to contents of i
> end if
> end repeat
> end FlattenList
>
> set deep to
{{"item 1", 0, {"item 3", "item 4", "item 5"}},
> {{name:"Michael"}, "item 7", "item 8"}, 999}
> set
gFlatList to {}
> my FlattenList(deep)
> gFlatList
>
>
> Philip Aker
> echo
email@hidden@nl | tr a-z@. p-za-o.@
>
> Democracy: Two wolves and a sheep voting on lunch.
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>http://lists.apple.com/mailman/private/applescript-users/attachments/20090126/3e55f1bb/attachment.html
>
> ------------------------------
>
> Message: 7
> Date: Mon, 26 Jan 2009 07:46:47
-0500
>From: "Mark J. Reed" <email@hidden>
> Subject: Re: Flattening Nested Lists
> To:
Philip Aker <email@hidden>, "Michael Schmidt (BRT)"
> <email@hidden>, Scriptease
>
<email@hidden>
> Message-ID:
> <
email@hidden>
>
Content-Type: text/plain; charset=UTF-8
>
> Why do all these solutions use globals? Is it a performance
thing?
> (Kneejerk: globals bad!)
>
>
>
> On 1/26/09, Philip Aker
<email@hidden> wrote:
>> On 2009-01-26, at 04:30:15, Michael Schmidt (BRT)
wrote:
>>
>>> If you have a list of strings only, you can also use this:
>>
>>>
on flattenList(theList)
>>> set retour to {}
>>> if theList â {} then
>>>
set AppleScript's text item delimiters to "\", \""
>>> set retour to run script "{\"" & theList
& "\"}"
>>> set AppleScript's text item delimiters to ""
>>> end if
>>>
return retour
>>> end flattenList
>>
>> Try this:
>>
>> global
gFlatList
>> on FlattenList(theList)
>> global gFlatList
>> repeat with i in
theList
>> if (class of i is list) then
>> my FlattenList(i)
>> else
>>
set end of gFlatList to contents of i
>> end if
>> end repeat
>> end
FlattenList
>>
>> set deep to {{"item 1", 0, {"item 3", "item 4", "item 5"}},
>>
{{name:"Michael"}, "item 7", "item 8"}, 999}
>> set gFlatList to {}
>> my
FlattenList(deep)
>> gFlatList
>>
>>
>> Philip Aker
>> echo
email@hidden@nl | tr a-z@. p-za-o.@
>>
>> Democracy: Two wolves and a sheep voting on
lunch.
>>
>>
>
> --
> Sent from Gmail for mobile | mobile.google.com
>
> Mark J. Reed <email@hidden>
>
>
> ------------------------------
>
> Message: 8
> Date: Mon, 26 Jan 2009 04:53:45 -0800
>From: Philip Aker
<email@hidden>
> Subject: Re: Flattening Nested Lists
> To: Mark J.Reed
<email@hidden>
> Cc: Scriptease <email@hidden>
> Message-ID:
<
email@hidden>
> Content-Type: text/plain; charset="us-ascii"
>
> On 2009-01-26, at 04:46:47, Mark J. Reed wrote:
>
>> Why do all these solutions use globals?
Is it a performance thing?
>> (Kneejerk: globals bad!)
>
> You're correct. A better plan is to use
a parameter for output.
> In many cases though I believe there will be performance
>improvements
>
using Serge/Garvey techniques or making it a script.
>
> on FlattenList(theList, outResult)
> repeat
with i in theList
> if (class of i is list) then
> my FlattenList(i, outResult)
> else
>
set end of outResult to contents of i
> end if
> end repeat
> end FlattenList
>
>
set deep to {{"item 1", 0, {"item 3", "item 4", "item 5"}},
> {{name:"Michael"}, "item 7", "item 8"},
999}
> set outResult to {}
> my FlattenList(deep, outResult)
> outResult
>
>
>
Philip Aker
> echo email@hidden@nl | tr a-z@. p-za-o.@
>
> Democracy: Two wolves and a sheep
voting on lunch.
>
> -------------- next part --------------
> An HTML attachment was
scrubbed...
> URL:
>http://lists.apple.com/mailman/private/applescript-users/attachments/20090126/dbee6e3b/attachment.html
>
> ------------------------------
>
> Message: 9
> Date: Mon, 26 Jan 2009 12:58:49
+0000
>From: <email@hidden>
> Subject: resizing quark docs script
> To:
<email@hidden>
> Message-ID: <
email@hidden>
> Content-Type:
text/plain; charset="us-ascii"
>
> An HTML attachment was scrubbed...
> URL:
>http://lists.apple.com/mailman/private/applescript-users/attachments/20090126/1d3b3b09/attachment.html
>
> ------------------------------
>
> _______________________________________________
>
AppleScript-Users mailing list
> email@hidden
> http://lists.apple.com/mailman/listinfo/applescript-users
>
> End of AppleScript-Users Digest, Vol 6, Issue 38
> ************************************************