• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Subroutine Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subroutine Question


  • Subject: Re: Subroutine Question
  • From: "Mark J. Reed" <email@hidden>
  • Date: Sun, 18 Apr 2010 17:27:50 -0400

What's with all the extra parameters to date?  It's very silly to call date to ask it for the current date, then turn around and feed that answer back to a second call of date, saying "hey, give me THIS date instead of the current date, but do it in epoch seconds form!"

All you need is this:

on EpochSeconds()
    do shell script "date +%s"
end EpochSeconds




On Sun, Apr 18, 2010 at 2:24 PM, Wayne Melrose <email@hidden> wrote:
()


set start_Time to EpochSeconds()

on EpochSeconds()
   return do shell script "date -j -f \"%a %b %d %T %Z %Y\" \"`date`\" \"+%s\""
end EpochSeconds

Sent from my iPhone

On 18. apr. 2010, at 19.56, Marconi <email@hidden> wrote:

What's the correct syntax to code a subroutine which does not need any input parameters passed to it but does get a value back?

I have to pass something unnecessary like so:

set start_Time to EpochSeconds(1)

on EpochSeconds(x)
   return do shell script "date -j -f \"%a %b %d %T %Z %Y\" \"`date`\" \"+%s\""
end EpochSeconds



I can't just do:

set start_Time to EpochSeconds

on EpochSeconds
   return do shell script "date -j -f \"%a %b %d %T %Z %Y\" \"`date`\" \"+%s\""
end EpochSeconds


What's the best way to set my start_Time to the value returned by my EpochSeconds subroutine?



--
Geeks and Nerds: <http://www.otfb.com/blog/?p=918>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)

Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



--
Mark J. Reed <email@hidden>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Subroutine Question
      • From: Marconi <email@hidden>
References: 
 >Re: Subroutine Question (From: Wayne Melrose <email@hidden>)

  • Prev by Date: Re: Subroutine Question
  • Next by Date: Re: Subroutine Question
  • Previous by thread: Re: Subroutine Question
  • Next by thread: Re: Subroutine Question
  • Index(es):
    • Date
    • Thread