New User - Starter Questions

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
CPerry
Posts: 14
Joined: 21 Mar 2021, 09:13

Re: New User - Starter Questions

Post by CPerry » 25 Apr 2021, 16:27

Good evening boiler,

That’s cool that your family contains teachers, I teach primary school so I’ve had to teach myself all of this coding stuff myself. As you can imagine, it’s out of the grasp of most 5/7 year olds aha.

Yeah, true. I completely am at fault for whatever I did, I just don’t know what it was aha like you said though, all working! I rewrote the code from my old laptop to my server once it was done but the most I had was:
FileCopy, (Old), (New)(20210426) ready for tomorrow.
I suppose I would write this as (New)(DateVariable) and at the line above write DateVariable = … something?

Could you explain to me how variables work with AHK and how I would use a single string variable to store tomorrow’s date in the format I’ve mentioned a few times please? Sorry, I had a week away to do work-work so could do with a refresher.

User avatar
boiler
Posts: 17046
Joined: 21 Dec 2014, 02:44

Re: New User - Starter Questions

Post by boiler » 25 Apr 2021, 18:26

This is how you would get tomorrow’s date with the format you indicated into a variable named Tomorrow:

Code: Select all

Tomorrow := A_Now
Tomorrow += 1, days
Tomorrow := SubStr(Tomorrow, 1, 8)
Then you can use that variable to copy a file to another with that date like this:

Code: Select all

FileCopy, TradingBotLiveV1.1.3, TradingBotLiveV1.1.3(%Tomorrow%)
Or it might be easier to always think in terms of expression syntax by forcing expressions where legacy syntax is otherwise expected:

Code: Select all

FileCopy, % "TradingBotLiveV1.1.3", % "TradingBotLiveV1.1.3(" Tomorrow ")"

CPerry
Posts: 14
Joined: 21 Mar 2021, 09:13

Re: New User - Starter Questions

Post by CPerry » 26 Apr 2021, 15:35

Thank you boiler!

This works a treat. I'll spend a few more days learning and extending my code myself around work now. Thank you for getting me this far!

Post Reply

Return to “Ask for Help (v1)”