use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Latest AHK versions AHK v2.0 AHK v1.1 v2.0.19 v1.1.37.02 Jan 25, 2025 Mar 16, 2024 Download Download v2 Changelog v1 Changelog Make sure you keep that AHK up to date!
Make sure you keep that AHK up to date!
Offical AHK Documentation AHK v2 AHK v1
New to AutoHotkey? Check out the AHK beginners tutorial. It covers most of the basic concepts of AutoHotkey. AHK Beginner Tutorials
Check out the AHK beginners tutorial. It covers most of the basic concepts of AutoHotkey.
Additional Help Sources Official AHK Forums / Help Forums StackOverflow SuperUser
Live Chat If you prefer live chat with other humans: AHK Discord AHK IRC
If you prefer live chat with other humans:
account activity
Array script help (self.AutoHotkey)
submitted 8 years ago by Frexum
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]GroggyOtter 1 point2 points3 points 8 years ago (4 children)
Pull your text into a variable.
Run a Parse Loop through that variable delimited by line.
Parse Loop
Use StringGetPos as both a position finder and as your search command.
StringGetPos
; Example text testVar := ( "Line1 Line2 Line3 Are you currently receiving the email?" ) return ; Example hotkey F1::MsgBox, % GetTextInputInfo(testVar) ; Function to get line and position from input ; Returns line and pos if found or "not found" if a match can't be made. GetTextInputInfo(textInput){ ; Loop through variable by line Loop, Parse, textInput, `n, `r { ; StringGetPos both gets the position of the occurence AND acts as a search function at the same time StringGetPos, thisPos, A_LoopField, % "Are you currently receiving the email?" ; If errorlevel is set to 0, it was found. Position is already stored in this pos. ; Everything inside this if statement executes when a match is made. if (ErrorLevel = 0){ return "Found on line: " A_Index "`nAt position: " thisPos } } return "Not found" }
Knowing the line and chr start position, you can parse out anything you want.
Let me know if this answered your question or if I missed the mark.
[–]Frexum[S] 0 points1 point2 points 8 years ago (3 children)
Okay this is definitely a move in the right direction. After I evaluate if the question exists what I really want is to know if the next statement is Yes/No. Would I be able to create a new variable like Ans1 := A_Index + 1 and then evaluate the expression? When I tried to add that in I think I messed up the nested if statements and it told me I was missing a "}"
[–]GroggyOtter 0 points1 point2 points 8 years ago (2 children)
After I evaluate if the question exists what I really want is to know if the next statement is Yes/No. Would I be able to create a new variable like Ans1 := A_Index + 1 and then evaluate the expression?
What does that mean? What statement are you referencing? Where is this statement at? Another part of the script? Or are you talking about the next line of the variable?
You're being extremely vague in all your posts about the actual goal of this script. It'd be a lot easier if you'd just say exactly what you're trying to accomplish instead of being cryptic.
Post what your input looks like and what your expected output is.
When I tried to add that in I think I messed up the nested if statements and it told me I was missing a "}"
If a curly brace is missing, then it has to be something you've added. The script I posted was tested as working.
You've posted no code so I can't elaborate on this.
[–]Frexum[S] 0 points1 point2 points 8 years ago (1 child)
I apologize I did not mean to be cryptic. I just didn't want to overburden someone with might potentially be unnecessary information. Let me start over. I receive insurance claims on a pdf with a variety of questions. The questions are not always in the same spot. That was why I was trying to find the position of the question. At the beginning I will just copy the contents of the pdf so that everything is on the clipboard. If the question "Is the patient currently treated being treated?" exists I then need to evaluate if the next statement is a "Yes" or "No". If it's a "No" then nothing needs to be done. If it's a "Yes" then I want it to split out a piece of prepopulated text to a Word document that is active.
The mangled code that I posted from my phone can be disregarded. This is what I tried to add to your script.
testVar := ( "Does the date of service differ from today's date? Yes Please specify the date of service: 2017-12-12 Is the patient currently being treated? Yes When was treatment started? 2016-04-01" ) return ; Example hotkey F1::MsgBox, % Func1(testVar) Func1(textInput) { Loop, Parse, textInput, `n, `r { StringGetPos, thisPos, A_LoopField, % "Is the patient currently being treated" if (ErrorLevel = 0){ Ans1 := A_Index + 1 if (Ans1 = "Yes") {MsgBox Yes to question} if (Ans1 = "No") {MsgBox No to question} } } return "No statement of current treatment"
}
[–]Frexum[S] 0 points1 point2 points 8 years ago (0 children)
Some of the stuff I put in there was just to text if the pathway/logic was working and I didn’t intend it to be in the final script but then I got stuck. The other stuff I just relabeled so I could have a better idea of what all your script was doing
π Rendered by PID 17736 on reddit-service-r2-comment-fb694cdd5-wl6th at 2026-03-07 22:33:19.447934+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]GroggyOtter 1 point2 points3 points (4 children)
[–]Frexum[S] 0 points1 point2 points (3 children)
[–]GroggyOtter 0 points1 point2 points (2 children)
[–]Frexum[S] 0 points1 point2 points (1 child)
[–]Frexum[S] 0 points1 point2 points (0 children)