Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
manipulating date in applescript
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
spuddybike  
View profile  
 More options Mar 20 2012, 6:29 am
From: spuddybike <spuddyb...@gmail.com>
Date: Tue, 20 Mar 2012 03:29:58 -0700 (PDT)
Local: Tues, Mar 20 2012 6:29 am
Subject: manipulating date in applescript

I would like to remove day of birth from the public website, not just
splat everything with Privacy
The function GetTextForEvent grabs the date from "event date user"

on GetTextForEvent(theRec, theTag, everb, pref, h3Text)
        tell application "GEDitCOM II"
                -- look for for the structure
                tell theRec
                        set evnts to find structures tag theTag output "references"
                        set numEvnt to number of items in evnts
                        if numEvnt = 0 then
                                return ""
                        end if
                        if h3Text = "" then
                                set numEvnt to 1
                        end if
                end tell

                -- one is found, so process it
                set edall to ""
                repeat with i from 1 to numEvnt
                        set evnt to item i of evnts
                        set ed to ""
                        tell evnt
                                -- the date
                                set edate to event date user
                                if edate is not "" then
                                        set ed to HeSheNow & " " & everb & " " & edate
                                end if

I'd like to pass to edate just the month and year, so I suppose I
should use the rightString method
something like
                                -- the date
                               set eyear to rightString(edate, " ")
                               set edaymonth to
leftStringFromRight(edate, " ")
                               set emonth to leftString(edaymonth," ")
                               set emonthyear to month & " "  & eyear
                                if edate is not "" then
                                        set ed to HeSheNow & " " & everb & " " & emonthyear
                                end if

But I get the following error

structure 3 of individual id "@I655@" of document "O'Hara and
Stuart.gedpkg" doesn’t understand the rightString message
any ideas?

thanks
Jon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Nairn  
View profile  
 More options Mar 27 2012, 12:05 am
From: John Nairn <j...@geditcom.com>
Date: Mon, 26 Mar 2012 21:05:49 -0700
Local: Tues, Mar 27 2012 12:05 am
Subject: Re: manipulating date in applescript

I am not sure what rightString() (etc.) are? I don't think it is a defined function in AppleScript? You could write one and call it, but otherwise I cannot tell what you want to do.

You mentioned getting just month and year. Rather then try to decode the date string (which will need to handle lots of special cases), the much better approach is to reformat the date using a custom scripting command for GEDitCOM II such as

date style full date edate with format "%M %y"

which will reformat any date using just month and year. For example input "JUL 1776" would outlut "JUL 1776" as I think you want. The format supplied need not include all parts of the date.

These and many other date commands are described inthe "Scripting Command" section on the "Scripting Features" chapter of the GEDitCOM II help.

John

------------
John Nairn
http://www.geditcom.com
Genealogy Software for the Mac


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »