shellexecute open a folder and search files

Post Reply
User avatar
MarcoBoschi
Posts: 1070
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

shellexecute open a folder and search files

Post by MarcoBoschi »

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
Marco Boschi
info@marcoboschi.it
User avatar
Willi Quintana
Posts: 1023
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú
Contact:

Re: shellexecute open a folder and search files

Post by Willi Quintana »

HI,
You could use the "directory" function

aFiles := DIRECTORY( "f:\myapp\report\" + "202405*.pdf")
User avatar
MarcoBoschi
Posts: 1070
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: shellexecute open a folder and search files

Post by MarcoBoschi »

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
Marco Boschi
info@marcoboschi.it
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: shellexecute open a folder and search files

Post by karinha »

Look at this example if it helps you.

Mira este ejemplo si te ayuda.

Code: Select all | Expand

// 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
MarcoBoschi
Posts: 1070
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: shellexecute open a folder and search files

Post by MarcoBoschi »

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

8)
Marco Boschi
info@marcoboschi.it
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: shellexecute open a folder and search files

Post by karinha »

Code: Select all | Expand

#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
MarcoBoschi
Posts: 1070
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: shellexecute open a folder and search files

Post by MarcoBoschi »

8)
Thank You
Marco Boschi
info@marcoboschi.it
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: shellexecute open a folder and search files

Post by karinha »

+1

Code: Select all | Expand

// 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
Silvio.Falconi
Posts: 7104
Joined: Thu Oct 18, 2012 7:17 pm

Re: shellexecute open a folder and search files

Post by Silvio.Falconi »

karinha wrote:+1

Code: Select all | Expand

// 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
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: shellexecute open a folder and search files

Post by karinha »

Silvio, esto?

https://forums.fivetechsupport.com/view ... 61#p209415

Code: Select all | Expand


#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
Silvio.Falconi
Posts: 7104
Joined: Thu Oct 18, 2012 7:17 pm

Re: shellexecute open a folder and search files

Post by Silvio.Falconi »

karinha wrote:Silvio, esto?

https://forums.fivetechsupport.com/view ... 0e#p209415

Code: Select all | Expand


#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
Post Reply