Changing Date & Time

Is there a way to get Applescript to change the year or month or whatever of the current date? Or are there applescript hooks to the Date & Time Control panel? I can’t find any information anywhere that tells one how to alter the current date using Applescript.

: Is there a way to get Applescript to change the year or month or
: whatever of the current date? Or are there applescript hooks
: to the Date & Time Control panel? I can’t find any
: information anywhere that tells one how to alter the current
: date using Applescript.
You can use the Scripting Addition Akua sweets and the “adjust the clock” command to change the date. Jean-Baptiste LE STANG

: You can use the Scripting Addition Akua sweets and the
: “adjust the clock” command to change the date.
: Jean-Baptiste LE STANG
Thanks for the tip. I keep hearing about Akua sweets, but have not looked into it yet. Guess I will now. funny that Apple didn’t include this ability with the Standard library…
D

: You can use the Scripting Addition Akua sweets and the
: “adjust the clock” command to change the date.
: Jean-Baptiste LE STANG
OK, I’ve downloaded the addition, but I have a couple of questions. First, specifically: How do I tell the “adjust the clock” command to change the year to any specific year? Second, where do I find templates or definitions for these Akuasweet additions that tell me how to call the commands? I’m new to this aspect of AS, but have always wondered where I could find out parameters, etc. of the various commands. The Sherlock plug-ins give me the following for “Adjust the clock”
adjust the clock Get location and/or set the macintosh date to a new value relative to the current date or absolute.
Package: Akua Sweets
Event Class: Akus Event ID: DtmX
Running “adjust the clock” gives me the following results: {latitude:486365278, longitude:-1.33482016E+9, daylight savings:false, GMT delta:-25200}
Where are the docs to tell me how to interpret and use this information? Hope you can help. Thx.
D

Where are the docs to tell me how to interpret and use this information? Hope you can help. Thx.
Documentation on this command in the Akua distribution is not very extensive. However, the example scripts are pretty explanatory. Just too bad that the best and most functional developments on the platform depend on volunteers.
hope this helps,
Eelco Houwink

: OK, I’ve downloaded the addition, but I have a couple of
: questions. First, specifically: How do I tell the “adjust
: the clock” command to change the year to any specific
: year? Second, where do I find templates or definitions for
: these Akuasweet additions that tell me how to call the
: commands?

In general, all the information you need about the syntax for a scripting addition command can be found in the scripting addition’s dictionary. To view the dictionary, either drop the scripting addition’s icon on Script Editor’s icon or open it with the “Open Dictionary?” command in Script Editor’s File menu.

For “adjust the clock” it says:

adjust the clock to date

All you have to do is provide the command with a value of class “date”, like this:

set theDate to "02/28/2002 3:15AM"
adjust the clock to date theDate

Marc K. Myers
Marc@AppleScriptsToGo.com
AppleScriptsToGo
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[02/22/2002 6:24:29 PM]

Thanks for the tips. I had discovered the dictionary menu option sometime after I posted my problem (LOL, duh! I felt a little silly). However, as another poster put it, the documentation on Akuasweets isn’t the niftiest. I had come pretty close to what you submitted, but I needed just a bit of a boost. Thanks again. The script works just as I need it to. Here’s the final result (minus the program I run - which changes depending on what I need to edit with)

-- store current date as variable strings 
set toDay to the date string of the (current date) as string
-- store current time as variable string 
get the time string of the (current date) 
set timeclock to the result
-- Pass current time to the new date string 
set timewarp to "1 January 2001 " & timeclock 
adjust the clock to date timewarp
-- Insert program to run here BEFORE dialog 
-- Modify your files while this dialog displays in the background, then click on "Go!" to continue 
display dialog "Look at the time! Gotta go!" buttons {"Go!"} default button 1 with icon caution
-- Save incremented time as new variable and pass along to the backup date 
get the time string of the (current date) 
set newTimeclock to the result
set theDate to toDay & " " & newTimeclock 
adjust the clock to date theDate