Script that uses the clipboard

The clipboard contains a the name of a file that I want to open in BBedit, convert, save and then open in MS Word. I can record the actions in BBedit but I have to assign the contents of the clipboard to a variable(FILENAME) and use the variable in the open command as below. I don’t know how to assign the FILENAME variable nor how to use the variable in the open command with proper syntax.

tell application “BBEdit”
activate
make new text window
set FILENAME to “Clipboard” ???
open {file “G5 Office Server Drive:Upload to AMC:FILENAME”} with LF translation ???
zap gremlins text 1 of text window 1 zap action delete_gremlin with filter linefeeds, non ASCII characters and controls
save text window 1
close text window 1
close text window 1
end tell

Can I open MS Word with Applescript? If so I would like to be able to execute a macro I wrote in VisualBasic … can this be done in Applescript?
Thank you for any help.
Douglas McKibbin

Model: G5 Tower
AppleScript: 1.10
Browser: Safari 412
Operating System: Mac OS X (10.4)

Hi,

I don’t have bbedit, but it should be something like this:

activate
set FILENAME to (the clipboard) as string
set file_reference to (“G5 Office Server Drive:Upload to AMC:” & FILENAME) as alias

in the bbedit tell block.

gl,

I think now Word 2004 has one of the largest applescript dictionaries. Try this:

tell application "Microsoft Word"
	open alias "path:to:file.txt"
	do Visual Basic "Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
    .Text = \"xxxxxxxxxx\"
    .Replacement.Text = \"yyyyyyyyyy\"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll"
end tell