Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change System Date [Mac] using Applescript or Javascript?

Engaged ,
Aug 15, 2010 Aug 15, 2010

Hi All,

Can anyone suggest me how can i change my Mac date using Apple or Java Script.

Is it possible or not? If possible then please suggest.

Shonky

TOPICS
Scripting
3.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 15, 2010 Aug 15, 2010

It's not possible with AS, and I doubt it is with JS. Normally it's set by pointing to a time server.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 15, 2010 Aug 15, 2010

I had seen Adobe scripting forum using xcopy dos command through Indesign vbscript.

So i think on windows it is possible through dos command and using this  dos command with vbscript in indesign but i want same thing on Mac.

Is it possible through Shell script?

Can anybody suggest?

Thanks,

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 15, 2010 Aug 15, 2010

You might be able to do it using the shell command date, depending on the user's permissions.

But really, it's not something that scripts should be able to change.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 15, 2010 Aug 15, 2010
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 15, 2010 Aug 15, 2010

Thanks Steven and sstanleyau,

Below is applescript working code.

tell application "Terminal"
     do script "systemsetup setdate mm:dd:yy"
end tell

Now i want that applescript start terminal run terminal command and then quit terminal.

Please suggest on it.

Thanks,

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 16, 2010 Aug 16, 2010

AppleScript has the command 'do shell script' so there is no need to use the terminal app… But I would add to shane's view on changing this setting? Im not going to try it time machine will probably go bananas…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2010 Aug 16, 2010

Thanks Muppet Mark,

Can you please check below code and suggest me how can i set my old date back.

set oldDate to do shell script "systemsetup -getdate"
do shell script "systemsetup setdate 03:03:10"
--Do some stuff
do shell script "systemsetup setdate " + oldDate

In above code last line not working. Please suggest correct code.

Thanks

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2010 Aug 16, 2010
LATEST

Thanks to all.

Problem solved now .

Here is code.

set oldDate to do shell script "date '+%m:%d:%y'" as string
do shell script "systemsetup setdate 03:03:10"
--Do some stuff
do shell script ("systemsetup setdate " & oldDate)

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines