shellexecute open a folder and search files

shellexecute open a folder and search files

Postby MarcoBoschi » Fri May 24, 2024 2:00 pm

Hi,
is it possible to launch shellexecute that opens a folder and to perform immediately a search for a file mask passed as parameters?
For Instance Open f:\myapp\report\ folder and search all files 202405*.pdf

Bye
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: shellexecute open a folder and search files

Postby Willi Quintana » Fri May 24, 2024 2:41 pm

HI,
You could use the "directory" function

aFiles := DIRECTORY( "f:\myapp\report\" + "202405*.pdf")
User avatar
Willi Quintana
 
Posts: 1019
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Re: shellexecute open a folder and search files

Postby MarcoBoschi » Fri May 24, 2024 2:54 pm

Dear Willy my intent is to open folder I want to permit to user to see the folder but I wanto to help him setting a filter in the list o files present in it

Many thanks for your answer

Marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: shellexecute open a folder and search files

Postby karinha » Fri May 24, 2024 3:02 pm

Look at this example if it helps you.

Mira este ejemplo si te ayuda.

Code: Select all  Expand view

// C:\FWH\SAMPLES\MARCOBOS.PRG

#include "FiveWin.Ch"
#include "Directry.ch"

#define CLR_LGREEN    nRGB( 190, 215, 190 )
#define CLR_LGRAY     nRGB( 230, 230, 230 )
#define CLR_VERMELHO  nRGB( 255, 000, 000 )
#define CLR_AMARELO   nRGB( 255, 255, 000 )

REQUEST OrdKeyNo, OrdKeyCount, OrdCreate, OrdKeyGoto

STATIC nBytes, nDisks
STATIC lnKeyEscape := .F.

FUNCTION Main()

   LOCAL oSetupDlg, nDriveTo := 1, cDriveTo, nDriveCap := 4
   LOCAL lGoOn, aFiles[ 1 ],  aFileList, x, iDcor, oFont, oBackup
   LOCAL oDlg, oBrw, n := 1
   LOCAL oAceitar, oCancelar, nKey := VK_RETURN
   LOCAL aPdfs := Directory( "C:\TEMP\*.PDF" )

   // LOCAL aPdfs := DirectoryRecurse( "C:\FWH1701\*.*" )
   // LOCAL aPdfs := DirectoryRecurse( "*.PDF" )

   SET CENTURY ON
   // SET DATE BRITISH
   SET DATE AMERICAN
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO Year( Date() ) - 30
   SET SOFTSEEK OFF
   SET WRAP ON
   SetCancel( .F. )
   SET CONFIRM OFF
   SET DELETED ON
   SET _3DLOOK ON
   SET UNIQUE OFF
   SET ESCAPE OFF
   SET EXACT ON
   SET EXCLUSIVE OFF
   SET MULTIPLE OFF

   SkinButtons()

   IF Len( aPdfs ) < 1
      RETURN NIL
   ENDIF

   // aSort( aPdfs, , , { |x, y | x[1] < y[1] } )
   ASort( aPdfs )

   DEFINE FONT oFont NAME "Arial" SIZE 0, 16 BOLD

   DEFINE DIALOG oDlg FROM 6, 20 TO 25, 90     ;
      TITLE "PDFs File Browser at: " +         ;
      CurDir() + " To View"                    ;
      STYLE nOR( WS_BORDER, WS_THICKFRAME )    ;
      COLORS CLR_BLACK, nRGB( 193, 205, 205 )

   @ 1, 2 LISTBOX oBrw FIELDS aPdfs[ n ][ 1 ], ;
      Str( aPdfs[ n ][ 2 ], 10, 0 ),           ;
      DToC( aPdfs[ n ][ 3 ] ),                 ;
      aPdfs[ n ][ 4 ]                          ;
      Headers "File Name",                     ;
      "Size", "Date", "Hour"                   ;
      FIELDSIZES 270, 80, 80, 60               ;
      COLOR CLR_HBLUE, CLR_AMARELO             ;
      FONT oFont                               ;
      Of oDlg Size 260, 100

   oBrw:bGotop        := {|| N := 1 }
   oBrw:bGoBottom     := {|| N := Eval( oBrw:bLogicLen ) }
   oBrw:bSkip         := {| nWant, nOld | nOld := N, N += nWant, ;
      N := Max( 1, Min( N, Eval( oBrw:bLogicLen ) ) ), ;
      N - nOld }
   oBrw:bLogicLen     := {|| Len( aPdfs ) }
   oBrw:cAlias        := "Array"
   oBrw:nClrBackHead  := CLR_LGREEN
   oBrw:nClrBackFocus := CLR_HRED
   oBrw:nClrForeFocus := CLR_AMARELO
   oBrw:nClrForeHead  := CLR_HRED
   oBrw:nColAct       := 1
   oBrw:nLineStyle    := 3
   oBrw:lCellStyle    := .T.
   oBrw:aJustify      := { .F., .F., .F., .F. }
   oBrw:lMChange      := .F.
   oBrw:SetFocus()
   oBrw:Refresh()

   @ 6.6, 20 Button oBackup PROMPT "&Exit" Of oDlg   ;
      ACTION( oDlg:End() ) SIZE 40, 12 CANCEL

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End()

RETURN NIL

// FIN / END - kapiabafwh@gmail.com
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: shellexecute open a folder and search files

Postby MarcoBoschi » Fri May 24, 2024 3:13 pm

Thank you too but my goal is to have an opened explorer folder

8)
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: shellexecute open a folder and search files

Postby karinha » Fri May 24, 2024 3:39 pm

Code: Select all  Expand view

#include "FiveWin.ch"

#define OFN_ENABLESIZING 0x00800000

FUNCTION Main()

   LOCAL cNomFich := "*.PDF"
   LOCAL cDir //  := "..\samples\"
   LOCAL cFiles

   // cDir := GetWinDir()
   // cDir := cFilePath( GetModuleFileName( GetInstance() ) )
   // cDir := hb_CurDrive() + ":\" + CurDir()

   cDir := "C:\TEMP\"

   cFiles := cNomFich

   // cGetFile("
ficheros include(*.ch)|*.ch|","Elija el fichero include.", ,"c:\fwh\include",.F., , ,"fivewin.ch")
   // cGetFile( "
Todos los archivos (*.*)|*.*", "Contenido de la carpeta",, cFiles,,,OFN_ENABLESIZING,,)

   cGetFile( cNomFich + "
|" + cNomFich, "Elija el fichero.", 1, cDir, .F., .T. )

RETURN NIL


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: shellexecute open a folder and search files

Postby MarcoBoschi » Fri May 24, 2024 3:43 pm

8)
Thank You
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: shellexecute open a folder and search files

Postby karinha » Fri May 24, 2024 3:53 pm

+1

Code: Select all  Expand view

// C:\FWH\SAMPLES\VISUALPDF.PRG

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL  cPathImg, cDirPDfs

   cDirPDfs := "C:\TEMP" // GETCURDIR()

   IF SUBS( cDirPDfs, LEN( ALLTRIM(cDirPDfs ) ) , 1 ) = "\"
      cDirPDfs := SUBS( cDirPDfs, 1 , LEN( ALLTRIM(cDirPDfs ) ) - 1 )
   ENDIF

   LCHDIR( cDirPDfs )

   cPathImg := cDirPDfs + "
\"+ "*.PDF"

   cFile := cGetFile( "
PdfFile(*.Pdf)|*.Pdf|", ;
                      "
Select a File", CurDir(), .T. )

RETURN NIL

// FIN / END


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: shellexecute open a folder and search files

Postby Silvio.Falconi » Wed May 29, 2024 9:30 am

karinha wrote:+1

Code: Select all  Expand view

// C:\FWH\SAMPLES\VISUALPDF.PRG

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL  cPathImg, cDirPDfs

   cDirPDfs := "C:\TEMP" // GETCURDIR()

   IF SUBS( cDirPDfs, LEN( ALLTRIM(cDirPDfs ) ) , 1 ) = "\"
      cDirPDfs := SUBS( cDirPDfs, 1 , LEN( ALLTRIM(cDirPDfs ) ) - 1 )
   ENDIF

   LCHDIR( cDirPDfs )

   cPathImg := cDirPDfs + "
\"+ "*.PDF"

   cFile := cGetFile( "
PdfFile(*.Pdf)|*.Pdf|", ;
                      "
Select a File", CurDir(), .T. )

RETURN NIL

// FIN / END


Regards, saludos.


If I need only the folder ? I tried with it but not run only to take a file
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: shellexecute open a folder and search files

Postby karinha » Wed May 29, 2024 12:22 pm

Silvio, esto?

https://forums.fivetechsupport.com/viewtopic.php?f=6&t=35188&p=209498&hilit=cgetdir&sid=fc21cb4cfc81ff2dfeadd9a0913838da&sid=99fc5b6415c53e5beb1f8f8db6af7661#p209415

Code: Select all  Expand view


#include "FiveWin.ch"

FUNCTION CDIR_SILVIO()

   LOCAL cDir
   LOCAL cDirName := GetCurDir()

   cDir := cGetDir32( cDirName  )

   SetCurDir( cDir )

   ? cDir

RETURN NIL

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: shellexecute open a folder and search files

Postby Silvio.Falconi » Mon Jun 03, 2024 8:49 am

karinha wrote:Silvio, esto?

https://forums.fivetechsupport.com/viewtopic.php?f=6&t=35188&p=209498&hilit=cgetdir&sid=d31672f202782c50247b18cb082f2f0e&sid=d31672f202782c50247b18cb082f2f0e#p209415

Code: Select all  Expand view


#include "FiveWin.ch"

FUNCTION CDIR_SILVIO()

   LOCAL cDir
   LOCAL cDirName := GetCurDir()

   cDir := cGetDir32( cDirName  )

   SetCurDir( cDir )

   ? cDir

RETURN NIL

// FIN / END
 


Regards, saludos.


No le pregunté, profesor
entregarme
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 69 guests

cron