File name / Folder name select
File name / Folder name select
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
Code: Select all
foreach($folder, listpane( ,"*", 6)) {
if ("<curbase>" == $folder) {
selectitems $folder, , 0, "a";
}
}
One of my scripts helped you out? Please donate via Paypal
Re: File name / Folder name select
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
CookieMonster wrote:folders with an identical name to the file name get selected
Sounds like you need to take some time to think about what it is you're trying to accomplish.CookieMonster wrote:folder with close to the exact same name is not selected ?
Re: File name / Folder name select
...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...
One of my scripts helped you out? Please donate via Paypal
Re: File name / Folder name select
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
Code: Select all
::rtfm('idh_scripting.htm#idh_scripting_comparisons');
Re: File name / Folder name select
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
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.
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.
Ralph
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
Re: File name / Folder name select
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
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
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
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');
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');
-
- XY Blog Master
- Posts: 5824
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
Re: File name / Folder name select
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".CookieMonster wrote: I'm not fond of the Read the Fuc*** manual acronym, but oh well
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
Re: File name / Folder name select
Sure it is.CookieMonster wrote:The problem is not the operator
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.
At the top of the page I right-clicked Comparisons in the page index and copied it from the Properties dialog.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');