Trying to open MS Word files within droplet

I’m an extreme newbie with Applescript. I was able to download a template from the AppleScript site to help me create this script, but now I’m stuck.

property type_list : {“DOC”}
property extension_list : {“doc”}

on open these_items
repeat with i from 1 to the count of these_items
set this_item to item i of these_items
set the item_info to info for this_item
if (folder of the item_info is false) and ¬
(alias of the item_info is false) and ¬
((the file type of the item_info is in the type_list) or ¬
the name extension of the item_info is in the extension_list) then
process_item(this_item)
end if
end repeat
end open

on process_item(this_item)
tell application “Microsoft Word”
activate
open ??? :?:
do Visual Basic "Application.Run MacroName:=“Normal.NewMacros.Macro7"”
do Visual Basic “Application.Run MacroName:=“Normal.Format_PDN_Patient_Name.Format_PDN_Patient_Name””
do Visual Basic “Application.Run MacroName:=“Normal.FixCHILDNeuro.FixCHILDNeuro””
close document 1 of window 1
end tell
end process_item

I’m trying to get the script to open the documents so that the macros can be run on them – and I’m sooooo lost

open this_item
Probably you must adjust, too, the “property type_list”, to include the “file type” of word documents, eg: “W8BN” for standard Word documents or “TEXT” for plain-text-word files:

property type_list : {"W8BN", "TEXT"}

This “type” is the four-byte identifier for items used by apple from ancient times, as well as “MSWD” is the “file creator” or “creator type” of a word document, which is the unique signature of the “creator” of the document.

When you drop the files onto this script it will open one item at atime and work on it. What you are missing is the “this_item” in the open statement. The handler, by the time it has gone through the list of objects, will open one item that is listed. So put the this_item after the open command and it should work.

I win for a second! :lol:
NOTE: if you receive word files from a peezee, most probably, its type will be “missing value” (without quotes), which means “it has not type”. If you wish process these files, too, simply add “missing value” (without quotes) to the type_list…

OMIGOSH!!! It worked!!! It needed the W8BN and the this_file Exactly!!!

You guys are superb!!! Tan magnifico!!!

Muchas, muchas gracias!!! :smiley: