• 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
Re: Satimage or AppleScript Text Parsing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Satimage or AppleScript Text Parsing


  • Subject: Re: Satimage or AppleScript Text Parsing
  • From: Emmanuel <email@hidden>
  • Date: Thu, 3 Mar 2005 21:59:14 +0100

At 3:01 PM -0500 3/3/05, Christopher MJ Tangora wrote:

set blah to change "1:A" in ("1:A700B700C1       :") into ""


When I do that i get "1:A700B700C1       :" returned as a list.

I get that returned as a string, not a list.

Maybe you used yourself braces instead of parentheses? Be aware that "change" can work on lists, so if you pass a list of strings (even a list of one string) it will return a list of string(s).

Eventually I would want to use the change command to reference a file (alias), but I can't even get it to work with a string, how can I get it to work with a file? The text file we have looks something like this...

When you pass a file as the "in" parameter, "change" returns the changed string, but the file is unchanged.


Thus if you want to change the file, you have to write yourself the changed string:

set s to change "this" into "that" in (alias "the file")
set r to open for access (alias "the file") with write permission
set eof r to 0
write s to r
close access r

"[C10]Item One1:A700B700C1       :[J8]Date and Time One.9:P350N    9600E20:1:A1000B1000C4       :[C10]Item Two1:A700B700C1       :[J8]Date and Time Two9:P350N    9600E20: ... and so on and so on.

You are not making very clear what you are attempting to do, but I suppose you would want to use a regular expression (don't forget to specify "with regexp"). Maybe you will be interested by the documentation for the regular expressions, at:


<http://www.satimage-software.com/en/reg_exp.html>

Finally, if your file is a Unicode file you can't use the Satimage osax. You've got to use a Unicode text search-and-replace. This is not in the Satimage osax, but - you're still lucky - it's in Smile (an app, while Satimage is an osax.) It's free as well. The commands work like "find text" and "change", except it's "ufind text" and "uchange". (Unlike "change", "uchange" *does* change a file.) More information at:

<http://www.satimage.fr/software/en/text_utf_re_xml.html>

Emmanuel
From Satimage-software, the authors of the Satimage osax, of Smile, and more.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Satimage or AppleScript Text Parsing (From: Christopher MJ Tangora <email@hidden>)

  • Prev by Date: Re: Accessing network entities
  • Next by Date: Re: question about iPhoto scripting
  • Previous by thread: Satimage or AppleScript Text Parsing
  • Next by thread: Locating files on a server volume
  • Index(es):
    • Date
    • Thread