Results 1 to 10 of 10

Thread: phidget programming?

  1. #1
    Newbie
    Join Date
    Nov 2006
    Posts
    14

    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. #2
    Admin. Linux loser.
    Auto Apps:loading...
    Bugbyte's Avatar
    Join Date
    Sep 2004
    Location
    Corning, NY
    Posts
    7,364
    Blog Entries
    2
    Can't you use applescript with phidgets?
    Quote Originally Posted by ghettocruzer View Post
    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

  3. #3
    Newbie
    Join Date
    Nov 2006
    Posts
    14
    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.

  4. #4
    QCar Creator Jirka Jirout's Avatar
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    590
    Quote 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.

  5. #5
    Newbie
    Join Date
    Nov 2006
    Posts
    14
    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

  6. #6
    Admin. Linux loser.
    Auto Apps:loading...
    Bugbyte's Avatar
    Join Date
    Sep 2004
    Location
    Corning, NY
    Posts
    7,364
    Blog Entries
    2
    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.
    Quote Originally Posted by ghettocruzer View Post
    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

  7. #7
    Newbie
    Join Date
    Nov 2006
    Posts
    14
    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

  8. #8
    Admin. Linux loser.
    Auto Apps:loading...
    Bugbyte's Avatar
    Join Date
    Sep 2004
    Location
    Corning, NY
    Posts
    7,364
    Blog Entries
    2
    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.
    Quote Originally Posted by ghettocruzer View Post
    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

  9. #9
    Newbie
    Join Date
    Nov 2006
    Posts
    14
    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

  10. #10
    Admin. Linux loser.
    Auto Apps:loading...
    Bugbyte's Avatar
    Join Date
    Sep 2004
    Location
    Corning, NY
    Posts
    7,364
    Blog Entries
    2
    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.
    Quote Originally Posted by ghettocruzer View Post
    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

Similar Threads

  1. Phidget Encoder Plug-in Doesn't Stay Enabled - 1.0.6.3+
    By BlueF in forum StreetDeck Bug Reports
    Replies: 2
    Last Post: 08-06-2007, 09:41 PM
  2. Replies: 0
    Last Post: 07-03-2007, 01:04 PM
  3. EMS programming questions
    By 94legend in forum Engine Management, OBD-II, Engine Diagnostics, etc.
    Replies: 0
    Last Post: 05-27-2007, 12:13 PM
  4. Wanting to learn some programming, help me pick a language!
    By RS3RS in forum Software & Software Development
    Replies: 32
    Last Post: 10-15-2004, 04:38 PM
  5. C++: GUI Programming with >NET Framework
    By [iG] in forum Software & Software Development
    Replies: 3
    Last Post: 05-24-2004, 06:57 PM

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
  •