Old 27th February 2018, 22:47   #1
Worez
Member
 
Join Date: May 2016
Posts: 98
ATF code for indicating a file being in a specific folder

Lately I have been tempering with my ATF a lot. And the only thing I miss is:

an indicator that would show up if the file being played was residing in a specific folder or its sub-folders


Is it possible- can I make some $if2 with a path to this folder, without the need to list all of the sub-folders?
Worez is offline   Reply With Quote
Old 13th August 2018, 16:53   #2
Worez
Member
 
Join Date: May 2016
Posts: 98
Quote:
Originally Posted by Worez View Post
Lately I have been tempering with [...]
And by "tempering" I mean "tampering" of course
Worez is offline   Reply With Quote
Old 13th August 2018, 17:23   #3
Sensei Le Roof
Junior Member
 
Join Date: Jul 2018
Posts: 12
Have you tried something like "c:\path\to\the\desired\folder\*\"? I don't know if it'll work, but it looks like it might.
Sensei Le Roof is offline   Reply With Quote
Old 3rd September 2018, 18:21   #4
Worez
Member
 
Join Date: May 2016
Posts: 98
Quote:
Originally Posted by Sensei Le Roof View Post
Have you tried something like "c:\path\to\the\desired\folder\*\"? I don't know if it'll work, but it looks like it might.
Thanks for the idea



I tried these ones

code:
$if(($filepath(M:\*)), YES, NO)
$if(($filepath(M:\)), YES, NO)
$if($filepath(M:\*), YES, NO)
$if($filepath(M:\), YES, NO)



code:
$if(($filepath("M:\*")), YES, NO)
$if(($filepath("M:\")), YES, NO)
$if($filepath("M:\*"), YES, NO)
$if($filepath("M:\"), YES, NO)



but all I got was always "NO", no matter if the file was loaded from the drive M or from drive C; and I wanted to get YES for a file from drive M and NO in case of C
Worez is offline   Reply With Quote
Old 3rd September 2018, 23:47   #5
ryerman
Major Dude
 
ryerman's Avatar
 
Join Date: Mar 2010
Location: Canada
Posts: 630
Keep trying.

$left(%filename%,1) returns the Drive letter
$filename(%filename%) returns the base filename
$directory(%filename%,2) returns the name of the folder, up 2 levels

See: http://www.meggamusic.co.uk/winamp/d...f.htm#filepart

Windows 10 Home, 64 bit, Winamp 5.666, Bento Skin
ryerman is offline   Reply With Quote
Old 4th September 2018, 20:23   #6
Worez
Member
 
Join Date: May 2016
Posts: 98
Quote:
Originally Posted by ryerman View Post
I dumbed down my example; that what I am after for

I need to have and indicator [which I myself will specify] to show only if a file was loaded from
M:\M\-\
or any other subfolders in that location. And in the future this location might shrink to something like
M:\-\
or extend to something like
M:\M\-\--\

But most of my files are in location
M:\Music\NAME-OF-AN-INDIVIDUAL-ARTIST
plus few others locations, for which I do not need an indication / marker. I do not need I do not want to see
Music
or
NAME-OF-AN-INDIVIDUAL-ARTIST

I only need to see that
-
or [more preferably] my own indicator / marker substituting for the name of that specific folder, in the beginning or at the end of my ATF displayed by Winamp

And so under that link I do not see codes that could accommodate that. Something that would display >>YES<< or whatever characters I wold choose but only then when the file is exactly in
M:\M\-\
or somewhere even deeper [in a subfolder or subfolder od a subfolder etc.]. Because there is no such code? Am I right?

It seems that the only way I could go around that is to use
code:
$left(%filename%,1)

while moving that
-
folder from drive M to some extra drive that from now on would hold only those files that I currently designate / mark by keeping them in that
M:\M\-\
location. But I do not want to do that. I keep all of music and audio files on the M drive; for a more convenient way of keeping a track of them and for easier archive / backup purposes. I could also try to map a folder and / or create a virtual drive- but that would be using more of solutions that divert even further from my modus operandi


So- is there a code that would accommodate my need or not? A code that would
show X when Y is meet; and that Y is the specified location or its subfolders
Worez is offline   Reply With Quote
Old 5th September 2018, 00:34   #7
Victhor
Late skinner & Moderator
 
Victhor's Avatar
 
Join Date: May 2003
Location: Argentina
Posts: 1,550
A wizard friend of mine told me that what you're lookin' for can be achieved with:

code:
$IfStrEqual2($split(%filename%,\,0),'M:','YES',' NO')


Does it?

· · TMCT · KOMODO X
Victhor is offline   Reply With Quote
Old 5th September 2018, 10:41   #8
Worez
Member
 
Join Date: May 2016
Posts: 98
Quote:
Originally Posted by Victhor View Post
A wizard friend of mine told me that what you're lookin' for can be achieved with:
[...]
Tnak you, this is getting me somewhat nearer
code:
$IfStrEqual2($split(%FILENAME%,\,0),'M:','YES',)

as it no longer requires from me messing up with drives and folders; thus allowing for a more neat workaround

But still I cannot put the very precised path
M:\M\-\*
M:\M\-\
M:\M\-

as all of those three versions inserted where currently the
M:
is in the code, make that >>YES<< indication stop from showing up [the >>NO<< I have removed myself on purpose]
Worez is offline   Reply With Quote
Old 5th September 2018, 18:50   #9
ryerman
Major Dude
 
ryerman's Avatar
 
Join Date: Mar 2010
Location: Canada
Posts: 630
Maybe this does what you want.
(I attached it as a txt file because the forum was screwing up the code.)

Yikes. Nearly 400 characters to produce 1 word! (The max. accepted length of the ATF string is 1022 characters)
Winamp ATF is not exactly a high-level programming language.

http://forums.winamp.com/showthread.php?t=399650
Attached Files
File Type: txt ATF_String.txt (431 Bytes, 86 views)

Windows 10 Home, 64 bit, Winamp 5.666, Bento Skin
ryerman is offline   Reply With Quote
Old 7th September 2018, 18:11   #10
Worez
Member
 
Join Date: May 2016
Posts: 98
Quote:
Originally Posted by ryerman View Post
Maybe this does what you want.
(I attached it as a txt file because the forum was screwing up the code.)
[...]
Maybe... if we decode that code first...

A] The %filename% at the end- I do not think I need it at all. I have my %filename% already in my current string

B] Is >>CorrectDrive<< legit part of the code or place where I am suppose to put a letter of a drive?

C] All the YESes I can replace with the characters I will want to see to indicate that state [info] which I am after?

D] All the NOs I can remove, leaving just a coma followed by nothing? [Becasue I do not need to see confirmation of a no-state, because for me the no-state is the correct / main one]

E] Is that SOME_INDICATOR the place where I put those characters I want to see [thus not the plae where YESes are]?
Worez is offline   Reply With Quote
Old 7th September 2018, 21:04   #11
ryerman
Major Dude
 
ryerman's Avatar
 
Join Date: Mar 2010
Location: Canada
Posts: 630
First, lets clear something up.

You should change the 2 instances of W to M so the code will apply to your file system.

In your original question you gave examples like this:
M:
M:\M\-
I don't have an M:\ drive so I used my W:\ drive for testing but forgot to change the letters in my code to match your question.
Sorry about that chief.

A] %filename% at the end is only there for a comparison, to see whether or not the results are what is desired.

B] "CorrectDrive", "NumberOfParts" and "SecondPart" are the names of variables that contain the results of a sub-string. They can be anything. But the words will not be displayed. See the documentation about $puts $put and $get.

C] No. Every YES and NO is part of the code. They also could be anything, but you may notice that they are part of $if functions. YES and NO are the possible answers to the question asked by the $if functions.

D] No. See above. Don't change them.

E] Yes. SOME_INDICATOR is whatever you want to see. And if you don't see that, you'll see BLANK

Windows 10 Home, 64 bit, Winamp 5.666, Bento Skin
ryerman is offline   Reply With Quote
Old 13th September 2018, 19:47   #12
Worez
Member
 
Join Date: May 2016
Posts: 98
Quote:
Originally Posted by ryerman View Post
First, lets clear something up.
[...]
Thanks, now I have to I have to chew through that

But in the meantime I also have a somewhat [partially] similar riddle: http://forums.winamp.com/showthread.php?t=453544
Worez is offline   Reply With Quote
Old 11th October 2018, 12:46   #13
Wineroz
Junior Member
 
Join Date: Oct 2018
Posts: 16
Quote:
Originally Posted by Worez View Post
[....]
I have to
[...]
I had to make a new account as I lost access to Worez
Wineroz is offline   Reply With Quote
Old 31st October 2018, 20:32   #14
Wineroz
Junior Member
 
Join Date: Oct 2018
Posts: 16
Quote:
Originally Posted by ryerman View Post
Maybe this does what you want
[...]
First- I am sorry for taking so long. That was just rude, as it seemed I had ditched that topic after you having spent time on that code


Second, I will try to past that code in here, your original and mine with some minor adjustments applied to it:
code:

$puts(CorrectDrive,$IfStrEqual2($left(%filename%,1),W,YES,NO))
$puts(NumberOfParts,$add($sub($len(%filename%),
$len($replace(%filename%,\,))),1))
$puts(SecondPart,$PathLTrim($PathLPart(%filename%,2),1))
$IfStrEqual2($get(CorrectDrive),YES,
$IfStrEqual2($ifgreater($get(NumberOfParts),2,YES,NO),NO,SOME_INDICATOR,
$IfStrEqual2($IfStrEqual2($get(SecondPart),W,YES,NO),YES,MY_OWN_INDICATOR,BLANK)),BLANK) ### %filename% ###


code:
$puts(CorrectDrive,$IfStrEqual2($left(%FILENAME%,1),M,YES,NO))
$puts(NumberOfParts,$add($sub($len(%FILENAME%),
$len($replace(%FILENAME%,\,))),1))
$puts(SecondPart,$PathLTrim($PathLPart(%FILENAME%,2),1))
$IfStrEqual2($get(CorrectDrive),YES,
$IfStrEqual2($IfGreater($get(NumberOfParts),2,YES,NO),NO,▼,
$IfStrEqual2($IfStrEqual2($get(SecondPart),M,YES,NO),YES,▼,)),)


[In both versions all of the above should of course be written in one long line, with every part / sub-line touching the next one]


As you can see:

1] I replaced >>W<< with >>M<<, which is suppose to mean the letter of the drive

2] I capitalized %filename% [not really important, I did that just for better readability]

3] I chosen
code:


as a clear indication for the negative case [indication]

4] I removed the positive indication completely, as to not waste space on the Playlist and Songticker for showing me some marker when I do not need it to see it [as for me it is the normal state than I expect to see for 99.99% of the time]


And it works. I can stick literally right next to it my previous ATF code and see that triangle whenever a file is residing in... folder M of drive M. Was that your intention? It was mine as that is exactly what I was after, as I keep in folder M or its sub-folders files that are most likely to be deleted or somehow worked on- but to which files I still listen too altogether with all of the other normal files. And so my triangle tells me that such file is to be deleted or taken care of in some other way

But if your >>W<< meant drive and my >>M<< means folder - how is that possible? All my files are on drive >>M<< but those which are to be marked with my triangle indicator are residing only in folder >>M<<. And that second code does this
Wineroz is offline   Reply With Quote
Old 1st November 2018, 14:24   #15
ryerman
Major Dude
 
ryerman's Avatar
 
Join Date: Mar 2010
Location: Canada
Posts: 630
Quote:
Originally Posted by Wineroz View Post
.....And it works. I can stick literally right next to it my previous ATF code and see that triangle whenever a file is residing in... folder M of drive M. Was that your intention?....
I had no intention except to meet the requirements that were indicated by your previous questions and examples.

Quote:
Originally Posted by Wineroz View Post
...if your >>W<< meant drive and my >>M<< means folder - how is that possible? All my files are on drive >>M<< but those which are to be marked with my triangle indicator are residing only in folder >>M<<.....
It seemed you were interested in files that were in M:\ or M:\M. Therefore, M could be the drive letter and/or the name of a folder.
I had no details of your file system so I assumed the drive could be anything and the next folder (SecondPart) could be anything.
In the code, the variable name "SecondPart" means "the 2nd part of the file path", which is a folder.

If all your files are always on drive M, then the code that deals with "CorrectDrive" is probably unnecessary.

Windows 10 Home, 64 bit, Winamp 5.666, Bento Skin
ryerman is offline   Reply With Quote
Old 5th November 2018, 18:25   #16
Wineroz
Junior Member
 
Join Date: Oct 2018
Posts: 16
Quote:
Originally Posted by ryerman View Post
I had no intention except to meet the requirements that were indicated by your previous questions and examples.
[...]
It seemed you were interested in files that were in M:\ or M:\M. Therefore, M could be the drive letter and/or the name of a folder.
[...]
If all your files are always on drive M, then the code that deals with "CorrectDrive" is probably unnecessary.
I will leave it

Because rarely I also play files from drives other than M. And so with that neat code my triangle appears exactly when I want it: which is when file is somewhere within folder M on drive M. And if a file is in folder M [even in sub-folder M] but on drive D, then the triangle does not appear. So that goes beyond my previous expectations

So thank you very much, you have made what I call a 120% job
Wineroz is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Winamp > Winamp Technical Support

Tags
advanced title formatting, atf, directory, path

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump