Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: sending a OSC message from an applescript

  1. #1

    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. #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

  3. #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

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

  5. #5
    Damn i forgot the link

    Sorry

  6. #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.

  7. #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?

  8. #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

  9. #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

  10. #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 : "8000"
    property osclabel : "/1/label1"
    property osccommand : "sendOSC -h localhost "
    property myWrong : "!$,;~"
    property myRight : "*"
    
    set my_dialog to display dialog "Texte :" default answer ""
    set oscmessage to text returned of my_dialog
    
    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 Attached Files
    Last edited by two; 04-21-2012 at 11:22 AM.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •