Announcement

Collapse
No announcement yet.

sending a OSC message from an applescript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • sending a OSC message from an applescript

    Hi,

    I'm looking for a way to send a OSC message from an applescript in way to change the text of a label in touchosc. Something like "D -> iphone (touchOSC) /1/Label1 : "my_text" where my_text is a variable created by this applescript.
    Any clue about how to do this?

    Thanks
    TWO

  • #2
    Hello two,

    I don't know a way to send OSC from an AppleScript.

    But maybe there is another way to do what you'd like to achieve.
    What is the event that should send the OSC message?


    Best,
    Cam

    Comment


    • #3
      Hi Camille.

      Unfortunately It has to be an AppleScript. I have to combine some informations comming from different apps.

      I'm going forward in my searching : it seems that the soft described on this page is what I need. The problem is that the compiled version seems to be compiled for PowerPC processors. There is a code source version but it has to be compiled. Do anyone know how to compile for intel processors?

      Thanks

      Comment


      • #4
        Hi two,
        Do you have a link?

        Comment


        • #5
          Damn i forgot the link

          Sorry

          Comment


          • #6
            You could also use the oscsend utility from liblo: http://liblo.sourceforge.net/
            It should compile fine on Mac OS X with Xcode installed.

            Comment


            • #7
              Hi Cam
              a friend of mine managed to compile the sendOSC utility.
              it seems to work... but i think i don't have the good arguments to use with it.

              normally usage is : sendOSC [-notypetags] [-r] [-h target_host_name] port_number [message...]

              when in the terminal i type "sendOSC 8000 1/label1 test"
              he answers me "Couldn't send out socket: : No such file or directory"

              when i type "sendOSC -h OSCulator 8000"
              answer is
              "Couldn't decipher host name "OSCulator"
              Unknown host"

              What can be wrong?

              Comment


              • #8
                Hi two,

                When you want to send OSC message to the computer you are working on, the host should be localhost, or 127.0.0.1.
                So the correct invocation would be:

                Code:
                sendOSC -h localhost 8000 /1/label1,test
                More info at this page: http://archive.cnmat.berkeley.edu/Op...s/sendOSC.html

                Best,
                Camille

                Comment


                • #9
                  Hi cam,
                  thanks for the answers on my different threads...
                  Its going forward...
                  sendosc doen't seems to give an error message but... doesn't have a result in osculator or touchosc...
                  whatever i tipe in the "message" part of my command line the answer is
                  "host localhost, port 8000, use type tags"
                  Do i have to create an osc routing in Osculator with 2 as target like in the different thread?

                  best,
                  Two

                  Comment


                  • #10
                    GOT IT !!
                    i tried it one more time and get it working :

                    For the entry /1/label1, i created a new OSC Routing with target 2 and rewrite address to 1/label1 (yes, i FORGOT the first / in what usually is /1/label1 ).


                    When i triggered my shell script, osculator created a new entry (1/label1 with OSC routing D-> /1/label1 : s - yes, no first / in the entry and a first / in the routing; inverted with entry i created) and... it works!

                    Don't know why but it works

                    When i tried it with my forgotten "/" it didn't work anymore...

                    for those who wants to try, heres an applescript:
                    Code:
                    property oscport : "[COLOR=#00ff00]8000[/COLOR]"
                    property osclabel : "[COLOR=#00ff00]/1/label1[/COLOR]"
                    property osccommand : "sendOSC -h localhost "
                    property myWrong : "!$,;~"
                    property myRight : "*"
                    
                    [COLOR=#ff0000]set my_dialog to display dialog "Texte :" default answer ""
                    set oscmessage to text returned of my_dialog[/COLOR]
                    
                    repeat with AA from 1 to 5
                        set mychar to character AA of myWrong
                        set oscmessage to textChange(oscmessage, mychar, myRight)
                    end repeat
                    
                    set my_OSC to osccommand & oscport & " " & osclabel & "," & (quoted form of oscmessage)
                    do shell script my_OSC
                    
                    
                    
                    
                    
                    on textChange(myText, _old, _new)
                        set saveTID to text item delimiters
                        set text item delimiters to _old
                        set listeElements to text items of myText
                        set text item delimiters to _new
                        set myText to listeElements as text
                        set text item delimiters to saveTID
                        return myText
                    end textChange
                    copy this code to your applescript editor.
                    The green text has to be changed to your settings
                    the red text can be changed to whatever you want to do with the script.
                    the textchange fonction is needed to avoid the use of some special characters
                    The compiled version of the sendOSC utility is attached
                    Attached Files
                    Last edited by two; 04-21-2012, 12:22 PM.

                    Comment


                    • #11
                      Hi two,

                      That's great to hear you got it to work.

                      Just one note:

                      When i triggered my shell script, osculator created a new entry (1/label1 with OSC routing D-> /1/label1 : s - yes, no first / in the entry and a first / in the routing; inverted with entry i created) and... it works!
                      It seems you have activated the preference "try to backmap incoming OSC".
                      I recommend you deactivate this option if you don't need it.


                      Just out of curiosity, I was wondering what program was triggering the AppleScript, could you give a little description?
                      Thanks!


                      Cam

                      Comment


                      • #12
                        Hi Cam,

                        I tried to unactivated the preference "try to backmap incoming OSC" and to erase the "automaticly generated" entrys.
                        when i triggered the applescrit they were re-generated... but without OSC routing... and the labels on touchsc didn't change.
                        i reactivated the prefence so that the osc routings were re-generated an unactivated the prefence after that. It stay working even after relaunching the application.

                        So if i hadn't activated this preference i still would be searching to make it work...



                        OSCulator is triggering the applescript (when i press a button on touchosc). The applescript takes informations in itunes and in Lxconsole and display this information on a bunch of labels in one time (18 in my case and most of them dislay more than one information).
                        It could also have been a loop turning in background and refresching the labels every 5 or 20 seconds.


                        Once more, thank you for your reactivity to help us with all our weird questions about OSCulator.
                        Un grand merci pour ton aide sur mes questions débiles et parfois hors norme.

                        Un P'tit Belge
                        Two
                        Last edited by two; 04-22-2012, 12:09 PM.

                        Comment


                        • #13
                          Hi both.

                          Apologies for jumping on an old thread rather than creating a new one, but this sounds like a solution to a problem I am facing.

                          I am trying to send names of files from QLab and send them to TouchOSC buttons on my iPad using OSC which I use a lot - Osculator/QLab/TouchOsc etc

                          I can "acquire" the names and information quite easily using script cues but can't find a way of sending them via OSC

                          I have downloaded the "compiled" SendOSC zip files above but this doesn't seem to load up as when I run

                          do shell script my_OSC

                          it comes up with error

                          error "sh: sendOSC: command not found" number 127

                          Any help would be gratefully appreciated

                          BEST

                          Phil





                          do shell script my_OSC

                          Comment


                          • #14
                            Originally posted by scaryxpuppy View Post
                            Hi both.

                            Apologies for jumping on an old thread rather than creating a new one, but this sounds like a solution to a problem I am facing.

                            I have downloaded the "compiled" SendOSC zip files above but this doesn't seem to load up as when I run

                            do shell script my_OSC

                            it comes up with error

                            error "sh: sendOSC: command not found" number 127

                            Any help would be gratefully appreciated

                            And a long delayed reply, but may help someone in the future. If sendOSC is not in your "path" (UNIX terminology), you must give the full path to it in the command eg: /Users/phil/Downloads/sendOSC or whatever.

                            On that note, it would be wonderful if Osculator exposed a method to receive "virtual" osc events via applescript directly.

                            Comment

                            Working...
                            X