From: rafa on
Hello everyone:
I have a cross platform headache. My customer wants to be able to save some
documents to the desktop when the user click the "save docs" button.

I know how to make it work on PC...makes a folder with the name I want and
saves documents in that folder. How can I make the same code work
crossplatform? This is the code I use to save a folder with documents on a PC
desktop.

on mouseup me
desk = baSysFolder( "desktop" )
ok = baCreateFolder( desk&"FOLDER NAME" )
oK = baCopyFile( the moviepath&"documents\something.pdf" , desk&"FOLDER
NAME\something.pdf" , "IfNewer" )
end if
end


Any ideas?

Rafael


From: Mike Blaustein on
The problem is that you are using '\' characters as the path delimiters.
On Mac, they would be colons ':'.

You can find the path delimiter like this:

gDelim=the last char of the moviePath

Then, everywhere that you have a backslash, replace it with

"&gDelim&"

(including the quotes). That should do it.
From: rafa on
Hey Mike...you are everywhere!

Ok...sorry, I do have a movie script as follows:
on startmovie me
global gPlatform, gDelimiter
if the platform contains "Windows" then
gPlatform="win"
gDelimiter="\"
else if the platform contains "Macintosh" then
gPlatform="mac"
gDelimiter=":"
else
gPlatform="none"
Gdelimiter="none"
end if
end
I thought that would take care of the delimiter issue, it works fine with my
"open document" code, but not with the "create folder with docs inside" code

I got director to create a folder on the desktop of the MAC, but the folder is
empty... what do you think is the problem?

From: Mike Blaustein on
The baCopyFile command will return an error code if it is not working.
That error message will tell you what is wrong.

instead of this:

oK = baCopyFile( the moviepath&"documents\something.pdf" , desk&"FOLDER
NAME\something.pdf" , "IfNewer" )

try this:

put baCopyFile( the moviepath&"documents"&gDelimiter&"something.pdf" ,
desk&"FOLDER NAME"&gDelimiter&"something.pdf" , "IfNewer" )

I switched the backslashes to "&gDelimiter&" and added the word put to
the front. Now, when it run,s it will put an error code in the message
window. Look up that code in the BuddyAPI docs and it will tell you
what the problem is.
From: rafa on
hey Mike:
I tried this, and it works...I believe the issue was the name of the file I
was trying to copy. My customer gave me a file that was 38 chars. long. I made
it 10 chars, and now it copies fine. Here is the code I used:
(Thanks for all you help)


on mouseup me
global gDelimiter
myFolderName="docs"
myDocName="presentation.ppt"
desk = baSysFolder( "desktop" )
ok = baCreateFolder( desk&myFolderName )
oK = baCopyFile( _movie.path&myFolderName&gDelimiter&myDocName,
desk&myFolderName&gDelimiter&myDocName , "IfNewer" )
alert "Documents have been copied to desktop."
end if
end