Announcement

Collapse
No announcement yet.

ATF code for indicating a file being in a specific folder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wineroz
    replied
    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

    Leave a comment:


  • ryerman
    replied
    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.

    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.

    Leave a comment:


  • Wineroz
    replied
    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

    Leave a comment:


  • Wineroz
    replied
    Originally Posted by Worez View Post
    [....]
    I have to
    [...]
    I had to make a new account as I lost access to Worez

    Leave a comment:


  • Worez
    replied
    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

    Leave a comment:


  • ryerman
    replied
    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

    Leave a comment:


  • Worez
    replied
    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]?

    Leave a comment:


  • ryerman
    replied
    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.

    Howzit....Whatzit...what tha...? How to tune up, and keep your Winamp player humming along. Search this Forum to find others who have driven down your road and have advice and tips to help you out.
    Attached Files

    Leave a comment:


  • Worez
    replied
    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]

    Leave a comment:


  • Victhor
    replied
    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?

    Leave a comment:


  • Worez
    replied
    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

    Leave a comment:


  • ryerman
    replied
    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

    Leave a comment:


  • Worez
    replied
    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

    Leave a comment:


  • Sensei Le Roof
    replied
    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.

    Leave a comment:


  • Worez
    replied
    Originally Posted by Worez View Post
    Lately I have been tempering with [...]
    And by "tempering" I mean "tampering" of course

    Leave a comment:

Working...
X
😀
🥰
🤢
😎
😡
👍
👎