Universal Viewer QuickView script
Moderators: Hacker, petermad, Stefan2, white
Universal Viewer QuickView script
Splitted from here.
Last edited by Alextp on 2007-12-26, 13:57 UTC, edited 3 times in total.
2majkinetor
And you suggest user to move to file, switch to Viewer, toggle mode, switch to TC, and move to another file. What for is it?
I suggest to use EM_DISPLAYBAND message:
WParam: command, LParam: data (int or PChar or PRect).
No, I don't understand. "Wish to move wihout to display" is not a Quick View mode.Quote:
We don't need "F3-F2" mode,
We do. I might open the ATViewer with one file, and move cursor to the other files without the wish to display them. So we need to set the mode explicitely.
And you suggest user to move to file, switch to Viewer, toggle mode, switch to TC, and move to another file. What for is it?
Ok, let it be in AHK.Quote:
Majkinetor, can you write such hook? So that I'll just receive messages from it.
Yes I can. It must be in a separate dll though, as designed by Windows architecture (you can't hook other apps then yourself from the exe, just from dll).
What do you say to first try to do this in AHK, since it will allow us to act more quickly to see how things function
Ok.You need to implement following things for now:
1. Toggle menu
2. Toggle caption
3. Set size/position. X,Y,W,H (should take 1&2 into account)
4. Receive file
I suggest to use EM_DISPLAYBAND message:
WParam: command, LParam: data (int or PChar or PRect).
- majkinetor !
- Power Member
- Posts: 1580
- Joined: 2006-01-18, 07:56 UTC
- Contact:
We must track CTRL Q then also. It will be done this way.And you suggest user to move to file, switch to Viewer, toggle mode, switch to TC, and move to another file. What for is it?
This approach will not do, since you can't send pointer to the string from different applications (AHK & ATViewer, or the same with dll). So this will probably be the WM_COPYDATA, or you can set some invisible control, I change the text of it and after that send you notification via custom message.I suggest to use EM_DISPLAYBAND message:
WParam: command, LParam: data (int or PChar or PRect).
Not quite. Command line parameters for this app is must. But we will not do it this way when communicating since this will be slow (Windows will start your application again on each call, you will have to supply mutex for single instance, redirect the call to your open app yourself, etc.. too much work, too poor results + flickering)Instead of messages for hiding menu/caption I suggest commandline parameter:
Win Messages are the only solution.
For instance, there is AHK script to connect TC with Locate. This one uses your suggestion to redirect locate selection to TC. When I changed original script to communicate with TC via messages, the swith was instant, and before that you could see noticable delay.
I will formalise everything and post here as soon as I can. Probably tomorrow on the job

Habemus majkam!
I don't understand..We must track CTRL Q then also. It will be done this way.
Ok.So this will probably be the WM_COPYDATA, or you can set some invisible control, I change the text of it and after that send you notification via custom message.
No. I mean:Not quite. Command line parameters for this app is must. But we will not do it this way when communicating since this will be slow
0. user runs addon.
you (addon) close all Viewer windows.
1. user presses Ctrl-Q.
you activate quick view:
- start new Viewer with mentioned parameters.
You then don't need to change them. Set them once at start.
- send message to Viewer
2. user moves cursor.
you send messages.
3. user presses Ctrl-Q again.
you deactivate quick view: close Viewer that was opened.
That's all, no sevaral starts of app.
- majkinetor !
- Power Member
- Posts: 1580
- Joined: 2006-01-18, 07:56 UTC
- Contact:
- majkinetor !
- Power Member
- Posts: 1580
- Joined: 2006-01-18, 07:56 UTC
- Contact:
Ok, Alex
I created the script and I post it here so you can see it works. You copy this in ahk file and execute it:
When you press CTRL Q once, it will show you the tooltip with the currently selected name, when you press it again, it will show you that Quick View is closing.
When you move with the up/down arrow, tooltip will change file name.
I implemented 2 methods to obtain current selection.
One is using clipboard, second command line. The problem with first one is that clipboard must be saved, but some apps like CLCL will still catch bunch of files. This works like a charm and very fast.
Second one is issuing CTRL ALT ENTER to set command lines text to path, then grab this text, and send ESC to remove path. This works nice also, but you have flicker in the command line (I can solve this), and it is bad if you hidden command line, then on every move it will be toggled and hidden again, which is not nice. I set the script to work with this method, since I don't like bunch of file names in my CLCL history.
I can also use third technique, to simulate inline Edit grab the name, merge it with path (i can get this) but that is basicly the same as using command line.
There is no other way to get current selection from TC that I know. I am surre that other solutions don't exist. Although you may see that current selection is shown in status bar, this is not the text that I can get, but Ghisler is drawing this ?! If Ghisler could add some hidden field to contain current selection, or send a file name to the world via WM_COPYDATA and new internal command that will request this, we could do this the right way.
Anyway, I think this is good for the start, benefits are big, loses are small.
You can test this, to see yourself.
You need to do following:
1. Implement WM_COPYDATA
2. Implement parameters you suggested (you were right about this)
Parameters should be this:
start in quick view mode
Although you can implement other parameters like hide menu, hide title, I can do all that from AHK for now, so you can skip this and go to the point, witch is WM_COPYDATA.
I created the script and I post it here so you can see it works. You copy this in ahk file and execute it:
Code: Select all
#ifWinActive ahk_class TTOTAL_CMD
^q::
bOpen := !bOpen
if (bOpen)
Tooltip % "OPEN QV: " . GetName(2)
else
Tooltip % "CLOSE QV"
return
~Down::
~Up::
if (bOpen)
Tooltip % GetName(2)
return
GetName(method)
{
;using clipboard
if (method = 1)
{
SendTCCommand("cm_CopyFullNamesToClip")
return clipboard
}
;using command line
if (method = 2)
{
Send ^+{ENTER}
ControlGetText name, Edit1
Send {ESC}
return name
}
msgbox what are you doing ?
}
#ifWinActive
^r::
reload
return
;---------------------------------------------------------------------------
SendTCCommand( xsTCCommand, xbWait=1 )
{
loop Read, %COMMANDER_PATH%\TOTALCMD.INC
{
StringSplit asCommands, A_LoopReadLine, =
if (asCommands1 = xsTCCommand)
{
StringSplit asCommandsValues, asCommands2, `;
Break
}
}
if !(asCommandsValues1 > 0)
return
if (xbWait)
SendMessage 1075, %asCommandsValues1%, 0, , ahk_class TTOTAL_CMD
else
PostMessage 1075, %asCommandsValues1%, 0, , ahk_class TTOTAL_CMD
}
When you move with the up/down arrow, tooltip will change file name.
I implemented 2 methods to obtain current selection.
One is using clipboard, second command line. The problem with first one is that clipboard must be saved, but some apps like CLCL will still catch bunch of files. This works like a charm and very fast.
Second one is issuing CTRL ALT ENTER to set command lines text to path, then grab this text, and send ESC to remove path. This works nice also, but you have flicker in the command line (I can solve this), and it is bad if you hidden command line, then on every move it will be toggled and hidden again, which is not nice. I set the script to work with this method, since I don't like bunch of file names in my CLCL history.
I can also use third technique, to simulate inline Edit grab the name, merge it with path (i can get this) but that is basicly the same as using command line.
There is no other way to get current selection from TC that I know. I am surre that other solutions don't exist. Although you may see that current selection is shown in status bar, this is not the text that I can get, but Ghisler is drawing this ?! If Ghisler could add some hidden field to contain current selection, or send a file name to the world via WM_COPYDATA and new internal command that will request this, we could do this the right way.
Anyway, I think this is good for the start, benefits are big, loses are small.
You can test this, to see yourself.
You need to do following:
1. Implement WM_COPYDATA
2. Implement parameters you suggested (you were right about this)
Parameters should be this:
start in quick view mode
Although you can implement other parameters like hide menu, hide title, I can do all that from AHK for now, so you can skip this and go to the point, witch is WM_COPYDATA.
Habemus majkam!
- majkinetor !
- Power Member
- Posts: 1580
- Joined: 2006-01-18, 07:56 UTC
- Contact:
- majkinetor !
- Power Member
- Posts: 1580
- Joined: 2006-01-18, 07:56 UTC
- Contact: