Page 2 of 6

Posted: 24 Jun 2008 20:05
by ivan
Here's the screenshot of the script window, maybe I messed up copy/paste:

Image

Posted: 24 Jun 2008 21:17
by TheQwerty
Another take on the solution:

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;
Could probably do without the last rename and selfilter, but I wanted to make sure the correct folder is deleted.

Posted: 25 Jun 2008 16:12
by ivan
TheQwerty, this works great!

I don't even mind the prompt asking me to click when WinRAR finishes. However, there is one hiccup. I extract from a folder that's on Desktop, but upon extraction and confirmation it expands my folder tree and goes to C:\Documents and Settings\username\Desktop. Although this is correct but I am wondering if there is any way to keep the focus on the Desktop the way I have? Cheers :)

Posted: 25 Jun 2008 16:30
by TheQwerty
ivan wrote:TheQwerty, this works great!

I don't even mind the prompt asking me to click when WinRAR finishes. However, there is one hiccup. I extract from a folder that's on Desktop, but upon extraction and confirmation it expands my folder tree and goes to C:\Documents and Settings\username\Desktop. Although this is correct but I am wondering if there is any way to keep the focus on the Desktop the way I have? Cheers :)
I'm not sure I understand exactly what you're asking but try changing

Code: Select all

GoTo("<curpath>\%nn%-temp")
to

Code: Select all

GoTo("<curpath_s>\%nn%-temp")

Posted: 25 Jun 2008 17:11
by ivan
This is what I mean:

The folder from which the initial extraction started was located on the Desktop in FZ folder like this

Image

but after finishing the whole deal the focus shifted to Desktop through this tree:

Image

So, while they are technically the same, they are also different if you know what I mean.

Posted: 25 Jun 2008 17:40
by TheQwerty
ivan wrote:So, while they are technically the same, they are also different if you know what I mean.
The change I mentioned in the last post seems to fix that for me, does it not work for you?

Posted: 25 Jun 2008 17:59
by ivan
TheQwerty wrote:
ivan wrote:So, while they are technically the same, they are also different if you know what I mean.
The change I mentioned in the last post seems to fix that for me, does it not work for you?
Yep, that did the trick. Of course the next step would be to ask if it's possible not to have the prompt about WinRAR finishing but if there's no way around then i'll settle for what I have, thank you very much.

Posted: 25 Jun 2008 18:28
by TheQwerty
ivan wrote:Yep, that did the trick. Of course the next step would be to ask if it's possible not to have the prompt about WinRAR finishing but if there's no way around then i'll settle for what I have, thank you very much.
You could split the script into two parts and execute one to start extraction and the other to do the moving and cleaning.

You could write a different script which creates and executes a batch file to do everything from the extraction out.

You could write an external program to do everything from the extraction out.

But to do it all within XY sans prompt you'll have to come up with a way for Don to handle pausing the script until the extraction is completed and wait till it's implemented.

Posted: 25 Jun 2008 18:47
by ivan
TheQwerty wrote:But to do it all within XY sans prompt you'll have to come up with a way for Don to handle pausing the script until the extraction is completed and wait till it's implemented.
Now there is an idea for him to think about 8) Scrow-Mo :lol: (combo of script and slow-mo)

But I think Undo function should have more priority :D

Posted: 26 Jun 2008 17:46
by ivan
Here's an interesting question: what factors influence how fast a script can run?

The thing is that I just timed this script and from the moment I click OK (to confirm that WinRAR has finished) to the point when I'm asked if I want to put the folder in recycle bin all of 8 and a bit seconds go by. Now I'm wondering if there's intentional delay there and if so then can it be adjusted? If it's not a delay then why does it take 8 seconds to rename a file, move it up a tree and prompt for deletion? :?

Posted: 26 Jun 2008 18:22
by admin
ivan wrote:Here's an interesting question: what factors influence how fast a script can run?

The thing is that I just timed this script and from the moment I click OK (to confirm that WinRAR has finished) to the point when I'm asked if I want to put the folder in recycle bin all of 8 and a bit seconds go by. Now I'm wondering if there's intentional delay there and if so then can it be adjusted? If it's not a delay then why does it take 8 seconds to rename a file, move it up a tree and prompt for deletion? :?
Walk it step by step (= use stepping mode) and see which particular command takes that long. There is no delay as far as I know, and I should know... :wink:

Posted: 26 Jun 2008 18:33
by ivan
As I said, the part between me clicking OK after WinRAR finishes extraction and when I get a prompt to move the folder to Recycle Bin is one that takes by far the longest time (obviously excluding the extraction time because XYplorer can't influence that), so this section:

Code: Select all

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;
takes over 8 seconds to execute. I am simply wondering why that is and if there's anything I can do to reduce this period of time.

Posted: 27 Jun 2008 11:07
by admin
ivan wrote:As I said, the part between me clicking OK after WinRAR finishes extraction and when I get a prompt to move the folder to Recycle Bin is one that takes by far the longest time (obviously excluding the extraction time because XYplorer can't influence that), so this section:

Code: Select all

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;
takes over 8 seconds to execute. I am simply wondering why that is and if there's anything I can do to reduce this period of time.
Step through the section using step:

Code: Select all

Step;
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;
BTW, instead of #523;#523; (Up Up) use can use #521; (Go to Last Target).

Posted: 27 Jun 2008 11:50
by ivan
I "stepped" through the script and this is the part that takes several seconds (the majority of those 8 overall, I'd say)

Code: Select all

Rename(bat,%nn%,,"%cp%");
If the command in that script is a time-consuming one then it's ok, but it can be influenced by any factors that I can do something about then it's worth a try.

Posted: 27 Jun 2008 11:53
by admin
ivan wrote:I "stepped" through the script and this is the part that takes several seconds (the majority of those 8 overall, I'd say)

Code: Select all

Rename(bat,%nn%,,"%cp%");
If the command in that script is a time-consuming one then it's ok, but it can be influenced by any factors that I can do something about then it's worth a try.
I did not follow this thread (been coding... :wink: ), so what is %nn% and%cp%?