Re: scripting for Adobe Illustrator error
Re: scripting for Adobe Illustrator error
- Subject: Re: scripting for Adobe Illustrator error
- From: Steve Mills <email@hidden>
- Date: Mon, 17 Oct 2016 11:48:19 -0500
This isn't that hard to debug. So Script Editor selects the offending object for you, which is "item 1" in the line:
set TheSize to item 1 of my RemoveComonList(Sizes2, Sizes1)
So now you know that the result of RemoveComonList [sic] is an empty list, because there is no item 1 in it. That means that, if you infer what the author meant by "remove common list", the function is probably supposed to return those items which are unique in each list. Maybe. Who knows, since they didn't leave any comments. Regardless, this code:
if length of Sizes1 is greater than length of Sizes2 then
set TheSize to item 1 of my RemoveComonList(Sizes1, Sizes2)
else
set TheSize to item 1 of my RemoveComonList(Sizes2, Sizes1)
end if
isn't really correct, since it's assuming that the "else" can correctly handle the case when the size of both lists is the same. That's the problem. The lists are exactly the same, so there are no unique items, so you get an empty list. The logical thing to do would be:
if length of Sizes1 is not length of Sizes2 then
if length of Sizes1 is greater than length of Sizes2 then
set TheSize to item 1 of my RemoveComonList(Sizes1, Sizes2)
else
set TheSize to item 1 of my RemoveComonList(Sizes2, Sizes1)
end if
—beep
set TOOLS to every window whose size is TheSize
if TOOLS is {} then
my do_submenu("Adobe Illustrator", "Window", "Tools", "Default")
set TOOLS to every window whose size is TheSize
end if
—beep
tell item 1 of TOOLS
set WindowPosition to position
set item 1 of WindowPosition to (item 1 of WindowPosition) + (item 1 of clicker)
set item 2 of WindowPosition to (item 2 of WindowPosition) + (item 2 of clicker)
get WindowPosition
end tell
end if
--
Steve Mills
Drummer, Mac geek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden