Copying a file from A to B - not working
Karl Becker
karl at karlbecker.com
Wed Dec 31 15:41:31 EST 2003
I'm attempting to copy a bunch of disparate files from one location to
another, but it seems like the files themselves aren't quite getting
duplicated bit-for-bit. I'm using MetaCard 2.4.3.
When trying to duplicate a .png file, once I run my script, the .png
file, even though it has the same file size, does *not* display
properly at all in any image browser, nor in MetaCard, though the
original source file does. It causes a similar unviewable problem with
.gif files, too - I didn't even bother with jpeg files.
Below are the few small scripts I'm using. Is there any easier, more
straightforward way to copy files from one location to another, or even
to move a file from one place to another? I'd like it to work on both
Mac and Windows, so an AppleScript solution (unless there's a similarly
easy Windows solution) probably isn't the best.
Also, I tried the "export" command, but that loses the neat
transparency I've set up in the .png file, and I can't ask users of the
program to make a separate mask file.
To read in the entire contents of a file:
******************************************************
function getAllFile theFP
open file theFP for read
read from file theFP until eof
put it into theThang
close file theFP
return theThang
end getAllFile
******************************************************
To write the contents of a file to a loction:
******************************************************
on writeAllFile theFP, theStuff
open file theFP for write
write theStuff to file theFP
close file theFP
end writeAllFile
******************************************************
The actual script that's duplicating the .png (or any other type of)
image:
******************************************************
put the fileName of img "courseLogoBig" into logoFP
put getAllFile( logoFP ) into theLFC
put ( destinationPath&"Course_Logo_Big") into newLogoFP
writeAllFile newLogoFP, theLFC
Thanks to anyone who can give me an idea of what's going wrong,
Karl
More information about the metacard
mailing list