|
From: rafa on 10 Apr 2008 15:56 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 10 Apr 2008 16:02 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 10 Apr 2008 16:15 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 10 Apr 2008 16:24 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 10 Apr 2008 16:53 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
|
Next
|
Last
Pages: 1 2 Prev: D11: Has text input in LDM?s been fixed? Next: LDM?s, moveable sprites, and stage updates |