The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > Mp3Car Technical > MacCar

Reply
 
Thread Tools Display Modes
Old 12-04-2007, 03:11 PM   #1
Newbie
 
Join Date: Nov 2006
Posts: 14
My Photos: (0)
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
tang is offline   Reply With Quote
Sponsored Links
Old 12-04-2007, 10:43 PM   #2
Admin. Don't bug or I'll byte.
Bugbyte's CarPC Specs
 
Bugbyte's Avatar
 
Join Date: Sep 2004
Location: Corning, NY
Vehicle: 2001 VW Beetle
Posts: 4,461
My Photos: (19)
Can't you use applescript with phidgets?
__________________
-Where in the world is the iBug?
-Find out about theiBug
-Attention Newbies! Have you seen the FAQ Emporium?
-No time to figure it out? Take 5 minutes to view the Car PC 101 video
Bugbyte is offline   Reply With Quote
Old 12-05-2007, 04:54 AM   #3
Newbie
 
Join Date: Nov 2006
Posts: 14
My Photos: (0)
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.

Last edited by tang : 12-05-2007 at 04:58 AM.
tang is offline   Reply With Quote
Old 12-05-2007, 07:22 AM   #4
QCar Creator
Jirka Jirout's CarPC Specs
 
Jirka Jirout's Avatar
 
Join Date: Jul 2005
Location: Netherlands
Vehicle: 1993 Tatra 613-4Mi Long
Posts: 541
My Photos: (0)
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.
Jirka Jirout is offline   Reply With Quote
Old 12-05-2007, 01:33 PM   #5
Newbie
 
Join Date: Nov 2006
Posts: 14
My Photos: (0)
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
tang is offline   Reply With Quote
Old 12-05-2007, 10:18 PM   #6
Admin. Don't bug or I'll byte.
Bugbyte's CarPC Specs
 
Bugbyte's Avatar
 
Join Date: Sep 2004
Location: Corning, NY
Vehicle: 2001 VW Beetle
Posts: 4,461
My Photos: (19)
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.
__________________
-Where in the world is the iBug?
-Find out about theiBug
-Attention Newbies! Have you seen the FAQ Emporium?
-No time to figure it out? Take 5 minutes to view the Car PC 101 video
Bugbyte is offline   Reply With Quote
Old 12-06-2007, 01:19 PM   #7
Newbie
 
Join Date: Nov 2006
Posts: 14
My Photos: (0)
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
tang is offline   Reply With Quote
Old 12-07-2007, 08:15 AM   #8
Admin. Don't bug or I'll byte.
Bugbyte's CarPC Specs
 
Bugbyte's Avatar
 
Join Date: Sep 2004
Location: Corning, NY
Vehicle: 2001 VW Beetle
Posts: 4,461
My Photos: (19)
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.
__________________
-Where in the world is the iBug?
-Find out about theiBug
-Attention Newbies! Have you seen the FAQ Emporium?
-No time to figure it out? Take 5 minutes to view the Car PC 101 video
Bugbyte is offline   Reply With Quote
Old 12-07-2007, 03:41 PM   #9
Newbie
 
Join Date: Nov 2006
Posts: 14
My Photos: (0)
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
tang is offline   Reply With Quote
Old 12-07-2007, 06:27 PM   #10
Admin. Don't bug or I'll byte.
Bugbyte's CarPC Specs
 
Bugbyte's Avatar
 
Join Date: Sep 2004
Location: Corning, NY
Vehicle: 2001 VW Beetle
Posts: 4,461
My Photos: (19)
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.
__________________
-Where in the world is the iBug?
-Find out about theiBug
-Attention Newbies! Have you seen the FAQ Emporium?
-No time to figure it out? Take 5 minutes to view the Car PC 101 video

Last edited by Bugbyte : 12-07-2007 at 06:30 PM.
Bugbyte is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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


All times are GMT -5. The time now is 01:12 AM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics