Problem with array/variable with space Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Schezza
Posts: 9
Joined: 08 Nov 2019, 16:50

Problem with array/variable with space

Post by Schezza » 28 Jan 2022, 12:34

Hey guys, I've tried testing around with blank := a_space, but can't get it to work. I've tried quotations as well.

I'm a newb, so I'd rather ask for help from professionals than spend hours trying. :D

Apparently stringsplitting doesn't like spaces..
Problem is there:
StringSplit, v2r, % %Buildings2%[Level2], |

It's a program that counts numbers together, for a game with different buildings and different levels.

Code: Select all

Großer Stall := ["70|40|60|20","90|50|75|25","115|65|100|35","145|85|125|40","190|105|160|55","240|135|205|70","310|175|265|90"]

GebäudeGallier = Akademie|Bäckerei|Botschaft|Eisengießerei|Große Kaserne|Großer Kornspeicher|Großer Stall|Großes Rohstofflager|Handelskontor




		StringSplit, v2r, % %Buildings2%[Level2], |
		sum2 := v2r1 + v2r2 + v2r3 + v2r4
		
		v2r1a := RegExReplace(v2r1, "(\d)(?=(?:\d{3})++$)", "$1.")
		v2r2a := RegExReplace(v2r2, "(\d)(?=(?:\d{3})++$)", "$1.")
		v2r3a := RegExReplace(v2r3, "(\d)(?=(?:\d{3})++$)", "$1.")
		v2r4a := RegExReplace(v2r4, "(\d)(?=(?:\d{3})++$)", "$1.")
		sum2a := RegExReplace(sum2, "(\d)(?=(?:\d{3})++$)", "$1.")
		
Thank you very much!

User avatar
mikeyww
Posts: 26936
Joined: 09 Sep 2014, 18:38

Re: Problem with array/variable with space

Post by mikeyww » 28 Jan 2022, 12:56

What happens when you run the script? What should happen instead? If you use a command to display the values of the various variables in your StringSplit command, what values are displayed? Do you have a script that both demonstrates the problem and allows the forum reader to test it?

Schezza
Posts: 9
Joined: 08 Nov 2019, 16:50

Re: Problem with array/variable with space

Post by Schezza » 28 Jan 2022, 15:00

Apparently not that easily solved?

F12::ExitApp


The Array is the GroStall one. But I want a space: "Gro Stall"
If I add the space in the dropmenu, I get an illegal character warning via StringSplit function, when autofill searches it.
And if I add it to the array, it doesn't even start because it doesn't recognize the array with a space.


There must also be a way to have the name in the dropmenu with a space but get the array without a space, but with autofill and all other stuff it's gotten too complicated for me.

Thanks!

https://mega.nz/file/DCZXDSAR#91n2vDtnIwUHIIvv-QYNaGmLa0ifwf1M8vSF-mZ1F1s

User avatar
mikeyww
Posts: 26936
Joined: 09 Sep 2014, 18:38

Re: Problem with array/variable with space

Post by mikeyww » 28 Jan 2022, 18:46

I am struggling to identify the question. I have no idea why you typed "F12::ExitApp" into your post. Can you post in this forum some snippet of code that demonstrates the error that you mentioned, or illustrates what you cannot achieve with your GUI?

amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Problem with array/variable with space

Post by amateur+ » 28 Jan 2022, 18:53

@Schezza, you can't use spaces in names of variables. It is forbidden.
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.

User avatar
mikeyww
Posts: 26936
Joined: 09 Sep 2014, 18:38

Re: Problem with array/variable with space

Post by mikeyww » 28 Jan 2022, 19:26

I see. Yes, that is true. Information is here. https://www.autohotkey.com/docs/Concepts.htm#names

Schezza
Posts: 9
Joined: 08 Nov 2019, 16:50

Re: Problem with array/variable with space  Topic is solved

Post by Schezza » 29 Jan 2022, 05:26

Easiest workaround was to just RegExReplace spaces.

Post Reply

Return to “Ask for Help (v1)”