Global Variables in Function & Parsing Large File Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 14
Joined: 30 Apr 2017, 08:07

Global Variables in Function & Parsing Large File

26 Apr 2019, 12:31

I'm currently trying to make a function within this script that generates an array of strings, but only with words within the character limit specified.

My issue lies in the while loop. None of the global variables are recognized, nor is the locally redefined variable Index.

Currently just debugging 'List of Strings' as 5 Length, between 1 ~ 10 chars.

Additionally, I'm hoping somebody might have insight to improving how the Dictionary.txt is parsed into an array. I thought FileRead + StrSplit might work, but I'm a bit lost to implementing it (or lack of trying). Currently, my dictionary contains over 270,000 lines of single words and takes approx. 7 seconds for me to write into the array this way.
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Global Variables in Function & Parsing Large File

26 Apr 2019, 13:55

Your global variables aren't recognized in the While loop because you forgot to put global at the top of the gen_ListStr() function that it's in.

As for using FileRead + StrSplit(), try:

Code: Select all

FileRead, myFile, Dictionary.txt
myArray := StrSplit(myFile, "`n", " `t")	; Split at newline characters and omit spaces and tabs from the start and end

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, andy5566888, Bing [Bot], BNOLI, Smile_, xeno and 220 guests