[WFX] VirtualPanel: Temporary panel for TC

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Hello MVV, I'm using VP and TCFS2 and autorun.wdx all together and they make a very powerful and exciting combination indeed! Thank you!

I created a user command to initialize the VP, meaning that it's executed at TC start (with autorun.wdx) to activate the VP as a new tab[1]. My em command works, see the code block below, but I need to improve it.

Code: Select all

[em_cd-virtual-panel]
button=
cmd=cd \\\Virtual Panel
[em_init-virtual-panel]
button=
cmd=%COMMANDER_PATH%\util\TCFS2\TCFS2.exe
;cm_OpenNewTab=3001;Open new tab
;cm_SwitchToNextTab=3005;Switch to next Tab (as Ctrl+Tab)
;cm_SwitchToPreviousTab=3006;Switch to previous Tab (Ctrl+Shift+Tab)
;cm_ToggleLockCurrentTab=3010;Turn on/off tab locking
;cm_SrcActivateTab1=5001;Activate first tab
param="/ef "tcm(3001) tem(em_cd-virtual-panel) delay(3000) tcm(3010) tcm(5001)""
With regards to the param= line at the end of the code block, Is it possible to replace delay(3000) with something that more reliably waits until the VP tab has been fully loaded? Ideally I would like for em_init-virtual-panel to do:
1) open new tab (3001)
2) cd virtual panel (em_cd-virtual-panel)
3) *** wait until VP has fully loaded (???) ***
4) lock VP tab (3010)
5) *** switch back to previous tab (3006) ***

You can see that I was forced to replace steps 3 and 5 with something else to make it work. But delay(3000) in step 3 is a work-around, so I'm asking if there's a better solution. Thanks.

Notes:
[1] Reason for wanting to initialize the VP: I noticed that unless the VP has been opened at least once, VPBatch.exe silently fails creating new V folders. I have a .cmd script that runs VPBatch.exe ^^silent ^^put /l "folder(10)\" "listfile.lst" but "folder(10)\" isn't created unless the VP has been "visited in a tab" before.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Great that you like my plugin and tool:)

I think you can setup autoexecutable script on filelist load in VP which will do commands 3-5. So, when VP will finish loading filelist, it will execute >Autoexec script in root folder (if corresp. setting is enabled) and it will switch to first tab. The only thing you need is to add TCFS2.exe to some VP folder to be able to run it from script (or you simply can add Exec.exe from VP installation folder and use it to start any physical executables v/o adding their files to VP).

So, Autorun.cfg line:

Code: Select all

ShellExec "%COMMANDER_PATH%\util\TCFS2\TCFS2.exe" '/u- /ef tcm(3001) tem(em_cd-virtual-panel)'
Command line command to create >Autoexec script command in VP (I assume that TCFS2.exe was added to VP as \Stuff\TCFS2.exe but you can use any virtual path for it):

Code: Select all

<add \>Autoexec {<exec "\Stuff\TCFS2.exe" /u- /ef tcm(3010) tcm(3006)}
Same but using Exec.exe (again, I assume that it have been added to VP as \Stuff\Exec.exe):

Code: Select all

<add \>Autoexec {<exec "\Stuff\Exec.exe" "%COMMANDER_PATH%\util\TCFS2\TCFS2.exe" /u- /ef tcm(3010) tcm(3006)}
You may then set read-only attribute for script file to protect it from deletion (read-only items can't be deleted until attribute is removed or <del /f command is used). And, I repeat, you need to enable option to execute >Autoexec scripts in configuration dialog (and option below to disable confirmations).

In my tests all work fine w/o any delays.
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Thanks MVV, I need to study and test your example. I have a simpler issue now, I can't seem to be able to create a physical link to a file using VPBatch.exe. I tried from cmd prompt all of (the real file path to img.gif exists):

Code: Select all

".....\wdx\Virtual Panel\VPBatch.exe" ^^add /f . "...\img.gif"
".....\wdx\Virtual Panel\VPBatch.exe" ^^add /r /f vlink.gif "...\img.gif"
".....\wdx\Virtual Panel\VPBatch.exe" ^^add /r /f vfolder
The third example is the only one that works, but it obviously doesn't do what I need, it just creates an empty vfolder object. What I need is a link named vlink.gif to the real img.gif in the current vfolder. My version of VPBatch is 1.0.0.42. Thanks.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You should specify name of new link and physical path.

This one works from command line for me:

Code: Select all

VPBatch.exe ^^add test.jpg D:\test.jpg
This one works too:

Code: Select all

VPBatch.exe ^^add \0\test.jpg D:\test.jpg
And this one:

Code: Select all

VPBatch.exe ^^add /rf \0\test.jpg D:\test.jpg
Note that all flags must be specified together in a single parameter. Just like in example above. You can execute VP command <? if you forgot syntax of some command:

Code: Select all

add [/[r][f]] <virtual_path> [{<physical_path_or_script>}]
	(r - make intermediate folders, f - replace existing)
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

MVV wrote:You should specify name of new link and physical path...
Thanks, I figured it out. As embarrassing as it may be, I had a file filter active, that's why I couldn't see the new file link; indeed it was there but filtered out of view.

Another subtle learning, VPBatch needs an ábsolute real path. It will take a relative path too, but then the VP will most likely not find the file (try F3 for example) unless the current TC directory matches the directory from which VPBatch was started.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Yes, you need to specify an absolute path because VPBatch doesn't modify command line that it sends to VP so VP adds file with relative path which is not correct. You can't know which directory is current one in TC, it may be differ than active panel's directory.
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

I thought about your last examples that use <exec \Stuff\TCFS2.exe and the equivalent <exec \Stuff\Exec.exe "%COMMANDER_PATH%\util\TCFS2\TCFS2.exe".

It seems to me both scripts will break if I use TC in a portable fashion (run it from a USB stick with differing drive letters). And I do use TC that way.

\Stuff\TCFS2.exe and \Stuff\Exec.exe are links to physical objects, so they point to absolute paths (see previous post) and can't contain environment variables like %COMMANDER_PATH%. These links need to be created before loading the VP because they're used in >Autoexec. So they need to be saved in the default state file (DefFileList).

But when I save them in DefFileList I'm saving their absolute path, which may not exist if the next time I run TC from a different USB drive letter.

It seems a catch-22 to me. Can you suggest a way around it so that portability is maintained? Thanks.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

BTW you can use only theese commands:

Code: Select all

ShellExec "%COMMANDER_PATH%\util\TCFS2\TCFS2.exe" '/ef tem(em_cdVP) delay(1000) tcm(570)'
But it won't work w/o delay. It seems that you should select between portability and comfort (maybe delay isn't a big problem).

Or maybe you can use some simple script that will fix stick drive letter in filelist before the launch?
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

MVV wrote:BTW you can use only theese commands:

Code: Select all

ShellExec "%COMMANDER_PATH%\util\TCFS2\TCFS2.exe" '/ef tem(em_cdVP) delay(1000) tcm(570)'
But it won't work w/o delay.
Back to square 1 where I started :)
It seems that you should select between portability and comfort (maybe delay isn't a big problem).
Portability is more important to me.
Or maybe you can use some simple script that will fix stick drive letter in filelist before the launch?
I can do that, I already fix a lot of things and files around Windows to make my computing environment more USB-portable. :P

For the future please consider adding support for a new link data type that expands embedded envvars instead of treating them as literal text. That would solve all my issues. Thanks again for your help.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I have a great idea for you:) you can simply readd Exec.exe in >Autoexec before calling it. So, sample >Autoexec (of course, it shouldn't contain line breaks):

Code: Select all

<silent
<add /rf "\Stuff\TCFS2.exe" "%COMMANDER_PATH%\util\TCFS2\TCFS2.exe"
<exec "\Stuff\TCFS2.exe" /u- /ef tcm(3010) tcm(3006)
Envvars are expanded in quoted parameters automatically so it will work regardless of drive letter and TC path.

You can even add entire USB stick root to VP in order to launch any application from it via VP (again, this line should be included into >Autoexec script):

Code: Select all

<add /f "\COMMANDER_DRIVE" "%COMMANDER_DRIVE%"
:D
For the future please consider adding support for a new link data type that expands embedded envvars instead of treating them as literal text. That would solve all my issues.
It is too hard. Files don't have any special flags for such cases.
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

MVV wrote:I have a great idea for you:)
Genius!!
consider adding support for a new link data type that expands embedded envvars
It is too hard. Files don't have any special flags for such cases.
OK. Not a big issue anymore since your method above covers most cases because it can portably resolve all paths which can be expressed relative to %COMMANDER_PATH%. That's cool. Maybe it's worth adding this point to the plugin readme file.
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Hi MVV, with VPBatch I add a new virtual folder with paths to 390 jpg files from a listfile. I set thumbnail view mode and click the new virtual folder to display the 390 thumbnails.
Issue #1: it takes a looong time for VP to display the thumbnails. For comparison, the same set of 390 jpg files is displayed in just a few seconds when shown outside from a real folder (with empty thumbnail cache).
Now I switch tab from the virtual folder with thumbnails to another tab and back to the virtual folder.
Issue #2: VP starts all over again creating the thumbnails. It seems it's just ignoring any cached thumbnails.
Overall really too slow. Can you think of some work-around for these two issues? Thanks!
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Sorry, VP doesn't work with thumbs, it simply passes real paths to TC and tells to extract thumbs (returns FS_BITMAP_EXTRACT_YOURSELF value) so I can't help here. Probably TC doesn't use cache for WFX plugins.

Oh, I noticed the additional FS_BITMAP_CACHE value that may be added to result to cache images. I'll try to use it. It is interesting if TC will use same cache that physical images use since plugin is a temporary panel plugin and files are available locally.

Please test updated version here.

Just tested it, seems to be working. :)
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

MVV wrote:Oh, I noticed the additional FS_BITMAP_CACHE value that may be added to result to cache images. I'll try to use it. It is interesting if TC will use same cache that physical images use since plugin is a temporary panel plugin and files are available locally.

Please test updated version here.

Just tested it, seems to be working. :)
Thanks! At first I was very excited, I briefly tested it on an XP PC and it seemed to help, but I didn't have time for further testing. Now I'm testing it on a Win7 PC and it doesn't help at all, thumbnails are still very slow to build and they don't seem to be cached.
Are you testing on Win7 or XP?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I tried to test it on XP but strangely TC didn't cache thumbs at all, even in physical folders (thumbs file didn't changed, don't know why, caching is seems to be enabled).

But then I tested it on Win7 (Win7x64, TC8.01x32), all work fine, TC uses same cache ids for both physical and virtual items so after caching any of folders (physical or virtual one) both are loaded immediately (tested on folder with 300+ JPGs).
Post Reply