Auto tagging of extensions?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
davmay
Posts: 17
Joined: 29 Apr 2009 15:05
Location: Ottawa, Canada

Auto tagging of extensions?

Post by davmay »

Please forgive this newbie for asking a question whose answer may be obvious to experienced users.

Is it possible to have XYplorer automatically assign a given tag to files with a given extension?

Or, if not, is it possible to write a script that would execute a command like ASSIGN THE TAG "GREY" TO ALL FILES IN THIS FOLDER AND ITS SUBFOLDERS HAVING THE EXTENSION ".WBK"?

David

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Auto tagging of extensions?

Post by serendipity »

davmay wrote:Please forgive this newbie for asking a question whose answer may be obvious to experienced users.

Is it possible to have XYplorer automatically assign a given tag to files with a given extension?

Or, if not, is it possible to write a script that would execute a command like ASSIGN THE TAG "GREY" TO ALL FILES IN THIS FOLDER AND ITS SUBFOLDERS HAVING THE EXTENSION ".WBK"?

David
Hi and welcome to XY!
Dont be hesitant to ask questions, newbies are most welcome here. And regarding your question, yes it should be possible, maybe something like this:
Paste the following code inside menu "Scripting>Try scripting" and see how it works:

Code: Select all

//Hide folders
   setting HideFoldersInList;
//select all files
   sel a;
//assign tag ID #7 (XY default is gray)
   tag 7;
//show folders
   setting HideFoldersInList, 0;
//show all items in branch
   #263;
//hide folders
   setting HideFoldersInList;
//select all files with .wbk extension
   selfilter *.wbk;
//assign tag ID #7
   tag 7;
You are welcome to ask more questions here. Good place to learn about XY is to take a XY tour and also go through XYwiki which is very useful for newbies too.

admin
Site Admin
Posts: 66305
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Auto tagging of extensions?

Post by admin »

serendipity, I admit I don't do much scripting myself ... but I don't understand the beginning of your script. Why not simply do the lower part? Works here:

Code: Select all

//show all items in branch
   #263;
//hide folders
   setting HideFoldersInList;
//select all files with .wbk extension
   selfilter *.wbk ;
//assign tag ID #7
   tag 7;

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Auto tagging of extensions?

Post by serendipity »

admin wrote:serendipity, I admit I don't do much scripting myself ... but I don't understand the beginning of your script. Why not simply do the lower part? Works here:

Code: Select all

//show all items in branch
   #263;
//hide folders
   setting HideFoldersInList;
//select all files with .wbk extension
   selfilter *.wbk ;
//assign tag ID #7
   tag 7;
Because Davmay wanted all files to be tagged in current folder and only .wbk in subfolders, if i understood correctly.

davmay
Posts: 17
Joined: 29 Apr 2009 15:05
Location: Ottawa, Canada

Re: Auto tagging of extensions?

Post by davmay »

Serendipity, thanks for your script. If my initial posting was not clear about what I wanted, let me restate it:

FOR ALL FOLDERS IN (GIVEN FOLDER AND ITS SUBFOLDERS) DO:
ASSIGN TAG "GREY" TO ALL FILES WHOSE EXTENSION = ".WBK"
END DO

davmay

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Auto tagging of extensions?

Post by serendipity »

davmay wrote:Serendipity, thanks for your script. If my initial posting was not clear about what I wanted, let me restate it:

FOR ALL FOLDERS IN (GIVEN FOLDER AND ITS SUBFOLDERS) DO:
ASSIGN TAG "GREY" TO ALL FILES WHOSE EXTENSION = ".WBK"
END DO

davmay
Oh ok, so Don (admin) was right, just used this script then.

Code: Select all

//show all items in branch
   #263;
//hide folders
   setting HideFoldersInList;
//select all files with .wbk extension
   selfilter *.wbk ;
//assign tag ID #7
   tag 7;

Post Reply