can't set path of original of alias file?
can't set path of original of alias file?
- Subject: can't set path of original of alias file?
- From: Wayne Clodfelter <email@hidden>
- Date: Fri, 01 Mar 2002 13:26:32 -0500
Hopefully the comments and script below are self explanatory. The script is
failing when I try to set the path of the original to which the alias
points, ie, point the alias at an identical original on the new disk.
I read in the AppleScript Language Guide that you cannot set the value of an
element of a string, but then it gives an example of modifying the content
of the string by concantenation. I am trying to do that.
I admit to some confusion between paths and strings and rules that apply to
each. Is there a way to do what I am trying to do? Can existing paths to the
originals of aliases be changed? Obviously, this is different from changing
a path to a non-alias object, since the location of the object itself does
not change as the path changes.
Enlightment will be much appreciated. Thanks.
(*Set sourceFolder to startup disk to check for bad aliases.
Create list of all alias files on startup disk.
Initialize counter i.
Loop through all aliases in list, checking that original item is from
Macintosh HD, and if so, change root of original of ALIAS from "Macintosh
HD" to "new startup disk"*)
set sourceFolder to "Seagate 2:"
set theList to FindFile in_folder sourceFolder result_type "TEXT" with
kind_is_alias and subfolders
count each item of theList
set i to 0
tell application "Finder"
repeat with loopVar from 1 to (count of theList)
set tempPath to item (1 + i) of theList as alias
set pathOfOriginal to the original item of tempPath as string
if first word of pathOfOriginal is "Macintosh" then
set (path of item (1 + i) of theList) to "Seagate HD" & ,
(get characters 10 thru -1 of (item (1 + i) of theList)) as string
(*previous line gets error: can't set path of "Seagate 2:EXTs (Mac
HD alias)" to "Seagate 2:EXTs (Mac HD alias)". Wording is identical*)
set i to i + 1
else
set i to i + 1
end if
end repeat
end tell
Regards,
Wayne
Wayne Clodfelter <email@hidden>
"Well, if you wanta talk fishin', I guess that'll be OK" ...Lynyrd Skynyrd
in 3Ask me no Questions3
Visit our web page, TROUT, NC on the web, at
http://www.troutnc.com
==========================================================================
_______________________________________________
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.