Stumped by IfNotInString

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Revvilo
Posts: 6
Joined: 17 Nov 2015, 00:30

Stumped by IfNotInString

17 Nov 2015, 00:59

Ok, first things first; I am very new to AHK so my script may be the most messy thing you have seen.
Anyway I am trying to make a script that:
• Reads a line of the specified file, and Inputs it,
• Then goes onto the next line and does the same again.
The problem I am having is that I want to be able to insert comments (//) on a separate line, into that file and have the loop not input them, rather just skip over the line with the comment.
So this is what I have been using for a while just fine (I have only recently wanted comments).
THIS IS NOT THE FULL SCRIPT so plz ask if you require it

Code: Select all

	Loop, Read, %Path%%Kit%
	{
		If Killloop = 1
			Break
		
		StringSplit, line, A_LoopReadLine, `n*
	
		IfNotInString, line, //				;The problematic line (Possibly)
		{
			SendInput, {Enter}
			Sleep 100
			SendInput, %line1%
			Sleep 100
			SendInput, {Enter}
			Sleep 100
		}
	}
	return
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Stumped by IfNotInString

17 Nov 2015, 01:50

Try this to skip a commented line:

Code: Select all

If SubStr(A_LoopReadLine, 1, 2) = "//"
    Continue ; skip the commented line
Revvilo
Posts: 6
Joined: 17 Nov 2015, 00:30

Re: Stumped by IfNotInString

17 Nov 2015, 02:14

Awesome, thanks a load
I read up on SubStr and I see I should have used it all along :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Ineedhelplz and 317 guests