Re: relative / absolute paths in AS
Re: relative / absolute paths in AS
- Subject: Re: relative / absolute paths in AS
- From: Kai Edwards <email@hidden>
- Date: Mon, 07 Jan 2002 19:23:37 +0100
>
Date: Sun, 06 Jan 2002 20:49:52 +0100
>
Subject: relative / absolute paths in AS
>
From: kitshy <email@hidden>
>
To: <email@hidden>
>
>
(snip)
>
>
this is the "clean up" Script:
>
>
---
>
property myPath : " HOMEBASE :Desktop Folder:test:"
>
>
tell application "Finder"
>
activate
>
set i to 32 --incrementer
>
set s to 10 --left edge of first icon
>
set t to 30 --top edge of first icon
>
set zoomed of container window of folder myPath to true
>
select folder myPath
>
open selection
>
>
select file (myPath & " ")
>
set position of selection to {s + i * 0, t + i * 0}
>
select file (myPath & ")
>
set position of selection to {s + i * 1, t + i * 0}
>
set zoomed of container window of folder myPath to true
>
end tell
>
---
>
>
The problem is that this script is only running on my computer
>
because of the path: myPath : " HOMEBASE :Desktop Folder:test:"
>
>
On an other the computer the script does not work if it has a
>
differnt name for the harddisk.
>
>
Is it possible in AppleScript not to give a full path name? Like HTML-Links
>
where you can use a relative path? For example .../desktop/:test:?
>
So it runs on every machine?
Hi Jan!
If, apart from the name of the hard disk, the relative paths are exactly the
same on both machines, you could try something like this:
-- Start Script 1 --------------------------------------
property myPathEnd : ":Desktop Folder:test:"
tell application "Finder"
set myPath to name of startup disk & myPathEnd
--do rest of script
end tell
-- End Script 1 -----------------------------------------
If the path structures on each machine are significantly different, you may
have to resort to something much clumsier - perhaps like this:
-- Start Script 2 --------------------------------------
property myPath : "HOMEBASE:Desktop Folder:test:"
try
myPath as alias
on error
set myPath to (choose folder with prompt [NO BREAK]
"Please choose the test folder:") as string
end try
tell application "Finder"
--do rest of script
end tell
-- End Script 2 -----------------------------------------
HTH - from what I gathered from your note, I'm hoping the
Script 1 version will do the trick!
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************