Page 1 of 1

Tool to find the path of the project

Posted: Mon Apr 09, 2018 6:39 am
by Otto
Hello,
attached you find a handy tool to find the path of the Project.
Best regards,
Otto


Code: Select all | Expand


// to find the path of the project
// open the Windows File Manager and Drag and Drop a file over this window

#include "FiveWin.ch"

static oWnd
static cResultPath := ""
//----------------------------------------------------------------------------//

function Main()    

   DEFINE WINDOW oWnd TITLE "Droping Files from FileManager to find  path of project"

     @ 10,10 ;
      BTNBMP  ;
      PROMPT "Path to Clipboard" ;
          OF oWnd ;
      ACTION CopyToClipboard( cResultPath )

   
   ACTIVATE WINDOW oWnd ;
      ON DROPFILES PaintTheName( nRow, nCol, aFiles )


return nil

//----------------------------------------------------------------------------//

function PaintTheName( nRow, nCol, aFiles )

   local cName, cResult := ""
   local n := 1

   while ! Empty( cName := StrToken( aFiles[ 1 ], n++, "\" ) )
      if "
~" $ cName
         cName = SFN2LFN( cResult + cName )
      endif
      cResult += cName + "
\"
   end
   cResult = SubStr( cResult, 1, Len( cResult ) - 1 )

   oWnd:Say( nRow, nCol, cResult,,,, .t. )  // Say in pixels

   cResultPath := PrjPath( cResult )
   if "
~" $ cResultPath
      cResultPath = SFN2LFN( cResultPath )
   endif

   oWnd:Say( nRow + 50, nCol, "
Project path: " + cResultPath,,,, .t. )


return nil
//----------------------------------------------------------------------------//

function PrjPath( cExe )

   local cBuf, nAt

   if Empty( cExe )
      return nil
   endif

   cBuf  := MEMOREAD( cExe )
   cBuf  := AfterAtNum( "
(_INITSTATICS", cBuf, 1 )
   cBuf  := AfterAtNum( Chr( 0 ), cBuf, 1 )
   cBuf  := BeforAtNum( Chr( 0 ), cBuf, 1 )

return cBuf
//----------------------------------------------------------------------------//
                   
function CopyToClipboard( cText )

   local oClip := TClipBoard():New()
   
   if oClip:Open()
      oClip:SetText( cText )
      oClip:Close()
   endif
   
   oClip:End()
   
return nil  

//----------------------------------------------------------------------------//


Re: Tool to find the path of the project

Posted: Mon Apr 09, 2018 2:52 pm
by karinha
Sorry. ???????

Regards.

Re: Tool to find the path of the project

Posted: Mon Apr 09, 2018 5:02 pm
by Otto
Hello,
maybe it is useful for you, too.
Best regards,
Otto

Image

Re: Tool to find the path of the project

Posted: Mon Apr 09, 2018 5:43 pm
by karinha
Unfortunately with my version, it does not work.

Image

Regards,

Re: Tool to find the path of the project

Posted: Fri Jun 01, 2018 8:41 am
by Otto
Hello,
I would like to add this tool to to desktop or in the buttonbar of TotalCommander.
But I do not know what is missing that Tool-EXE is not opening automatically with the “Drag and Drop” info from the dropped file of File Manager.
Thank you in advance
Otto