Re: Help duplicating file, desesperated
Re: Help duplicating file, desesperated
- Subject: Re: Help duplicating file, desesperated
- From: Bill White <email@hidden>
- Date: Wed, 05 May 2004 08:14:26 -0400
>
-Getting the name of the disk
>
set chav to (path to me) as string
>
set vol to text item 1 of chav
>
>
tell application "Finder"
>
activate
>
-- vol is "diskname"
>
-- chemin is a string "folder:file.pdf"
>
set theFileToDuplicate to vol & ":" & chemin
>
-- How can I convert "theFileToDuplicate" to a string?, is this
>
going wrong?
>
>
set theFolderToRecieveFile to choose folder with prompt "Where don
>
you want to write file?"
>
duplicate theFileToDuplicate to theFolderToRecieveFile
>
end tell
>
>
I doesn't work
>
I'm desesperated looking for the problem, what can I do?
Razi,
There are two small problems here. The first is that "text item 1 of chav"
is giving you just the first letter of the path name, not the whole volume
name. The other problem is theFileToDuplicate is just a string, and when you
go to duplicate it you need to refer to it as a "file."
Try the following:
set chav to (path to me) as string
set AppleScript's text item delimiters to ":"
set vol to text item 1 of chav
set AppleScript's text item delimiters to ""
tell application "Finder" -- "activate" isn't needed here
set theFileToDuplicate to vol & ":" & chemin
set theFolderToRecieveFile to choose folder with prompt "Where do you
want to write file?"
duplicate file theFileToDuplicate to theFolderToRecieveFile
end tell
Hope that helps.
Bill
_______________________________________________
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.