• 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: Converting original items...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting original items...


  • Subject: Re: Converting original items...
  • From: Kai Edwards <email@hidden>
  • Date: Wed, 13 Mar 2002 22:19:14 +0000

on Wed, 13 Mar 2002 10:58:22 -0600, mjn <email@hidden> wrote:

> I have a script which acquires a list of alias files in a couple of
> different directories and I would like to modify the "original item" values
> of these aliases...
>
> So if the alias's original item matches "My File Server" I'd like to modify
> it and then if it matches "My File Server:Folder1" I want to change the
> value to "Other File Server1:Folder1" and if it matches "My File
> Server:Folder2" I'd like to change it to "Other File Server2:Folder2"...etc
>
> My problem is pulling the text of the "original item" out and examining it.
> I have dug through the Finder dictionary but I haven't found anything,
> predictably, other than Finder commands...is there a good resource for
> modifying and manipulating text and good ways to pull out these values,
> search/replace certain parts/values, and then stuff them back in?
>
> Pointers? Tips? Starting points? Ideas? Seems like this should be an
> easy task to accomplish but I'm stuck...

I hope I've got the gist of what you're after.

Try playing around with the following script to see if it gets anywhere near
what you want:

-----------------------------------------
property newServer : "Some Other Server"

on run
set filePath to switchServer(choose file)
display dialog "The new filepath is:" & [NO BREAK]
return & return & filePath --just for demo purposes
end run

to switchServer(oldFile)
set {TID, text item delimiters} to {text item delimiters, ":"}
set newFile to (newServer as list) & [NO BREAK]
(oldFile as text)'s text items's items 2 thru end as string
set text item delimiters to TID
newFile
end switchServer
-----------------------------------------

If this approaches your goal, we can then go into any necessary explanations
of how it works.

If it doesn't, (and you don't get a closer offer) well... - yell again. ;-)

Kai

--

**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Questions questions...
  • Next by Date: Re: form validation
  • Previous by thread: Re: Converting original items...
  • Next by thread: Extensis Suitcase 10 scripting
  • Index(es):
    • Date
    • Thread