One script to rule them [folders] all

Features wanted...
Post Reply
ivan
Posts: 577
Joined: 02 Apr 2008 12:52
Contact:

One script to rule them [folders] all

Post by ivan »

As far as I know, currently if you have a script that does some magic to files in a folder then you need to go to that folder, press a KS (if configured) and voilà!

I think it would be great if it would be possible to select multiple folders, press the same KS and have scripts execute as if you were to do the same thing but folder-by-folder manually.

Thoughts are always appreciated...ARRR! :lol:
Windows Vista Business SP1 32-bit, Logitech MX400 mouse, SetPoint 4.60.122
Image

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

Post by serendipity »

This is possible already, the folders you want to perform an action need not be fixed. You can select bunch of folders and whatever action you want can be performed on those folders.

ivan
Posts: 577
Joined: 02 Apr 2008 12:52
Contact:

Post by ivan »

serendipity wrote:This is possible already, the folders you want to perform an action need not be fixed. You can select bunch of folders and whatever action you want can be performed on those folders.
But what if the script doesn't act on what you have selected but uses alternative criteria of what to do with files of certain type?

In fact, I have tested it and it doesn't work if you just select a folder. The script tries to act on files that are present within the folder in which a folder is selected.
Windows Vista Business SP1 32-bit, Logitech MX400 mouse, SetPoint 4.60.122
Image

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

Post by serendipity »

It would be much easier if you say what exactly you want the script to do. I am not an expert in scripting, but I am sure others will also try and help you here. So bring it on.

ivan
Posts: 577
Joined: 02 Apr 2008 12:52
Contact:

Post by ivan »

serendipity wrote:It would be much easier if you say what exactly you want the script to do. I am not an expert in scripting, but I am sure others will also try and help you here. So bring it on.
I already have a script. Here it is...

Code: Select all

Set(%cf%,<curfolder>);
   Set(%cp%,<curpath>);
   Set(%nn%,<date yyyymmddhhnnss>);
   OpenWith("""C:\program files\winrar\winrar.exe"" e -- *.rar * %nn%-temp", "s");
   Msg("Press OK when WinRAR is finished.",1);
   GoTo("<curpath_s>\%nn%-temp");
   Sel(a);
   Rename(bat,%cf%);
   Focus(L);
   MoveTo("..\..");
   #523;
   #523;
   Rename(bat,%nn%,,"%cp%");
   SelFilter(%nn%, d, Name);
   Focus(L);
   #169; 
So basically, I want that script to work on multiple selected folders without having to go into each one like I currently have to :)
Windows Vista Business SP1 32-bit, Logitech MX400 mouse, SetPoint 4.60.122
Image

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

Post by serendipity »

ivan wrote:
serendipity wrote:It would be much easier if you say what exactly you want the script to do. I am not an expert in scripting, but I am sure others will also try and help you here. So bring it on.
I already have a script. Here it is...

Code: Select all

Set(%cf%,<curfolder>);
   Set(%cp%,<curpath>);
   Set(%nn%,<date yyyymmddhhnnss>);
   OpenWith("""C:\program files\winrar\winrar.exe"" e -- *.rar * %nn%-temp", "s");
   Msg("Press OK when WinRAR is finished.",1);
   GoTo("<curpath_s>\%nn%-temp");
   Sel(a);
   Rename(bat,%cf%);
   Focus(L);
   MoveTo("..\..");
   #523;
   #523;
   Rename(bat,%nn%,,"%cp%");
   SelFilter(%nn%, d, Name);
   Focus(L);
   #169; 
So basically, I want that script to work on multiple selected folders without having to go into each one like I currently have to :)
You can repeat that script that over and over again by labelling your script (eg. xyz) using "sub xyz" command at the end of the script. I havent tried this because I dont have winrar and time right now, but you get the idea.

Code: Select all

   "xyz : xyz"
   Set(%cf%,<curfolder>); 
   Set(%cp%,<curpath>); 
   Set(%nn%,<date yyyymmddhhnnss>); 
   OpenWith("""C:\program files\winrar\winrar.exe"" e -- *.rar *    %nn%-temp", "s"); 
   Msg("Press OK when WinRAR is finished.",1); 
   GoTo("<curpath_s>\%nn%-temp"); 
   Sel(a); 
   Rename(bat,%cf%); 
   Focus(L); 
   MoveTo("..\.."); 
   #523; 
   #523; 
   Rename(bat,%nn%,,"%cp%"); 
   SelFilter(%nn%, d, Name); 
   Focus(L); 
   //Delete
   #169;
   sub xyz

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

Post by serendipity »

A simple harmless script to try:

"Go to next folder : gonext"
msg "go to next folder?", 1;
sel +1;
sub gonext

ivan
Posts: 577
Joined: 02 Apr 2008 12:52
Contact:

Post by ivan »

serendipity wrote:You can repeat that script that over and over again by labelling your script (eg. xyz) using "sub xyz" command at the end of the script. I havent tried this because I dont have winrar and time right now, but you get the idea.
I doubt this will do the intended because I actually don't see the part where XY would recognise the list of folders it has to apply the script to and whether it will do all at once or one by one.
Windows Vista Business SP1 32-bit, Logitech MX400 mouse, SetPoint 4.60.122
Image

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

Post by serendipity »

OK, let me try to understand this:

1. Say you have 5 folders which have 5 rar files each inside them.
2. you want to go inside folder 1,
3. extract the contents of 5 rar files,
4. move the extracted files to parent folder,
5. delete the 5 rar files and
6. continue doing the same with folders 2, 3 and so on.

Is that illustration right?

ivan
Posts: 577
Joined: 02 Apr 2008 12:52
Contact:

Post by ivan »

serendipity wrote:OK, let me try to understand this:

1. Say you have 5 folders which have 5 rar files each inside them.
2. you want to go inside folder 1,
3. extract the contents of 5 rar files,
4. move the extracted files to parent folder,
5. delete the 5 rar files and
6. continue doing the same with folders 2, 3 and so on.

Is that illustration right?
Between steps 3 & 4 those extracted files would need to be renamed into the name of that folder. Also, in step 5 the whole folder needs deleting, not just the RAR files, but apart from that your illustration is correct.
Windows Vista Business SP1 32-bit, Logitech MX400 mouse, SetPoint 4.60.122
Image

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

Post by serendipity »

ivan wrote:
serendipity wrote:OK, let me try to understand this:

1. Say you have 5 folders which have 5 rar files each inside them.
2. you want to go inside folder 1,
3. extract the contents of 5 rar files,
4. move the extracted files to parent folder,
5. delete the 5 rar files and
6. continue doing the same with folders 2, 3 and so on.

Is that illustration right?
Between steps 3 & 4 those extracted files would need to be renamed into the name of that folder. Also, in step 5 the whole folder needs deleting, not just the RAR files, but apart from that your illustration is correct.
I tried a circuitous script but it should do what you need.

Code: Select all

focus;
 //add dummy extension to selected folders
 rename b, *.<mmmdd>; 
 // call script _xyz
 sub _xyz;

"_xyz"
// A message to make sure you can exit the loop anytime
 msg "Extract files?", 1;
//filter by extension
 #356; 
//select first item
 sel 1;
// set folder name (extension is skipped)
 set %cb%, <curbase>;
// enter the selected folder
 #160;
//removes the previous filter
 filter;
 Set(%cp%,<curpath>);
 Set(%nn%,<date yyyymmddhhnnss>); 
 OpenWith("""C:\program files\winrar\winrar.exe"" e -- *.rar *    %nn%-temp", "s"); 
 Msg("Press OK when WinRAR is finished.",1); 
 GoTo("<curpath_s>\%nn%-temp"); 
 Sel(a); 
 Rename(bat,%cb%); 
 Focus(L); 
 MoveTo("..\.."); 
 #523; 
 #523; 
 Focus(L); 
 //Delete 
 #169;
//enable previous filter 
 #355;
// call script _xyz
 sub _xyz
 

Post Reply