Loading ...
Sorry, an error occurred while loading the content.

How to: Open and Append Document

Expand Messages
  • griffin239
    Here is the meat of the script I m using. --It runs my front document in murgaLua, all well and good. tell application Terminal activate set
    Message 1 of 2 , Mar 19, 2010
    • 0 Attachment
      Here is the meat of the script I'm using.
      --It runs my front document in murgaLua, all well and good.
      tell application "Terminal"
      activate
      set shellscriptString to "/usr/bin/murgalua " & SQ & documentPath & SQ as text
      --set the contents of the front window to shellscriptString
      do script shellscriptString
      set the clipboard to contents of the front window as text
      set ds to contents of the front window as string
      end tell

      -- Here is where I'm going woefully wrong
      tell application "SubEthaEdit"
      set myf to make new document
      set myf to the front document
      set contents of the front document to ds
      end tell
      -- from that chunk i'm getting many many 'untitled' documents.

      My question is how do I set it up so the same document is always opened and appended to?

      While I'm on that subject how would I set that document to be someplace any old SubethaEdit user on any machine can access if using the script.

      Using "/Users/myaccount/somefolder/murgalog.txt" doesn't seem like the right solution.

      Thanks in advance,
      Mr Bill
    • oprahnoodle
      Hi griffin239, Here is a small script that might just do what you want: tell application SubEthaEdit set outputName to murgalua Output as text try set x to
      Message 2 of 2 , Apr 6 2:11 AM
      • 0 Attachment
        Hi griffin239,

        Here is a small script that might just do what you want:

        tell application "SubEthaEdit"

        set outputName to "murgalua Output" as text

        try

        set x to first document whose name is outputName

        if (name of x is equal to outputName) then

        set contents of the front document to contents of the front document & "foo"

        end if

        on error

        set myf to make new document

        set myf to the front document

        set name of myf to outputName

        set contents of the front document to "foo"

        end try

        end tell



        Hope this helps!

        --- In SubEthaEdit@yahoogroups.com, "griffin239" <bill@...> wrote:
        >
        > Here is the meat of the script I'm using.
        > --It runs my front document in murgaLua, all well and good.
        > tell application "Terminal"
        > activate
        > set shellscriptString to "/usr/bin/murgalua " & SQ & documentPath & SQ as text
        > --set the contents of the front window to shellscriptString
        > do script shellscriptString
        > set the clipboard to contents of the front window as text
        > set ds to contents of the front window as string
        > end tell
        >
        > -- Here is where I'm going woefully wrong
        > tell application "SubEthaEdit"
        > set myf to make new document
        > set myf to the front document
        > set contents of the front document to ds
        > end tell
        > -- from that chunk i'm getting many many 'untitled' documents.
        >
        > My question is how do I set it up so the same document is always opened and appended to?
        >
        > While I'm on that subject how would I set that document to be someplace any old SubethaEdit user on any machine can access if using the script.
        >
        > Using "/Users/myaccount/somefolder/murgalog.txt" doesn't seem like the right solution.
        >
        > Thanks in advance,
        > Mr Bill
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.