Page 1 of 1

Auto tagging of extensions?

Posted: 29 Apr 2009 15:19
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

Re: Auto tagging of extensions?

Posted: 29 Apr 2009 16:00
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.

Re: Auto tagging of extensions?

Posted: 29 Apr 2009 16:10
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;

Re: Auto tagging of extensions?

Posted: 29 Apr 2009 16:18
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.

Re: Auto tagging of extensions?

Posted: 29 Apr 2009 16:57
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

Re: Auto tagging of extensions?

Posted: 29 Apr 2009 17:15
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;