Economy-x-Talk - Sample Scripts
Drag N Drop files (AppleEvents)
Modify HyperCard's BNDL resource so you can drop clippings or any files, on HyperCard. Open HyperCard in ResEdit. Open the BNDL resource. Type Command-K (for New Resource). Put **** in the text field. Quit ResEdit and save your changes. Delete any copies of HyperCard which have the unmodified bundle. Rebuild your desktop. Of course, now you need to add an "on appleevent" handler which handles the "open" event you get from dropping files onto HyperCard. This is the one that will tell you what file to munge. My handler only does PICT and TEXT files, but the start of it is thus:
-- By Jon Pugh
on appleEvent theClass, theID
if theClass & theID = "miscdosc" then -- fix from Kevin for Do Script spec
request appleEvent data
put it into fileName
if there is not a file fileName then
pass appleEvent
else
open file fileName
read from file fileName until eof
if the result is not empty then exit appleEvent
close file fileName
do it
end if
else if theClass & theID = "aevtodoc" then
request appleEvent data
put it into theFiles
repeat with i = 1 to number of lines of theFiles
get line i of theFiles
put FileType(it) into theType -- Need external that gets the file type
if theType = "XXXX" then
-- your code goes here
end if
end repeat
else pass appleEvent
end appleEvent
Keep this extensive resource of tutorials and samples on-line! Support RunRev.info!
| Yes, this script is useful. I make a donation and choose freely how much I want to donate on-line (PayPal). Click here if you want to make a donation in dollars. | This script has not (completely) solved my problem and I want Economy-x-Talk to take care of it. Let me contact you. |
Copyright©2002-2008 by Mark Schonewille, Nijmegen, the Netherlands. This web site is in no way affiliated with Runtime Revolution Ltd., but we do recommend the Revolution development platform.