Function - problem Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
andy_BSZY
Posts: 67
Joined: 13 Sep 2023, 09:52

Function - problem

Post by andy_BSZY » 04 Mar 2024, 13:39

I wanted to use the result from this function outside the curly brackets but it doesn't work. What am I doing wrong? :?

Code: Select all

unix() {
var1 := A_NowUTC
var2 := "19700101"
DateDiff(var1, var2, "Seconds")
}

MsgBox unix()

User avatar
WarlordAkamu67
Posts: 232
Joined: 21 Mar 2023, 06:52

Re: Function - problem  Topic is solved

Post by WarlordAkamu67 » 04 Mar 2024, 13:42

Hello. You must return the value from the function.

Code: Select all

unix() {
  var1 := A_NowUTC
  var2 := "19700101"
  return(DateDiff(var1, var2, "Seconds"))
}

MsgBox unix()

User avatar
andy_BSZY
Posts: 67
Joined: 13 Sep 2023, 09:52

Re: Function - problem

Post by andy_BSZY » 04 Mar 2024, 13:54

@WarlordAkamu67 Thank you very much for your help, this is what I wanted :thumbup:

Post Reply

Return to “Ask for Help (v2)”