• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Fwd: Problem with repeat command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Problem with repeat command


  • Subject: Fwd: Problem with repeat command
  • From: "Mark J. Reed" <email@hidden>
  • Date: Fri, 28 Oct 2005 14:25:16 -0400

Forgot to hit reply-all.

---------- Forwarded message ----------
From: Mark J. Reed <email@hidden>
Date: Oct 28, 2005 2:24 PM
Subject: Re: Problem with repeat command
To: "francois.houle" <email@hidden>



On 10/28/05, francois.houle <email@hidden > wrote:
Ok for the big repeat loop idea.However, how do I put it outside of the tell statements... If I put the start of the repeat loop before the tell app Entourage, it states the variable is not set. If I put it inside of that tell statement, then the end repeat has to be before the end tell for entourage.. Just not sure how to implement a repeat loop for all of this.
The reason for saving to word is because I really dislike the way it saves and looks in the text files in txt format.  

Here's a version of your script that works OMM.  The changes were relatively minor; you should examine them.

Oh, and for the record, "get default file path file path type documents path" has got to be the most confusing AS command ever - or, perhaps, second to 'set default file path file path type documents path path "some path goes here"'. :)


tell application "Microsoft Entourage" to set selectedMessages to current messages

if selectedMessages is {} then
    display dialog "Please select a message first and then run this
script." with icon 1
    return
end if

tell application "Microsoft Word"
    set originalPath to (get default file path file path type documents path)
    set default file path file path type documents path path "Macintosh HD:Users:myuser:Documents:Entourage dump"
end tell

repeat with theMessage in selectedMessages
    tell application "Microsoft Entourage"
        set theName to subject of theMessage
        set theContent to content of theMessage
    end tell
    display dialog theName
    set fileName to do shell script "echo " & quoted form of theName & " | tr '[:punct:]' ' '"
    tell application "Microsoft Word"
        set newDoc to make new document
        set name of font object of text object of newDoc to "Times New
Roman"
        set oRange to create range active document start 0 end 0
        set content of oRange to theContent
        set oRange to change end of range oRange by a word item extend type by selecting
        save as newDoc file name fileName
        close document theName
    end tell
end repeat

tell application "Microsoft Word" to set default file path file path type documents path path originalPath


--
Mark J. Reed <email@hidden>


--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Problem with repeat command (From: "Mark J. Reed" <email@hidden>)
 >Re: Problem with repeat command (From: "francois.houle" <email@hidden>)

  • Prev by Date: making applescript wait until shell script finishes
  • Next by Date: Re: making applescript wait until shell script finishes
  • Previous by thread: Re: Problem with repeat command
  • Next by thread: RE: Problem with repeat command
  • Index(es):
    • Date
    • Thread