How to use IniRead function

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

How to use IniRead function

27 Jan 2024, 12:28

In a script I want to check whether it's time to do a backup. I do not understand why I get this error message.
Error: Expected a String but got a Func.

▶ 021: lastBackup := IniRead (iniFile, "Control", "lastBackup")
022: MsgBox((lastBackup))
023: later := DateAdd(A_Now, 25, "days")

The ini file itself is quite simple
[Control]
lastBackup = 2024-01-25

What is wrong in line 21?
Klaus Daube, Zürich, CH
gregster
Posts: 9113
Joined: 30 Sep 2013, 06:48

Re: How to use IniRead function

27 Jan 2024, 13:00

Looks like you have a space between IniRead and the opening parenthesis - which shouldn't be there if you choose to use this function syntax.
Compare https://www.autohotkey.com/docs/v2/Functions.htm#param
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

Re: How to use IniRead function

28 Jan 2024, 12:13

Thank you Gregster. That was the reason. Syntax errors have been my "specialty" since the days of Fortran.
Klaus Daube, Zürich, CH
garry
Posts: 3795
Joined: 22 Dec 2013, 12:50

Re: How to use IniRead function

29 Jan 2024, 05:48

@kdaube ( just a note )
FORTRAN , . long ago , never learned, just began with a small SHARP BASIC pocket computer with 4-kB , 1980
Dartmouth BASIC ... I can use this 60 years old program on WIN-11 64-bit / example run GWBASIC / dBaseIII+ :
https://www.softpedia.com/get/Programming/Other-Programming-Files/vDos.shtml ;- vDos lets you conveniently run DOS applications by emulating an extended DOS PC in a window.
------------------
http://www.bitsavers.org/pdf/dartmouth/BASIC_Oct64.pdf
https://www.youtube.com/watch?v=WYPNjSoDrqw -- Birth of BASIC
John G. Kemeny speaks to students ( at 28:35 ) :
....
"If this had been built on a language like ALGOL or FORTRAN, instead of teaching students in 2 or 3 hours how to use BASIC,
one would have spent easily a full week trying to have them understand ALGOL and FORTRAN and a lot of students would've just lost interest.
Writing this program in BASIC is your next assignment."
------------------

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Mateusz53, mikeyww and 59 guests