1. I have written a drag and drop applescript application.
  2. I am now tring to pass files from a drag and drop in RealBasic to the applescript.
  3. how can this be done when I am not really dragging files onto the applescript in the Finder but passing them from a pushbutton in Reabasic.

Your button in Realbasic will need to pass a string to your script & the script will have to parse the string into individual file names.

Your Applescript code will be in a Run handler… Here’s an example:

on run (from_RB)
set x to from_RB as string
set oldDelim to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to “,”
set theFileList to (text items of x as list) as list
set AppleScript’s text item delimiters to oldDelim
on error
set AppleScript’s text item delimiters to oldDelim
end try

--(Now theFileList will be a list where each filename is an item)

end run

(Save the script & drag the script into the Realbasic project)

Realbasic part:
In the “Action” event of your pushbutton call the script and pass the filenames, paths or whatever else you want your script to know as a comma separated string.

For example: MyScript (“File1, File2, File3”)

I hope this helps…