Author Topic: Strange Results  (Read 2060 times)

0 Members and 1 Guest are viewing this topic.

Offline Rabbit

  • Newbie
  • *
  • Posts: 12
  • Karma: 0
  • Gender: Male
Strange Results
« on: December 30, 2010, 03:14:31 PM »
Hi Ya'll
has anyone seen this before? it seems that the "every text item" function is not working on one of my computer. this script run fine on my main computer, but when I try to run it on an almost Identical computer it gives me an "unlisted" result. the only difference between the computer is one has Adobe CS and the other has CS 4. I'm trying to move over to the CS4 system but some of my scripts aren't working... all the ones that use this little function to break apart an text item.

set Fil_Name to "26215.14.10.008.qxd" as text
try
   set old to AppleScript's text item delimiters
   set AppleScript's text item delimiters to "."
   set Sep_Items to every text item of Fil_Name as list
   set AppleScript's text item delimiters to old
on error
   set AppleScript's text item delimiters to old
end try
Sep_Items

result {"26215.14.10.008.qxd"}

should be {"26215", "14", "10", "008", "qxd"}

This is so bizarre I think I'm going crazy... I re-installed OS 10.4 and seemed to fix it but, now it's "broke" again.

thanks for taking a look at this...
Stephen Oakes
Senior Graphic Designer
Oakes Oasis

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: Strange Results
« Reply #1 on: December 31, 2010, 10:09:58 AM »
Hi Rabbit,

AppleScript's text item delimiter should be a list not a string: try {"."} instead of ".".

HTH
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline Rabbit

  • Newbie
  • *
  • Posts: 12
  • Karma: 0
  • Gender: Male
Re: Strange Results
« Reply #2 on: January 01, 2011, 08:38:19 AM »
Thanks Michel,

That doesn't fix it...
I'm thinking that I'll have to upgrade to 10.5 that's it's a conflict with CS4 and 10.4

thanks for your help
Stephen Oakes
Senior Graphic Designer
Oakes Oasis

Offline cdms

  • Full Member
  • ***
  • Posts: 111
  • Karma: 6
  • Gender: Male
Re: Strange Results
« Reply #3 on: January 04, 2011, 11:16:34 AM »
The problem is in the line "set Sep_Items to every text item of Fil_Name as list"
note that
set Sep_Items to every text item of (Fil_Name as list)
is not the same as
set Sep_Items to (every text item of Fil_Name) as list

Unfortunately the default behaviour of Applescript appeared to change so in 10.5 you get the second one, which is correct, in 10.4 you get the first one.
Two solutions, either;
i) put the brackets in as the second case.
ii) take the as list off, "every text item" will return a list by default.

Offline Rabbit

  • Newbie
  • *
  • Posts: 12
  • Karma: 0
  • Gender: Male
Re: Strange Results
« Reply #4 on: January 07, 2011, 07:05:27 PM »
thanks for all your input everybody...

It's turns out that it is a know problem with 10.4.11 and CS4... (Illustrator to be exact.)
CS4 messes up the text/string cohesion function in 10.4 (thanks adobe.)

I found a writeup about it in some apple Dev. notes
thanks again
Stephen Oakes
Senior Graphic Designer
Oakes Oasis

Offline cdms

  • Full Member
  • ***
  • Posts: 111
  • Karma: 6
  • Gender: Male
Re: Strange Results
« Reply #5 on: January 18, 2011, 02:59:31 AM »
Just for info. I have a heavily automated box running CS4 on 10.4.11. It uses "every text item" thousands of times every day with no issues.
If you are still interested in a fix please post the latest version of your code and I will test it on this box.
Also, can you post a link to the page describing the issue with Illustrator? Thanks.