Announcement

Collapse
No announcement yet.

phidget programming?

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

  • phidget programming?

    I have a 4 servomotor controller and need help writing code so that I can use it to left my monitor. Can anyone here help me here.

    Thanks

    Paul

  • #2
    Can't you use applescript with phidgets?
    Originally posted by ghettocruzer
    I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
    Want to:
    -Find out about the new iBug iPad install?
    -Find out about carPC's in just 5 minutes? View the Car PC 101 video

    Comment


    • #3
      I have not been able to get it to work.

      Used the following code

      tell application "Phidget Servo Controller"
      activate
      delay 2
      end tell

      tell application "System Events"
      tell process "Phidget Servo Controller"
      set value of slider 1 of window "Phidget Servo Controller" to 65
      end tell
      end tell

      it will start the phidget servo controller but then I get this error message

      System Events got an error: Can’t get slider 1 of window "Phidget Servo Controller" of process "Phidget Servo Controller". Invalid index.

      Comment


      • #4
        Originally posted by tang View Post
        I have a 4 servomotor controller and need help writing code so that I can use it to left my monitor. Can anyone here help me here.
        What environment and language are you using for the development? Controlling Phidgets from C or ObjC/Cocoa is trivial (except for few issues if you go for multithreading). There are quite a few sample on the disk image the Phidgets driver is distributed on.

        Comment


        • #5
          I looked at there examples. I have xcode install and was going to use that and thought I might be able to play around with it and understand what they are doing. I have limited programming skills. I did some visual basic about 5 years ago and just in a school enviorment then I switch to Macs and don't know the languge here.


          Thanks

          Paul

          Comment


          • #6
            You are trying to script the user interface, which is different than phidgets support applescript. The likely problem is that you either have the name of that slider incorrect, or the application isn't active/the slider is greyed out when you call it.

            Did you know that automator in Leopard has a function called 'watch me do' that will record what you do and allow you to examine the script? That might be the easiest way to figure it out for you.

            Otherwise, try using Xcode and the examples. It may not be as hard to modify an example as you think.
            Originally posted by ghettocruzer
            I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
            Want to:
            -Find out about the new iBug iPad install?
            -Find out about carPC's in just 5 minutes? View the Car PC 101 video

            Comment


            • #7
              Well then I don't thing phidget is applescritable then or least it is not listed on there website. I will look at your other options as well.

              Thanks for your sugestions

              Comment


              • #8
                I haven't done too much GUI scripting, but just looking at your code, it looks like you have too many tells in there. Try something simpler like this:

                tell application "Phidget Servo Controller"
                activate
                delay 2
                set value of slider 1 of window "Phidget Servo Controller" to 65
                end tell

                I think the reason it was bombing was that you were telling System events something. Since it didn't bomb when you first told the Phidget Servo controller application to activate, that means you were able to contact the program. I think you can simply continue that and set the value of the slider directly.

                Not sure why you need to use the term 'process' rather than application. If the code above bombs, maybe you need to use that instead.

                Perhaps you'll have to go back to your original code and write it like this:


                tell application "System Events"
                tell process "Phidget Servo Controller"
                set value of slider 1 of window "Phidget Servo Controller" to 65
                end tell
                end tell

                ...but I have a feeling that what is going on is that AS is talking to the System Events app and NOT to Phidget Servo Controller app. I don't think you need to use that tell for System Events.

                AS is notoriously finicky about the exact syntax and it isn't always clear how you write the code. It takes some messing around with.
                Originally posted by ghettocruzer
                I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
                Want to:
                -Find out about the new iBug iPad install?
                -Find out about carPC's in just 5 minutes? View the Car PC 101 video

                Comment


                • #9
                  Thanks I will keep playing around with as i would like to learn applescript. I will be looking for a good book on the matter. Non of the suggestions worked (appreciated anyway). Yes I tried the record with automater but when came to the slide it did not actually move them, It selected the one and stopped short of moving.

                  I will keep working with my options

                  Thanks

                  Paul

                  Comment


                  • #10
                    Well....if it selected the right one, then use that code and then insert the AS code that actually sets the slider to the value you want.

                    This is THE book for applescript. You can go a really long ways with it.

                    Here's a good start on how to GUI script.

                    Also, you need UI Element inspector to allow you to tell what the name of the control is. It's here.
                    Originally posted by ghettocruzer
                    I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
                    Want to:
                    -Find out about the new iBug iPad install?
                    -Find out about carPC's in just 5 minutes? View the Car PC 101 video

                    Comment

                    Working...
                    X