AutoHotkey Community

It is currently May 27th, 2012, 1:00 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: November 13th, 2006, 1:51 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
You can alternatively do the following. This is adaptation of Quick View script for TC to work with Locate. For more details see its code witch is much more robust. Here I just provide possible workaround with some parts from QV script.

The script will rearange the Locate window and place it on top TC thus simulating the TC panel.

Code:
SetKeyDelay, -1
SetBatchLines -1

#IfWinActive, Locate ahk_class #32770

^f::
   hwnd := WinExist("Locate:")
   QV_TCGetControls()
   SetLocateWindow()
   QV_rect := QV_GetViewDestination()
   QV_AdjustViewerPosition( QV_rect )

   sFileName := ""
   sPath := ""
   ControlGet, sActiveRow, List, Selected, SysListView321
   StringSplit, aRowElements, sActiveRow, %A_Tab%
   sFileName := aRowElements1
   sPath := aRowElements2

   If (sFileName)
   {
     SetTCPath( sPath )
     WinWaitActive, ahk_class TTOTAL_CMD

     Loop
     {
        ControlGetText, ActivePath, TMyPanel2
        StringTrimRight, ActivePath, ActivePath, 1
        If (ActivePath = sPath)
         Break
     }

     PostMessage, 1075, 2915
     WinWaitActive, ahk_class TQUICKSEARCH
     ControlSetText, TTabEdit1, %sFileName%
     ControlSend, TTabEdit1, {Down}{Esc}
   }
return

;------------------------------------------------------------------------

SetLocateWindow()
{
   global hwnd

   DllCall("SetMenu", "uint", hwnd, "uint", 0)
   Control, Hide,, #327703      , ahk_id %hwnd%
   Control, Hide,, Presets      , ahk_id %hwnd%
   Control, Hide,, Tab         , ahk_id %hwnd%
   Control, Hide,, Ne&w Search   , ahk_id %hwnd%
   Control, Hide,, Sto&p      , ahk_id %hwnd%
   Control, Hide,, F&ind Now   , ahk_id %hwnd%
   ControlMove, SysListView321, 0, 0,,, ahk_id %hwnd%

   WinGetPos, x, y, w, h, ahk_id %hwnd%
   WinMove, ahk_id %hwnd%, , x, y, w+1, h+1
   WinSet, AlwaysOnTop, On, ahk_id %hwnd%
}

;------------------------------------------------------------------------

QV_TCGetControls()
{
   global QV_TCActivePanel, QV_TCCurentDir, QV_TCHeader, QV_host

   ControlGetText pLeft,    TMyPanel5, ahk_class TTOTAL_CMD
   ControlGetText pCurrent, TMyPanel2, ahk_class TTOTAL_CMD

   StringReplace pCurrent, pCurrent, >
         

   StringGetPos idx, pLeft, \, R
   StringMid  pLeft, pLeft, 1, idx

   if StrLen(pLeft) = 2
      pLeft = %pLeft%\

   if (pLeft = pCurrent)
      QV_TCActivePanel := "TMyListBox1"
   else
      QV_TCActivePanel := "TMyListBox2"


   QV_TCCurentDir   := "TMyPanel5"
   QV_TCHeader      := "THeaderClick1"
   if QV_TCActivePanel = TMyListBox1
   {
      QV_TCCurentDir   := "TMyPanel9"
      QV_TCHeader      := "THeaderClick2"
   }
}

;---------------------------------------------------------------------------

QV_GetViewDestination()
{
   global QV_mode, QV_Options_Width, QV_TCActivePanel, QV_TCCurentDir, QV_TCHeader, QV_host

   rect =

   ControlGetPos,  ,   ,   , hh, %QV_TCHeader%,      ahk_class TTOTAL_CMD
   ControlGetPos cx, cy, cw, ch, %QV_TCCurentDir%,      ahk_class TTOTAL_CMD
   ControlGetPos,  ,   , pw, ph, %QV_TCActivePanel%,   ahk_class TTOTAL_CMD
   WinGetPos x, y, , , ahk_class TTOTAL_CMD
      
   vX := x + cx
   vY := y + cy
   vW := pw
   vH := ph + ch + hh
   rect = %vX%,%vY%,%vW%,%vH%

   return rect
}

;---------------------------------------------------------------------------

QV_AdjustViewerPosition( rect )
{
   global hwnd

   loop, parse, rect, `,
   {
      p_%A_Index% := A_LoopField
   }


   WinMove, ahk_id %hwnd%, ,%p_1%,%p_2%,%p_3%,%p_4%
}

;------------------------------------------------------

SetTCPath(path)
{
   if !WinExist("ahk_class TTOTAL_CMD")
   {
      Run, %COMMANDER_PATH%\TOTALCMD.EXE
      WinWait ahk_class TTOTAL_CMD
   }

   WinActivate ahk_class TTOTAL_CMD

   path := path "`r"
   VarSetCapacity( CopyDataStruct, 12 )
   InsertInteger( Asc( "C" ) + 256 * Asc( "D" ), CopyDataStruct )
   InsertInteger( StrLen( path ) + 5, CopyDataStruct, 4 )
   InsertInteger( &path, CopyDataStruct, 8 )
   InsertInteger( Asc( "S" ), path, StrLen( path ) + 1, 1)
   InsertInteger( Asc( "T" ), path, StrLen( path ) + 2, 1)
   SendMessage, 0x4A, , &CopyDataStruct, , ahk_class TTOTAL_CMD

}

;------------------------------------------------------

SendTCCommand(cmd, wait=1)
{
   if (wait)
      SendMessage 1075, cmd, 0, , ahk_class TTOTAL_CMD
   else
      PostMessage 1075, cmd, 0, , ahk_class TTOTAL_CMD
}

;------------------------------------------------------

InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
{
  mask := 0xFF
  Loop %pSize%
  {
    DllCall("RtlFillMemory", UInt, &pDest + pOffset + A_Index - 1, UInt, 1, UChar, (pInteger & mask) >> 8 * (A_Index - 1))
    mask := mask << 8
  }
}

_________________
Image


Last edited by majkinetor on November 13th, 2006, 2:04 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 1:58 pm 
Offline

Joined: July 24th, 2005, 4:29 am
Posts: 27
Location: Rheinland
@majki:
Command line can be activated also when it's disabled!
Try 4003. ;)

Icfu


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 2:02 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Oh, yeah... forgot that :)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 3:03 pm 
Offline

Joined: July 24th, 2005, 4:29 am
Posts: 27
Location: Rheinland
Quote:
Now, if we only can find a way to select a file name without quick search....

You can get rid of quicksearch box as TC 7 supports several listbox commands now, all hidden in this changelog entry:
TC 7 Changelog wrote:
15.09.06 Added: Support for accessibility tools (e.g. for blind users) to main lists+separate tree+sync+CD-Tree, allows to retrieve current line via LB_GETTEXT


To name a few:
LB_GETTEXT
LB_SETCARETINDEX <- ;)
LB_SETSEL
etc...

Icfu


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 3:54 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Indeed :D

Code:
   SetTCFileName("Windows")
return


SetTCFileName( fn )
{
   static sss, LB_SETCARETINDEX, LB_GETTEXT

   if LB_SETCARETINDEX=
   {
      LB_SETCARETINDEX = 0x19E
      LB_GETTEXT = 0x189
      VarSetCapacity(sss, 512)
   }

   loop
   {
      SendMessage LB_GETTEXT, A_Index, &sss, TMyListBox1, ahk_class TTOTAL_CMD
      if (sss = fn) or (sss="")
      {
         SendMessage, LB_SETCARETINDEX, A_Index, 1, TMyListBox1, ahk_class TTOTAL_CMD      
         break
      }
   }
}

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 4:01 pm 
Icfu wrote:
Quote:
Any way to script that?

Nope, there's no way to script that as TC doesn't support feeding a list with items from the outside.

@majki:
You are right when TC is started already of course, but I don't expect others to have TC always started, at least not in this forum here... ;)


Ahh, too bad about feeding a list. And yes, I like this better because I'm not always running TC.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 5th, 2007, 8:04 pm 
Is there away to adopt the script as follows:

If the locate32 window IS active the scripts runs in
its current state.

If the locate32 window IS NOT active, assume that the
clipboard contains either fullpath + filename or just filename
and try to locate the file in the current panel of TC

See also this thread http://www.ghisler.ch/board/viewtopic.php?t=13571


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, chaosad, Google Feedfetcher, Yahoo [Bot] and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group