DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: DONE: auto-save AutoHotkey.ini daily to another folder  (Read 12,301 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
DONE: auto-save AutoHotkey.ini daily to another folder
« on: November 24, 2005, 05:36 AM »
Hi,

I'd like to add a few lines to my main AHK script (that's running 24/7) that will copy this script to another partition but with the name AutoHotkey-YYYY-MM-DD.ini (so for today it would be AutoHotkey-2005-11-24.ini) once a day only - so I'd get one copy for every day the PC is running.

Any ideas? Maybe this could be somehow combined with the auto-reload on save script?

Code
;2005-11-23
;auto-reloads the AHK script
;http://www.autohotkey.com/forum/viewtopic.php?t=135&highlight=auto+reload
$^s:: 
  Send, ^s 
  SetTitleMatchMode, 2
  IfWinActive, AutoHotkey.ini
    { 
       TrayTip, AutoHotkey, reloading script...
       SetTimer, RemoveTrayTip, 1500
     } 
return 

RemoveTrayTip: 
    SetTimer, RemoveTrayTip, Off 
    TrayTip 
    Reload 
return 
;http://www.autohotkey.com/forum/viewtopic.php?t=135&highlight=auto+reload

Thank you.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: IDEA: auto-save AutoHotkey.ini daily to another folder
« Reply #1 on: November 24, 2005, 06:21 AM »
very useful idea.
can i suggest two additional features:
1) dont make a new backup file for the day if its identical to the last one.
2) zip it when making backup (in this case you wouldnt have to add date to file, just to zip).

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
Re: IDEA: auto-save AutoHotkey.ini daily to another folder
« Reply #2 on: November 24, 2005, 10:30 AM »
I didn't suggest option 1) because I want it to be as fast as possible, but I like your suggestion 2)!
Thank you.

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: IDEA: auto-save AutoHotkey.ini daily to another folder
« Reply #3 on: November 24, 2005, 04:40 PM »
:) How about something along the lines of

Code
SetTimer,BACKUP,60000

BACKUP:
IfNotExist,D:\AutoHotkey-%A_YYYY%-%A_MM%-%A_DD%.ini
  FileCopy,C:\AutoHotkey.ini,D:\AutoHotkey-%A_YYYY%-%A_MM%-%A_DD%.ini
Return

Skrommel
« Last Edit: November 25, 2005, 01:12 AM by skrommel »

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
Re: IDEA: auto-save AutoHotkey.ini daily to another folder
« Reply #4 on: November 24, 2005, 10:01 PM »
:) How about something along the lines of
[...]
clean and simple solution, thanks! :)
Thank you.

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
Re: IDEA: auto-save AutoHotkey.ini daily to another folder
« Reply #5 on: November 25, 2005, 07:54 AM »
Hmm, very strange:

At 23:07, while we still had the 24th, it created this file:
AutoHotkey-2005-11-25

EDIT:
Err, probably it is working just fine, I was just confused by the fact that the file date wasn't changed when copied, but that's good, I just have to get used to it :D
Thank you.
« Last Edit: November 25, 2005, 07:56 AM by brotherS »

Original address: https://www.donationcoder.com/forum/index.php?topic=1603.0