Okay, I have everything working except one hiccup. I got Micosoft Word to save the doc to the desktop and then close the word doc, I got TextEdit to create a new doc and paste the text to the doc, and everything flows nicely into place in Quark, a field comes up and asks what to name the new file, I name it, and it saves the new file in a special folder and closes the TextEdit doc and everything is buttoned up and ready for the next word doc.
But once I drag and drop the word doc onto this script, I cant get word to select the document that just opened, even if I switch the application in the open some_items to Microsoft Word.
on open some_items
tell application "TextEdit"
open every item of some_items
end tell
end open
tell application "Microsoft Word"
launch
activate
get document 1
do Visual Basic "Selection.WholeStory"
end tell
tell application "System Events"
tell process "Microsoft Word"
keystroke "c" using command down
end tell
end tell
tell application "Microsoft Word"
close document 1
end tell
tell application "TextEdit"
launch
activate
make new document
end tell
tell application "System Events"
tell process "TextEdit"
keystroke "v" using command down
end tell
end tell
tell application "TextEdit"
tell document 1
set textToCopy to (get every paragraph whose first word is "Pay")
end tell
end tell
--this opens the Quark file and flows the text into the text box
tell application "Finder"
activate
open document file "test_file.qxd" of folder "Desktop" of folder "me" of folder "Users" of startup disk
end tell
tell application "QuarkXPress"
tell document 1
set story 1 of text box 1 to textToCopy
end tell
end tell
tell application "TextEdit"
activate
tell document 1
set textToCopy to (get every paragraph whose first word is "Whatever")
end tell
end tell
--this opens the Quark file and flows the text into the text box
tell application "QuarkXPress"
tell document 1
set story 1 of text box 2 to textToCopy
end tell
end tell
tell application "TextEdit"
activate
tell document 1
set textToCopy to (get every paragraph whose first word is "client")
end tell
end tell
tell application "QuarkXPress"
tell document 1
set story 1 of text box 3 to textToCopy
delete (characters 1 thru 11) of story 1 of text box 3
end tell
end tell
tell application "TextEdit"
activate
tell document 1
set textToCopy to (get last paragraph)
end tell
end tell
--this opens the Quark file and flows the text into the text box
tell application "QuarkXPress"
tell document 1
tell page 2
set story 1 of text box 1 to textToCopy
end tell
end tell
end tell
tell application "TextEdit"
activate
tell document 1
set textToCopy to (get every paragraph whose first word is "client")
end tell
end tell
--this opens the Quark file and flows the text into the text box
tell application "QuarkXPress"
tell document 1
tell page 2
set story 1 of text box 2 to textToCopy
end tell
end tell
end tell
tell application "QuarkXPress"
tell document 1
tell page 2
set story 1 of text box 3 to textToCopy
delete (characters 1 thru 11) of story 1 of text box 3
end tell
end tell
end tell
tell application "TextEdit"
close document 1 saving no
end tell
--this action locates the Quark file opened above for Quark to access
tell application "Finder"
activate
open document file "Test_file.qxd" of folder "Desktop" of folder "me" of folder "Users" of startup disk
end tell
--this action opens a dialog box for the user to name the file. Then it saves the file in the appropriate folder and closes it
tell application "QuarkXPress"
activate
get document 1
set doc to document 1
display dialog ("save doc as") default answer "8483_" with icon note
set nom to text returned of result
save doc in ("Macintosh HD:Users:me:Desktop:FileTarget:" & nom)
close document 1
end tell