• 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: Shell script date & time coercions...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell script date & time coercions...


  • Subject: Re: Shell script date & time coercions...
  • From: has <email@hidden>
  • Date: Tue, 2 Apr 2002 23:55:17 +0100

The eagle-eyed Mr Tea didst most perceptively pen:

>> Plus some kindy fellow wrote an AS library-based version some time ago
>> that'll run on most anything:
>>
>> http://www.barple.connectfree.co.uk/strftimeLib.hqx
>
>Aha! and how does a learning scripter load or otherwise employ an AS
>library? I've not used one before

Indeed. Scanning down my Things To Do list, I see the following excerpt:

#134 kick Greg
#135 kick Serge
#136 kick self
#137 write "A Beginner's Guide to AppleScript Libraries"
#138 kick Apple [<ouch> Hurt foot!]
#139 kick Greg
#140 kick Serge
#141 write script to automate all future kicking
#142 kick self, etc...

--

The simplest approach, where libraries are loaded at compile-time, is:

======================================================================

property someLib : load script (file "full path to library")

tell someLib to doSomething()

======================================================================

I prefer to load libraries dynamically, mind you. For example, the
following would load a library named 'someLib' in the Scripts folder and
call its 'doSomething()' handler:

======================================================================

-------
--library loading code

global someLib

on _loadLib(libName)
load script (file ((path to scripts folder as string) & "someLib"))
end _loadLib

on init()
set someLib to _loadLib("someLib")
end init

---------
--main

init()

tell someLib to doSomething()


======================================================================


I do wish Apple could establish a formal system for AS libraries, however -
it'd be very nice if you could simply toss all your library files into an
official "AS Libraries" folder and use a simple "import" command to load
them up ready for use. Maybe even lay on a CPAN-style repository...

But I'll be off onto another tedious old rant if I don't shut up right now.:)


Alternatively, you could always copy-and-paste the whole thing into your
own script, although that's a pretty ugly and inflexible solution.


>> Not sure how the library/osax methods compare for speed to the shell
>> script, but will hopefully find out sometime this week when I finally
>> succumb to the dreaded OS X disease...
>
>Shortly after which you'll be seeing all sorts of previously trivial little
>things you took for granted in OS 9 as 'biggies'.

Three little words to keep me sane between periods of OSX Madness:

"OS 8.6 partition".

:)

Cheers,

has

--
http://www.barple.connectfree.co.uk/ -- The Little Page of Beta AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Coordinating lists
  • Next by Date: RE: list of lists as arrays
  • Previous by thread: Re: Shell script date & time coercions...
  • Next by thread: Re: Restarting OSX through applescript
  • Index(es):
    • Date
    • Thread