Firstly, the 2 Buddy API functions you are using return values that you should monitor - they will tell you if an error occurred.
It's not clear why you start by creating a folder, but I'll assume this is the target for your file copy operation. In most cases it's better to allow the user to choose their own folder, and this can be achieved with baGetFolder().
In order to locate the user's "home" folder, on either WIndows or Mac, you would use baSysFolder("personal").
Try the following:
on mouseUp me -- place potential target folder into a local variable for later use: sDestinationFolder = baSysFolder("personal") -- give the end-user a chance to change the target folder: sDestinationFolder = baGetFolder(sDestinationFolder, "Choose a folder to copy into", 1 + 2, "Select a folder", -1, -1) -- did they choose a folder, or Cancel? if sDestinationFolder = EMPTY then -- they chose Cancel, so exit this handler: exit end if -- does the target folder exist? (it really should, since the folder-select dialog was used) if baFolderExists(sDestinationFolder) then -- let's create it bCreated = baCreateFolder(sDestinationFolder) -- check for error if bCreated <> 1 then -- folder creation failed, post an error message and exit: OK = baMsgBox("Failed to create destination folder", "Error", "OK", "stop", 1) exit end if end if -- we now have a target folder to copy into -- let's cache the folder containing the source files into a variable for ease-of-use: -- (assuming your MIDI files are in a folder named "midi" BESIDE the current movie -- alternatively, use _player.applicationPath to make a relative path from the projector) sSourceFolder = _movie.path & "midi" -- start copying bSuccess = baXCopyProgress(sSourceFolder, sDestinationFolder, "*.mid", "IfNotExist", TRUE, "Copying Files...", "Cancel", 0) -- check for error: if bSuccess <> 0 then -- see BudAPI docs for numbers and their meaning - the following is a direct copy case bSuccess of 1: sMsg = "Invalid Source file name" 2: sMsg = "Invalid Dest file name" 3: sMsg = "Error reading the Source file" 4: sMsg = "Error writing the Dest file" 5: sMsg = "Couldn't create directory for Dest file" 6: sMsg = "Dest file exists" 7: sMsg = "Dest file is newer that Source file" 8: sMsg = "No files matched the specified type" 9: sMsg = "User cancelled the copy" end case -- post error message to user: OK = baMsgBox("Error copying files:" &RETURN& sMsg, "Error", "OK", "stop", 1) end if end
Your code gave me something to work with. I'm a bit rusty on my lingo and scripting in Director. Never thought to define the string as a variable. As far as giving them a choice to copy the files to where they want I'm of the mindset that would be best, however the client software that they can choose to install points them to that location and for the quick burn turn around of this project they do not want to redo application installers or PDF manuals at this time...so you know how it goes. I advised the client of this idea of giving the end user the choice and was promptly told...not an option at this time.
I advised the client of this idea of giving the end user the choice and was promptly told...not an option at this time.
So is there any part of the puzzle you still need help with?