Script for calculating the difference between two dates, which doesn't work 100%...

Share your favorite FastKeys commands
Post Reply
User avatar
Oblomov
Posts: 184
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Apr 1st, ’21, 20:37

Hello,

I'm trying to get 'HowLongYearsMonthsDays.ahk' working on FK, from:
http://www.computoredge.com/AutoHotkey/ ... ml#HowLong

Direct link to the script:
http://www.computoredge.com/AutoHotkey/ ... ays1.2.ahk

And it works just fine, but upon closing the window, it starts messing with FK, as though the script is still running somehow...

Not really sure if it's missing a 'return' somewhere, or the like...

Kind regards
...
User avatar
Marko
Posts: 1718
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Apr 4th, ’21, 09:19

If you are using Type: Command you need to

Add this before creating a Gui (Gui, Add):

Code: Select all

Gui, SpanCalc:Destroy
and remove the following last couple of lines, as they have impact on all scripts:

Code: Select all

; Enable mousewheel in AutoHotkey GUIs

#If MouseIsOver("ahk_class AutoHotkeyGUI")
   WheelUp::Send {Up}
   WheelDown::Send {Down}
#If

MouseIsOver(WinTitle)
{
   MouseGetPos,,, Win
   Return WinExist(WinTitle . " ahk_id " . Win)
}

^!z::
  GuiControl, SpanCalc: , SysDateTimePick321, 20000101
Return
User avatar
Oblomov
Posts: 184
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Apr 4th, ’21, 17:47

Thanks for the feedback!

Would 'Gui, SpanCalc:Destroy' be placed here or between every Gui line perhaps?

Code: Select all

...
Gui, SpanCalc:Destroy

HowLongAutoExec:



Gui, SpanCalc:Add, Text, , Enter Date One:
Gui, SpanCalc:Add, DateTime, vDate1, LongDate
...
Kind regards
...
User avatar
Marko
Posts: 1718
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Apr 4th, ’21, 20:02

Just before first Add:

Code: Select all

...
HowLongAutoExec:

Gui, SpanCalc:Destroy
Gui, SpanCalc:Add, Text, , Enter Date One:
Gui, SpanCalc:Add, DateTime, vDate1, LongDate
...
User avatar
Oblomov
Posts: 184
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Apr 5th, ’21, 15:43

Marko wrote: Apr 4th, ’21, 20:02 Just before first Add:

Code: Select all

...
HowLongAutoExec:

Gui, SpanCalc:Destroy
Gui, SpanCalc:Add, Text, , Enter Date One:
Gui, SpanCalc:Add, DateTime, vDate1, LongDate
...
Gotcha, thanks! :D
Post Reply