Page 1 of 3
File name / Folder name select
Posted: 09 Jan 2014 05:48
by CookieMonster
I swore there was a script, that did the following. When selecting a file, any matching folders with an identical name to the file name get selected as well.
Re: File name / Folder name select
Posted: 09 Jan 2014 10:02
by highend
Code: Select all
foreach($folder, listpane( ,"*", 6)) {
if ("<curbase>" == $folder) {
selectitems $folder, , 0, "a";
}
}
Re: File name / Folder name select
Posted: 09 Jan 2014 15:29
by CookieMonster
When I select the file, then run the script, the folder with close to the exact same name is not selected ?
Re: File name / Folder name select
Posted: 09 Jan 2014 15:47
by TheQwerty
CookieMonster wrote:folders with an identical name to the file name get selected
CookieMonster wrote:folder with close to the exact same name is not selected ?
Sounds like you need to take some time to think about what it is you're trying to accomplish.
Re: File name / Folder name select
Posted: 09 Jan 2014 16:13
by highend
Sounds like you need to take some time to think about what it is you're trying to accomplish.
...
One of the most important features of the forum software? *g*o*e a user...

Re: File name / Folder name select
Posted: 10 Jan 2014 22:44
by CookieMonster
I have a file called 'Acme198' there is a folder called 'Acme198-files' when I select the file 'Acme198' I want the respected folder 'Acme198-files' to be selected as well, which goes for dozens of other files of similarity.
Re: File name / Folder name select
Posted: 11 Jan 2014 01:40
by TheQwerty
Code: Select all
::rtfm('idh_scripting.htm#idh_scripting_comparisons');
Try reading that and seeing if you can figure it out on your own.
Re: File name / Folder name select
Posted: 11 Jan 2014 17:39
by CookieMonster
If the file is equal to the folder then select the folder, all wrapped in a loop. This is exactly how I want the script to work. Although when I select the file(s) the related folders(s) are not selected ?
Re: File name / Folder name select
Posted: 12 Jan 2014 11:00
by RalphM
The Qwerty pointed you in the right direction for some reading and then YOU could try to adapt your changed comparison needs to the earlier script, ok?
And I'm sure if you at least try but can't get it to work straight away, you'll find somebody to help you with further questions.
Re: File name / Folder name select
Posted: 12 Jan 2014 18:53
by CookieMonster
I tried both boolean and NotEqualTo within the condition. When I select a file, for example <PaperWild567>.xxx then run the script all folders that have the same name <PaperWild> are selected instead of the folder(s) with the name <PaperWild567>
Code: Select all
foreach($folder, listpane( ,"*", 6)) {
if ("<filename>" != $folder) {
selectitems $folder, , 0, "a";
}
}
Re: File name / Folder name select
Posted: 20 Jan 2014 18:17
by CookieMonster
I have a file called "acme19ze.<ext> I have a folder with the same name except it has -files appended to the folder name "acme19Ze-files" selecting the file "acme19ze.<ext>" then running the script, selects all the folders with the "-files" appended to the folder name, which is not what I want. The script should only select the exact folder name related to the file, in the example used that would be; "acme19ze.<ext>" and the folder "acme19Ze-files" only, not all the folders, which all have difference folder names with the only exception being the "-files" name is appended onto the folder name.
Code: Select all
foreach($folder, listpane( ,"*", 6)) {
if ("<filename>" != $folder) {
selectitems $folder, , 0, "a";
}
}
Re: File name / Folder name select
Posted: 20 Jan 2014 18:34
by TheQwerty
That section of help I linked to has more operators for comparing than just equal ('==') and not equal ('!='), why not experiment with the others until you find one you like?
Re: File name / Folder name select
Posted: 20 Jan 2014 19:52
by CookieMonster
The problem is not the operator, rather if the file name has letters or numbers, how do you add flexibility to the script whereas your not hard coding in any specific file name that includes letters or numbers, and leaving the script open. For example;
acme19z I don't want the script to only search for folders with 19z I want to to be flexible, I hope that makes sense ?
BTW How did you get this link; I'm not fond of the Read the Fuc*** manual acronym, but oh well
::rtfm('idh_scripting.htm#idh_scripting_comparisons');
Re: File name / Folder name select
Posted: 20 Jan 2014 20:09
by j_c_hallgren
CookieMonster wrote: I'm not fond of the Read the Fuc*** manual acronym, but oh well

For those who aren't familair with the usual values, it can be said as "the Fine" or "the Fabulous" or such -- or at least "the Friggin".
Re: File name / Folder name select
Posted: 20 Jan 2014 20:20
by TheQwerty
CookieMonster wrote:The problem is not the operator
Sure it is.
The example you've provided is you want to select
acme19z.ext and have the script select
acme19z-files - which means you want to select folders with names that start with or are
like the selected file(s).
Based on your original description you only wanted to select folders with the same name as the selected file(s) - which is why highend's script tests for equality (
==).
Your attempts thus far are only looking for folders with names that are not equal to the selected file(s) (
!=) so I hope you understand why it would select
notthefolderwewantselected since it does not equal
acme19z.
The section I linked to includes 8 more operators that could be used, and I guarantee if you gave them all a try and followed the examples you'd eventually find one that you
like, at least for the item names you've provided.
Monster wrote:BTW How did you get this link; I'm not fond of the Read the Fuc*** manual acronym, but oh well
::rtfm('idh_scripting.htm#idh_scripting_comparisons');
At the top of the page I right-clicked
Comparisons in the page index and copied it from the
Properties dialog.