• 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: Simple text question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple text question


  • Subject: Re: Simple text question
  • From: KOENIG Yvan <email@hidden>
  • Date: Mon, 7 Jul 2008 21:06:16 +0200

Le 7 juil. 2008 à 20:09, Script2 a écrit :

Thanks. This worked.

But how do I write
Word 3 thru word 6 of aword to another file without loosing the special
characters.


Ruby

set thisText to "6000[F]this is test (#1).

6001[F]this is test (#2)."

set thisText to my recolle(my decoupe(thisText, "[F]"), " fFf ")
set thisText to my recolle(my decoupe(thisText, "(#1)"), " yk1yk ")
set thisText to my recolle(my decoupe(thisText, "(#2)"), " yk2yk ")

set thisText to every word of thisText

repeat with i from 1 to count of thisText
	if item i of thisText is "fFf" then set item i of thisText to "[F]"
	if item i of thisText is "yk1yk" then set item i of thisText to "(#1)"
	if item i of thisText is "yk1yk" then set item i of thisText to "(#2)"
end repeat
set words3to6 to items 3 thru 6 of thisText
log words3to6

--=============

on decoupe(t, d)
	local l
	set AppleScript's text item delimiters to d
	set l to text items of t
	set AppleScript's text item delimiters to ""
	return l
end decoupe

--=============

on recolle(l, d)
	local t
	set AppleScript's text item delimiters to d
	set t to l as text
	set AppleScript's text item delimiters to ""
	return t
end recolle

--=============

Yvan KOENIG (from FRANCE lundi 7 juillet 2008 21:05:45)


_______________________________________________ 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
  • Prev by Date: RE: Simple text question
  • Next by Date: Re: Simple text question
  • Previous by thread: Re: do shell script...password...with administrator privileges: another leopard bug?
  • Next by thread: Is there a way to check the Ctrl, Alt, Cmd, Shift state?
  • Index(es):
    • Date
    • Thread