A_loopfield, if found go to next line

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kadhri
Posts: 49
Joined: 12 Nov 2015, 06:52

A_loopfield, if found go to next line

13 May 2018, 00:47

Hi community,

I am searching multiple files in multiple folders by parsing file name in a text file like

Text file with file names:
QWEYIIOOOFUO9O
SFGHJHJKJJKKKK
EDHJKJGHJJJKKK
DRGYTGHJJGFHJJ

Folders:
2018-05-13, 2018-05-12......

If It found my first file in first folder, I want to stop search for that file and go-to next file

My code is working fine at all but it searching for the file In all folders even it was found,

Help with suggestions
Regards,
Sdk
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: A_loopfield, if found go to next line

13 May 2018, 01:20

Seriously, why don't you post your "fine working code" so that others can improve it ?!? Or can make suggestions that are easily integrated with your code? That comes to my mind, if you want to improve efficiency ;)

Like this, you keep people guessing or even recreating parts that you already have... but if you just want a suggestion: it sounds like you are using a lot of ifs where you might use else ifs instead - but they might be other efficient methods as well (loop through an array of folders with break condition, use loop files etc.). But all this is just a guess...
kadhri
Posts: 49
Joined: 12 Nov 2015, 06:52

Re: A_loopfield, if found go to next line

13 May 2018, 01:40

Thanks,

Currently I haven't access to ahk foum in my office environment, I am browsing this from my mobile..
Will post my code

Regards
Sdk
kadhri
Posts: 49
Joined: 12 Nov 2015, 06:52

Re: A_loopfield, if found go to next line

21 May 2018, 01:50

Hi @gregster

Code: Select all

FileRead, MTRACK, %A_ScriptDir%\Tracks.txt
Loop, parse, MTRACK, `r,`n	
	{
	if A_loopfield=
	break
	SB_SetText("  Currently Searching for:  "A_LoopField)	
		Loop, %LoopCount%  ; if selected month is current month, it will search up to present day or else search accordingly based upon selected month (30 or 31)
			{
			DAY:=SubStr("0" . A_Index,-1)
			Track = *%A_LoopField%*	
			Path1 = %SERVER%\%S_YEAR%-%S_MONTH%-%DAY% 
			Loop, %path1%\%Track%.wav,1,1
				{
				FileCreateDir, %dest%\%S_YEAR%-%S_MONTH%-%DAY%
				FileCopy, %A_LoopFileDir%\%A_LoopFileName%, %dest%\%S_YEAR%-%S_MONTH%-%DAY%
				Sleep, 500
				}
			}
	}



Path Creation:
S_DAY:=substr(CAL,7,2)
S_MONTH:=substr(CAL,5,2)
S_YEAR:=substr(CAL,1,4)
vLOOP := SubStr(CAL, 1, 6)
vLOOP += 32, Days
vLOOP :=Substr(vLOOP,1,6)
vLOOP += -1, Days
vDays:=Substr(vLOOP,7,2)

MTRACK is a consisting of the search track like

14245213FDFDD11G2GDF35DFGDFSG
21DGDF32G53SDFS433254352GDFGF
5425ERT3TEGFG356356345634DGER
GRETERT35563534ERGDFGE633465G
2334W25243563463VDFGEGG6556GG
534534534T634TEFGEFGT35635635
GFEDFGERT3463TGE4645666ERTRTT

I am dynamically building the path, because I have day to day folders like 2018-05-21, 2018-05-20 etc and hundreds of folders in each

Now my problem is, even the track file was found, the loop is running till end,
If my first track was found in 2018-05-01, i want stop search the goto next track and start loop agin with second track

regards,
Kadhri

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: scriptor2016 and 331 guests