• Welcome to MacSailing.net!
  • Dedicated to sailing!
  • Be Jolly!
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Title: Applescript
#1
Hello,

I'm beginning to play with applescript and GPSNavX to see how easy we can make addon apps.

I already have two requests for the next version :
- get accessable unformatted data (lat, lon cog, time, ...) with applescript
- Is it possible to have the ability to hide the GPS window but without closing the connection to the gps.

I've upload a very small app I've made in 2 hours, and its very fun to imagine what I can do with applescript. Or even widgets ...

http://www.silex.net/clients/GPSRaceX.zip

CAUTION : this app is a quik and dirty try and a prof of concept only, do not use it in real nav. And only test on a macbookpro 10.4.7

Regards
 
Reply
#2
- get accessable unformatted data (lat, lon cog, time, ...) with applescript

No, but there should be an Applescript function to parse out the raw number from the returned text. Also if you want the raw position set the position format to "DDD.DDDH" in the "View" menu.


- Is it possible to have the ability to hide the GPS window but without closing the connection to the gps.

Yes. In the GPSNavX Preferences uncheck "Disconnect when GPS Panel closed". This will prevent the GPS panel from closing the comm port when it is closed either by the user or AppleScript.
Scott Dillon
Sydney Australia
North Shore 38
CYCA
 
Reply
#3
No, but there should be an Applescript function to parse out the raw number from the returned text. Also if you want the raw position set the position format to "DDD.DDDH" in the "View" menu.

Do you mean, not now or not even in the future ? Because applescript is not known for his highlevel parsing capabilities. And if these data are available
inside GPSNavX, why do not share them also to applescript? And if I want to do some basic math with these data, I prefer have it directly without a conversion from string to double number each second.

- Is it possible to have the ability to hide the GPS window but without closing the connection to the gps.

Thanks, I've forget this option

Regards

Christophe[/b]
 
Reply
#4
In a broader sense, what's a good way to learn about and get started with Applescript? I've never used it but sense it could be useful with MacENC.

Scot
 
Reply
#5
http://developer.apple.com/documentation/AppleScript

http://www.gpsnavx.com/help/applescript.htm
Scott Dillon
Sydney Australia
North Shore 38
CYCA
 
Reply
#6
cguegan Wrote:CAUTION : this app is a quik and dirty try and a prof of concept only, do not use it in real nav. And only test on a macbookpro 10.4.7

Regards

I did download your program on my Mac Mini OS X 10.4.7 (PPC version)
and I can't run your script file!
Even the icon does have a not allowed icon placed over it.

Could it be that AppleScript isn't installed properly on my Mac? And could this be the reason that I can't get GPSNavX and Mr. Tides working together correctly?

Thx

Manou
 
Reply
#7
I also tried to download the zip file. It made an app that was not usable on my Mac (PPC, OS X 10.4.7). Would be far more beneficial if you just put the AppleScript source in a post.
Scott Dillon
Sydney Australia
North Shore 38
CYCA
 
Reply
#8
This is the first time I distribute an applescript application, so I'm not sure of how to do it properly.

GPSNavX Wrote:Would be far more beneficial if you just put the AppleScript source in a post.

In fact, this is not a simple applescript, It's an application build with Xcode, including a GUI and using applesript as language.

I think it's a stand alone app and should work out of the box normaly, but of course GPSNavX should be present. I don't think it should require any other dependencies. I did a test on a G5 ppc, and it works.

I've try another way to share the app
a zip folder : http://www.silex.net/clients/GPSRaceX.zip (20k)
a DMG : http://www.silex.net/clients/GPSRaceX.dmg (552k)

Maybe, just zipping the app may corrupt it.

For the code used :

Code:
(* ==== Properties ==== *)

property is_activated : false
property is_connected : false
property formated_lat : ""
property formated_lon : ""
property formated_cog : ""
property formated_sog : ""

(* ==== Event Handlers ==== *)

on clicked theObject
    if name of theObject = "btn_start_gpsnavx" then
        try
            tell application "GPSNavX"
                activate
                set is_activated to true
                try
                    tell first gps
                        if canConnect = true then
                            connect
                            set is_connected to true
                        end if
                    end tell
                end try
            end tell
        end try
    end if
end clicked

on idle theObject
    if is_connected then
        tell application "GPSNavX"
            --activate
            tell first gps
                set formated_lat to latitude
                set formated_lon to longitude
                set formated_cog to cog
                set formated_sog to sog
            end tell
        end tell

        tell window "main" of theObject
            set contents of text field "formated_latitude" to formated_lat
            set contents of text field "formated_longitude" to formated_lon
            set contents of text field "formated_course" to formated_cog
            set contents of text field "formated_speed" to formated_sog
        end tell
    end if

    -- We want to update the idle event every second, so we return 1
    return 1
end idle

on should quit after last window closed theObject
    return true
end should quit after last window closed

Hoping this one works for you, regards

Christophe[/code]
 
Reply
  


Possibly Related Threads…
Thread Author Replies Views Last Post
  Looking for a MacENC Developer AppleScript Contractor for Hourly Work neep3r 1 4,139 November 3, 2018 13:33
Last Post: samuelbrecher93
  Applescript and macENC Russell 1 3,082 January 6, 2018 11:09
Last Post: Jade
  Applescript and MacENC Eric Frank 4 4,167 September 1, 2012 22:16
Last Post: mrfugu

Forum Jump:


Browsing: 2 Guest(s)