FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Tool to find the path of the project
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Tool to find the path of the project
Posted: Mon Apr 09, 2018 06:39 AM
Hello,
attached you find a handy tool to find the path of the Project.
Best regards,
Otto


Code (fw): Select all Collapse
// 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   

//----------------------------------------------------------------------------//
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Tool to find the path of the project
Posted: Mon Apr 09, 2018 02:52 PM

Sorry. ???????

Regards.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Tool to find the path of the project
Posted: Mon Apr 09, 2018 05:02 PM
Hello,
maybe it is useful for you, too.
Best regards,
Otto

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Tool to find the path of the project
Posted: Mon Apr 09, 2018 05:43 PM
Unfortunately with my version, it does not work.



Regards,
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Tool to find the path of the project
Posted: Fri Jun 01, 2018 08:41 AM

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

Continue the discussion