PowerPro updated to receive info from TC like AHK
Moderators: Hacker, petermad, Stefan2, white
PowerPro updated to receive info from TC like AHK
After a lenghty hiatus, Bruce Switzer has been implementing new features again. Among other things, PowerPro can now exchange info with TC through system messages like some of us have been doing with Autohotkey scripts. More info on the user group: http://tech.groups.yahoo.com/group/power-pro/messages.
- Vochomurka
- Power Member
- Posts: 816
- Joined: 2005-09-14, 22:19 UTC
- Location: Russia
- Contact:
Can you give some examples how to use these messages to interact between TC and PP?
Single user license #329241
PowerPro scripts for Total Commander
PowerPro scripts for Total Commander
I quote from the help file:
wm_copydata messages
If it exists, the command list "HookCopyData" is run whenever a WM_COPYDATA message is received by the PowerPro main window with the lowest byte of dwData set to any value greater than 31; the arguments to the command list are set as follows: arg(1) is set to the dwData, arg(2) to the wParam, and arg(3) to the lpData string, which cannot contain the bytes \x00 or \x01.
The command list then usually calls file scripts, e.g. mycopydatascript(arg(1)). See help index hook events.
wm_app messages
If it exists, the command list called "HookAppMessages" is run whenever a message with number WM_APP through 0xBFFF is received by the PowerPro main window. When running this list, arg(1) is set to message number, arg(2) is set to wParam, arg(3) is set to lParam. Any value returned by quit is returned as an unsigned integer to the caller. To find the target window for the messages, note that the main window of the main PowerPro process has window class PowerProMain. Main windows of other PowerPro processes have window class PowerProMain2 and include the process name in the caption.
wm_copydata messages
If it exists, the command list "HookCopyData" is run whenever a WM_COPYDATA message is received by the PowerPro main window with the lowest byte of dwData set to any value greater than 31; the arguments to the command list are set as follows: arg(1) is set to the dwData, arg(2) to the wParam, and arg(3) to the lpData string, which cannot contain the bytes \x00 or \x01.
The command list then usually calls file scripts, e.g. mycopydatascript(arg(1)). See help index hook events.
wm_app messages
If it exists, the command list called "HookAppMessages" is run whenever a message with number WM_APP through 0xBFFF is received by the PowerPro main window. When running this list, arg(1) is set to message number, arg(2) is set to wParam, arg(3) is set to lParam. Any value returned by quit is returned as an unsigned integer to the caller. To find the target window for the messages, note that the main window of the main PowerPro process has window class PowerProMain. Main windows of other PowerPro processes have window class PowerProMain2 and include the process name in the caption.
A discussion about 'new copydata messages" se post http://ghisler.ch/board/viewtopic.php?p=236434.Vochomurka wrote:Can you give some examples how to use these messages to interact between TC and PP?
Basicaly you send a copydata to TC with dword 'AG' or 'WG' and command like A (get acticve side) SP (source path) ... all message are detailed in the history for TC 8.0 b10 or in the previous post.
What have been lately added to power pro that make it easier to accomplish :
A) ability to create secondary processes.
B) new hoockcopydata list for receiving specific WM_COPYDATA message
C) add a parameter to win.sendcopydata to fill wparam as hwnd or waiting response from TC.
What could be accomplished :
Create a new powerpro process "TC_monitor" with a pcf specifically dedicated to TC on which you will have the hookcopydata list an script.
Have script to send request info to TC and called back by TC and the hoocklist.
(Hot key will remain in main powerpro instance)
Code: Select all
;;Script sample TC Copydata
local TCcmd = Arg(1)
static _tcp_lock=0
static _tcRep=""
static _tcHan=0
static _tcDw=0
local TC_GA = 0x4147 ;; Get Info from TC in ASCII ;
local TC_han = win.handle("c=TTOTAL_CMD")
local ppro = win.handle("n=\(pproprocessname)")
_tcp_lock = 100
win.sendcopydata(TC_HAN,TC_GA,TCcmd,ppro)
for ( _tcp_lock > 0 )
wait.for(50)
_tcp_lock = _tcp_lock -1
endfor
;;win.debug(" rep "++_tcRep++ " "++_tcDw++"#"++_tcHan++"<<"+TC_han)
quit(_tcRep)
;;;; Fuction is called by hookcopydata list with
;; .getTC@onCopyData( Arg(1) , Arg(2) , Arg(3) )
;;; Arg(1) Normaly 'RA' 16722 (Receive ascii Mode)
;;; Arg(2) WParam normally Handle of TC
;;; Arg(3) Reponse String
Function onCopyData( repDWord,repWparam, repStr )
_tcHan = repWParam
_tcDW = repDWord
_tcRep = repStr
_tcp_lock = 0
EndFunction
Other command with sendcopydata can be done this way except if you want to set specific folder to TC, you will have to use Binary plugin or dll plugin in order to pass a null character inside a string ????
Code: Select all
local TC_CD = 0x4443
local TC_EM = 0x4D45
local TC_VP = 0x5056
local tcString = binary.join(fold,"\r",binary.from_hex("00"),"S")
tcString.sendcopydata(han,TC_CD)
Last edited by nsp on 2012-08-06, 15:47 UTC, edited 3 times in total.
- Vochomurka
- Power Member
- Posts: 816
- Joined: 2005-09-14, 22:19 UTC
- Location: Russia
- Contact:
29kvD38n6
I have already read the documentation, thank you
I meant an example of the PowerPro script rather than C++ code.
I have already read the documentation, thank you

Single user license #329241
PowerPro scripts for Total Commander
PowerPro scripts for Total Commander
I've tested/edited the script provided in previous post. This one works for me. BUT TC do not like wrong command and do not respond with "Error".Vochomurka wrote:meant an example of the PowerPro script rather than C++ code.
inorder to create a new process, you can use the new process plugin. Where in tc.pcf you have setup the hookcopydata list.
process.create("TC_Tests","tc.pcf",?'.getTC("A")')
- Vochomurka
- Power Member
- Posts: 816
- Joined: 2005-09-14, 22:19 UTC
- Location: Russia
- Contact:
Thanks, but nothing happens when running both scripts. What can be the parameter of the first one? What must be result of the script execution? Is the command list crwation necessary for their operation?
Single user license #329241
PowerPro scripts for Total Commander
PowerPro scripts for Total Commander
Sorry for being late.Vochomurka wrote:Thanks, but nothing happens when running both scripts. What can be the parameter of the first one? What must be result of the script execution? Is the command list crwation necessary for their operation?
------------------------
Steps:
1) launch ppoconf with an non existent tc.pcf file.
2) create a hookcopydata list using this as ini file and close pproconf.
Code: Select all
[hookcopydata:Properties]
[1]
LCmd1 = .getFromTC@onCopyData( Arg(1) , Arg(2) , Arg(3) )
MCmd1 = (none)
RCmd1 = (none)
4) create a new powerpro process using the following powerpro code:
Code: Select all
process.create("TC_Tests","tc.pcf")
5) call TC from new powerpro process
Code: Select all
process.run("TC_Tests",?'win.debug(.getFromTC("A"))' )
News.... for latest versions >5.1.7
A new sendcopydata method wit a patter to send \0 allows also from powerpro to change folder using messages. IF TChan is TC windows handle and fold the folder where you want to go.
Code: Select all
local TC_CD = 0x4443
local tcStrPath = fold ++ "\r\x02S"
TChan.sendcopydata(TC_CD, tcStrPath, 0, "\x02")
Using more advanced initialization script you can even imagine to path using autoexec.wdx to powerpro %COMMANDER_PATH%, %COMMANDER_EXE%, %COMMANDER_INI%, .... for more ppro discussion you can also go to ppro yahoo group. http://tech.groups.yahoo.com/group/power-pro/messages.
- Vochomurka
- Power Member
- Posts: 816
- Joined: 2005-09-14, 22:19 UTC
- Location: Russia
- Contact:
2nsp
Nothing succeeded. After I've switched to another process with the "newprocess" command, the "pproProcessName" always tells the process name is "main"...
By the way, there is the PowerPro plugin tc intended especially to work with TC. Its functions are:
tc.handle - returns TC's handle (the same as win.handle("c=TTOTAL_CMD"));
tc.active(hwnd) - returns "left" for left panel and "right" for right;
and tc.cd:
tc.cd(hwnd,"left",leftpath)
tc.cd(hwnd,"right",rightpath)
tc.cd(hwnd,activepath)
tc.cd(hwnd,activepath,inactivepath)
What are the possibilities of another process that exceed those of the tc plugin?
Nothing succeeded. After I've switched to another process with the "newprocess" command, the "pproProcessName" always tells the process name is "main"...
By the way, there is the PowerPro plugin tc intended especially to work with TC. Its functions are:
tc.handle - returns TC's handle (the same as win.handle("c=TTOTAL_CMD"));
tc.active(hwnd) - returns "left" for left panel and "right" for right;
and tc.cd:
tc.cd(hwnd,"left",leftpath)
tc.cd(hwnd,"right",rightpath)
tc.cd(hwnd,activepath)
tc.cd(hwnd,activepath,inactivepath)
What are the possibilities of another process that exceed those of the tc plugin?
Single user license #329241
PowerPro scripts for Total Commander
PowerPro scripts for Total Commander
newprocess create a process and do not switch to another ppro process.Vochomurka wrote:2nsp
Nothing succeeded. After I've switched to another process with the "newprocess" command, the "pproProcessName" always tells the process name is "main"...
You can also test in the main powerpro process if you create the hoockcopydata list as described. After you can just call the script directly.
The advantage of using a dedicated process is to have all the messages from TC rooted to a specific list without any filtering.
We can get 'A'ctive sideVochomurka wrote:By the way, there is the PowerPro plugin tc intended especially to work with TC. Its functions are:
tc.handle - returns TC's handle (the same as win.handle("c=TTOTAL_CMD"));
tc.active(hwnd) - returns "left" for left panel and "right" for right;
and tc.cd:
tc.cd(hwnd,"left",leftpath)
tc.cd(hwnd,"right",rightpath)
tc.cd(hwnd,activepath)
tc.cd(hwnd,activepath,inactivepath)
What are the possibilities of another process that exceed those of the tc plugin?
for each For Left, Right, Source, Target we can get Path , Count, current Index, current file Name. Compound LP,LC,LI,LN, R......
It works for both 32 and 64bit TC..... and if one day some new command or message are available il will be possible to adapt easily.