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

Re: [SubEthaEdit] Is it possible to use the see command line tool in a mode script?

Expand Messages
  • Jeff Groth
    After some research and experimentation I was able to get the desired result with the following: do shell script echo some text | /usr/bin/see & /dev/null &
    Message 1 of 4 , Jan 8, 2008
    • 0 Attachment
      After some research and experimentation I was able to get the desired result with the following:

      do shell script "echo some text | /usr/bin/see &> /dev/null &"

      Jeff

      On Jan 8, 2008, at 1:06 PM, michael_j_barber wrote:

      Consider the following three AppleScripts:

      -- script 1
      do shell script "echo some text | /usr/bin/see"

      on seescriptsettings( )
      {displayName: "Pipe into see"}
      end seescriptsettings

      -- script 2
      do shell script "echo some text | open -f"

      on seescriptsettings( )
      {displayName: "Pipe into open"}
      end seescriptsettings

      -- script 3
      do shell script "echo some text | /usr/local/bin/ mate"

      on seescriptsettings( )
      {displayName: "Pipe into mate"}
      end seescriptsettings

      -- end scripts

      The three scripts are all similar in intent. You add them to a mode and have an item added 
      to the mode menu. Each one produces the text "some text\n" and pipes it into a shell 
      command to open a new document in an application. The first one uses 'see' to open it in 
      SubEthaEdit, the second uses 'open -f' to open it in TextEdit, and the third uses 'mate' to 
      open it in TextMate.

      The second and third scripts work fine. The first one does not. The new SubEthaEdit 
      document does not open, and SubEthaEdit becomes unresponsive. By killing the 'see' 
      process using the terminal, you can actually get the document to open, however. Further, 
      just running the AppleScript from the Script Editor works fine, with SubEthaEdit 
      immediately opening the document. 

      Any suggestions on getting this working? Is this a bug, or am I just missing something?

    • michael_j_barber
      That is remarkably strange. I tried ending with & and redirecting the output to /dev/null individually, neither of which worked, but it didn t occur to me to
      Message 2 of 4 , Jan 9, 2008
      • 0 Attachment
        That is remarkably strange. I tried ending with & and redirecting the output to /dev/null
        individually, neither of which worked, but it didn't occur to me to try the combination you
        used. At any rate, thanks for the workaround!

        I can't believe that is the desired behavior, so I think I'll go ahead and file a bug a report
        anyway.


        --- In SubEthaEdit@yahoogroups.com, Jeff Groth <jtgroth.lists@...> wrote:
        >
        > After some research and experimentation I was able to get the desired
        > result with the following:
        >
        > do shell script "echo some text | /usr/bin/see &> /dev/null &"
        >
        > Jeff
        >
        > On Jan 8, 2008, at 1:06 PM, michael_j_barber wrote:
        >
        > > Consider the following three AppleScripts:
        > >
        > > -- script 1
        > > do shell script "echo some text | /usr/bin/see"
        > >
        > > on seescriptsettings()
        > > {displayName:"Pipe into see"}
        > > end seescriptsettings
        > >
        > > -- script 2
        > > do shell script "echo some text | open -f"
        > >
        > > on seescriptsettings()
        > > {displayName:"Pipe into open"}
        > > end seescriptsettings
        > >
        > > -- script 3
        > > do shell script "echo some text | /usr/local/bin/mate"
        > >
        > > on seescriptsettings()
        > > {displayName:"Pipe into mate"}
        > > end seescriptsettings
        > >
        > > -- end scripts
        > >
        > > The three scripts are all similar in intent. You add them to a mode
        > > and have an item added
        > > to the mode menu. Each one produces the text "some text\n" and
        > > pipes it into a shell
        > > command to open a new document in an application. The first one
        > > uses 'see' to open it in
        > > SubEthaEdit, the second uses 'open -f' to open it in TextEdit, and
        > > the third uses 'mate' to
        > > open it in TextMate.
        > >
        > > The second and third scripts work fine. The first one does not. The
        > > new SubEthaEdit
        > > document does not open, and SubEthaEdit becomes unresponsive. By
        > > killing the 'see'
        > > process using the terminal, you can actually get the document to
        > > open, however. Further,
        > > just running the AppleScript from the Script Editor works fine,
        > > with SubEthaEdit
        > > immediately opening the document.
        > >
        > > Any suggestions on getting this working? Is this a bug, or am I
        > > just missing something?
        >
      • dasgeniedotcom
        I can explain this issue, it is based on the synchronous nature of applescript. when you start running an applescript in subethaedit, and then try to run
        Message 3 of 4 , Mar 2 10:38 PM
        • 0 Attachment
          I can explain this issue, it is based on the synchronous nature of
          applescript. when you start running an applescript in subethaedit, and
          then try to run something that in turn wants to tell subethaedit
          something which is not based in the same script, then subethaedit
          blocks and both scripts time out eventually.

          I run into the same problem when telling xcode to build the current
          project. what xcode does is ask subethaedit again via applescript if
          there are unsaved documents and boom.

          what works in the applescript case is

          ignoring application responses
          end ignoring

          you can use this so you can send a non blocking applescript call

          Best,
          dom

          --- In SubEthaEdit@yahoogroups.com, "michael_j_barber"
          <michael_j_barber@...> wrote:
          >
          > That is remarkably strange. I tried ending with & and redirecting
          the output to /dev/null
          > individually, neither of which worked, but it didn't occur to me to
          try the combination you
          > used. At any rate, thanks for the workaround!
          >
          > I can't believe that is the desired behavior, so I think I'll go
          ahead and file a bug a report
          > anyway.
          >
          >
          > --- In SubEthaEdit@yahoogroups.com, Jeff Groth <jtgroth.lists@> wrote:
          > >
          > > After some research and experimentation I was able to get the
          desired
          > > result with the following:
          > >
          > > do shell script "echo some text | /usr/bin/see &> /dev/null &"
          > >
          > > Jeff
          > >
          > > On Jan 8, 2008, at 1:06 PM, michael_j_barber wrote:
          > >
          > > > Consider the following three AppleScripts:
          > > >
          > > > -- script 1
          > > > do shell script "echo some text | /usr/bin/see"
          > > >
          > > > on seescriptsettings()
          > > > {displayName:"Pipe into see"}
          > > > end seescriptsettings
          > > >
          > > > -- script 2
          > > > do shell script "echo some text | open -f"
          > > >
          > > > on seescriptsettings()
          > > > {displayName:"Pipe into open"}
          > > > end seescriptsettings
          > > >
          > > > -- script 3
          > > > do shell script "echo some text | /usr/local/bin/mate"
          > > >
          > > > on seescriptsettings()
          > > > {displayName:"Pipe into mate"}
          > > > end seescriptsettings
          > > >
          > > > -- end scripts
          > > >
          > > > The three scripts are all similar in intent. You add them to a
          mode
          > > > and have an item added
          > > > to the mode menu. Each one produces the text "some text\n" and
          > > > pipes it into a shell
          > > > command to open a new document in an application. The first one
          > > > uses 'see' to open it in
          > > > SubEthaEdit, the second uses 'open -f' to open it in TextEdit, and
          > > > the third uses 'mate' to
          > > > open it in TextMate.
          > > >
          > > > The second and third scripts work fine. The first one does not.
          The
          > > > new SubEthaEdit
          > > > document does not open, and SubEthaEdit becomes unresponsive. By
          > > > killing the 'see'
          > > > process using the terminal, you can actually get the document to
          > > > open, however. Further,
          > > > just running the AppleScript from the Script Editor works fine,
          > > > with SubEthaEdit
          > > > immediately opening the document.
          > > >
          > > > Any suggestions on getting this working? Is this a bug, or am I
          > > > just missing something?
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.