script/app...[more inside]

to certain location…any suggestions???

I am searching for an app/a script to copy all files from a disk to certain location; either on floppy-mount or drag-and-drop…any help?

Your project can be easy or hard depending on (1) if the “copy from” location changes in the sciript or if you want one script per “copy from” location; (2) whether the script will test if the files to be copied exceed the capacity of the target floppy; (3)…
Anyway I used a similar script once to backup to Zip disks. Upon insertion of a Zip disk and double-clicking on the backup script, it would copy [with replacing] all files on the Zip disk. I did it by putting alias files [of the files I wanted copied] on the Zip disk. The script looked for these files, then copied the originals to the disk.
If you want a script to continually watch for the insertion of a disk, you’ll need to use an “on idle” handler that either (a) looks for a backup disk by its special name (e.g., all backup disks begin with the word COPY) or by its size (if your Mac can mount only 1 floppy at a time, check for the size of all disks on the desktop; the floppy will be the smallest, probably).
Any drag’n’drop script will have to check for the availability of the “copy to” disk and space available on the disk, then handle the errors of the disk not existing or the space not being sufficient.

Well, the aim here is: I transfer fairly large amounts of data once in a while from school to home (at school we have PC’s—yuck) the record being 82 disks at once…
So the script I need would have to watch my floppy drive, so that when the disk is mounted it would copy all the files on the disk to folder called “New” on the disk “Cargo” (hmm, my system disk is “Engine” and applications are on “Armaments”…) I would also come in handy, if the script asked if I want to copy the contents of the floppy to given location—I mean, so that it would not copy if I did not press OK or something…
Thank you for your help,
Crimson

Your project isn’t trivial. It will take several days. Plus, I’m not that good at giving advice, so I hope somewhere else here will take me to task if some of what follows is in error.
“the script I need would have to watch my floppy drive”
on idle nn – where nn is the number os seconds to wait tell app “Finder” – check for floppy here, by size or name end end
“when the disk is mounted”
Actually, the idle handler won’t do this. It will check every nn seconds if a disk has been mounted, which is different. As far as I know, there is no way to write a script that will activate when a disk is mounted.


I do not have a floppy disk to test. But if you insert a floppy on your drive then run this script in the script editor:

tell application "Finder"
    capacity of every disk
end tell

You can determine the capacity of a floppy. Increase that number by hundred bytes or so, then use it as a property in your script.

property floppy_size : nn – where nn is that number as an integer

then
in the idle handler, do something like this

tell application "Finder"
    set floppy_name to name of first disk whose capacity is less than floppy_size
end

All this can be avoided if you name all the floppies with a recognizable prefix or suffix. For example, if all your data transfer floppies (and ONLY those floppies) had a prefix "Transfer " then the idle handler need only contain:

set floppy_name to name of first disk whose name contains "Transfer "

Also: if the floppy is the only ejectable media inserted, you can test for that
and assume that the first ejectable disk is a floppy, but only if no CDs, DVDs or Zip disks are inserted.


" it would copy all the files on the disk to folder called “New” on the disk “Cargo” (hmm, my system disk is “Engine” and applications are on “Armaments”…)"
Good names. Better than mine: Codex (text files), Curio (graphics files), Operator, Programs. I shall have to rethink my metaphors.

on idle nn
	try
		tell application "Finder"
			set floppy_name to name of first disk whose capacity is less than floppy_size
			(* if this "set" command failes, the try block skips the following command because an error is generated *)
			move every item of disk floppy_name to folder "New" of disk "Cargo" with replacing
			(* note that the "with replacing" will copy new versions of files over old versions. You may not want to do this*)
		end tell
	on error errmsg
		(* actually, we're going to ignore errors but comment out the "try" "on error" and "end try" when testing the script *)
	end try
end idle

" I would also come in handy, if the script asked if I want to copy the contents of the floppy to given location—I mean, so that it would not copy if I did not press OK or something… "

display dialog "About to copy floppy to folder New of disk Cargo" buttons {"OK", "Cancel"} default button "Cancel"
set copy_or_not to button returned of result
if copy_or_not is "OK" then
	tell application "Finder"
		move every item of disk floppy_name to folder "New" of disk "Cargo" with replacing
	end tell
end if

so:

try
	tell application "Finder"
		set floppy_name to name of first disk whose capacity is less than floppy_size
		(* if this "set" command failes, the try block skips the following command because an error is generated*)
		activate
		display dialog "About to copy floppy to folder New of disk Cargo" buttons {"OK", "Cancel"} default button "Cancel"
		set copy_or_not to button returned of result
		if copy_or_not is "OK" then
			tell application "Finder"
				move every item of disk floppy_name to folder "New" of disk "Cargo" with replacing
			end tell
		end if
	end tell
end try

so:
[no guarantees the below will work as written on your computer. It’s bare-bones and needs to be more sophisticated.]

property floppy_size : "nn" -- you need to determine this
on idle 600
	try
		tell application "Finder"
			set floppy_name to name of first disk whose capacity is less than floppy_size
			activate
			display dialog "About to copy floppy to folder New of disk Cargo" buttons {"OK", "Cancel"} default button "Cancel"
			set copy_or_not to button returned of result
			if copy_or_not is "OK" then
				move every item of disk floppy_name to folder "New" of disk "Cargo" with replacing
			end if
		end tell
	end try
end idle

My recommendation: don’t use an idle handler. It will interrupt what you’re doing, and it will sap system resources as it waits. Better to use an applescript applet and perform your task in two parts: insert floppy; double-click applet.

…no text…

Don’t thank me until it works. I found Applescript doesn’t well handle “whose” clauses that use numbers. (There is anonther note in this BBS about that.) Using the capacity to differentiate the disks may not work. Instead name, ejectable, etc. should be used.