loop not working

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

loop not working

24 Jul 2017, 09:12

this:

Code: Select all

Loop, %clipboard%\Ah2*
{
ah2_cuts = %ah2_cuts%`n%A_LoopFilename%
}
gives me what I expect, this:
Ah2 Alligator Crawl Dr.mp3
Ah2 Ashmir Neck Dr.mp3
Ah2 Big Coconuts DrBass.mp3


This gives me nothing in return. I would expect to get the same result as above WITHOUT .mp3 in each file name. I cant even get the msgbox to show anything.

Code: Select all

Loop, %ah2_cuts%\*.mp3
{
msgbox, %A_LoopFilename% 
StringTrimRight, No_mp3, A_LoopFilename, 4
ah2_cuts2 = %ah2_cuts2%`n%No_mp3%
}
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

Re: loop not working

24 Jul 2017, 09:18

this works

Code: Select all

Loop, %clipboard%\Ah2*
{
StringTrimRight, No_mp3, A_LoopFilename, 4
ah2_cuts = %ah2_cuts%`n%No_mp3%
}
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: loop not working

24 Jul 2017, 09:19

in the second code, Loop, %ah2_cuts%\*.mp3 what is the contents of ah2_cuts?
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

Re: loop not working

24 Jul 2017, 09:28

Ah2 Alligator Crawl Dr.mp3
Ah2 Ashmir Neck Dr.mp3
Ah2 Big Coconuts DrBass.mp3
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: loop not working

24 Jul 2017, 09:35

when you use Loop, %ah2_cuts%\*.mp3 ah2_cut should be a file path such as c:\temp.
in case you want to loop through a list not a folder use Loop, Parse

try this:

Code: Select all

ah2_cuts =
(
Ah2 Alligator Crawl Dr.mp3
Ah2 Ashmir Neck Dr.mp3
Ah2 Big Coconuts DrBass.mp3
)

loop, parse, ah2_cuts, `n, `r
{
	MsgBox % A_LoopField
}
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

Re: loop not working

24 Jul 2017, 10:30

parse, got it, thanks
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: loop not working

24 Jul 2017, 10:38

... and instead of this: ah2_cuts = %ah2_cuts%`n%A_LoopFilename%
... have a try with that: ah2_cuts .= A_LoopFilename "`n"
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

Re: loop not working

24 Jul 2017, 12:14

what is .=
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: loop not working

24 Jul 2017, 12:32

sbrady wrote:what is .=
Per Expression Operators
Similarly, Var .= "abc" is a shorthand way of writing Var := Var . "abc".
or in other words append to end of variable.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 226 guests