Search,find strings & Findstr &shellexecute

Published on by Yousfi Benameur


In this article the follow subjects as codes are presented:

1.findstr DOS command  to perform search files or search in files
2-Using findtsr to make num lines of code
3-Windows find engine,find in pdfs tools.
4.Shellexecute options (dont all work)
5. A sample search strings  in editbox on form
6.Search & highlight a searched string in any web page

Suggestions and Bug Reports are always  Welcome


*1* Findstr command : Search for strings on filenames or  in files.
The findstr DOS command is short for find string and is a command used in MS-DOS to locate files containing a specific string of plain text.String searched  can be a part of the string also.
The findstr.exe command is an external DOS command that is available in the below Microsoft operating systems:Windows 2000,Windows ME,Windows XP,Windows Vista,Windows 7,Windows 8

for Windows Vista and later syntax
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file] [/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]] strings [[drive:][path]filename[ ...]]

to get the DOS command findstr help , can use this command line  and redirect the result to any txt file:(this is used in the code below)

 findstr /? >yfindStr.txt

The demo uses some of attributes only.can extend the checkboxes disabled if necessary.

This command is very fast and i prefer it to all searches methods i used in past.The new windows 8.1 search is also perfect and the advantage is that is online ( dont wait the result at the end of job).

this is the method how to work with this utility and can perform it.Can build an exe file.


FINDSTR dos command

*Begin code

*creating an animated gif  (its the bigrotation2.gif below-can also download it)

publi m.myvar0
text to m.myvar0 noshow
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
endtext
*=strtofile(strconv(m.myvar0,14),"bigrotation2.gif")  &&
dont work -gif not animated !!! i used pictureval below in code(image is rendered by gdiplus).

 

Publi m.yrep0
m.yrep0=Addbs( Justpath(Sys(16,1)))
Set Defa To (yrep0)

Publi yform
yform=Newobject("yfindstr")
yform.Show
Read Events
Return
*
Define Class yfindstr As Form
    BorderStyle = 0
    Height = 659
    Width = 627
    ShowWindow = 2
    ShowTips = .T.
    AutoCenter = .T.
    Caption = "yFindstr"
    MaxButton = .F.
    Icon = Home(1)+"GRAPHICS\ICONS\WIN95\EXPLORER.ICO"
    BackColor = Rgb(185,185,255)
    t0 = .F.
    time0 = .F.

    Add Object text1 As TextBox With ;
        BackStyle = 0, ;
        Height = 27, ;
        Left = 98, ;
        Top = 80, ;
        Width = 421, ;
        Name = "Text1"

    Add Object label1 As Label With ;
        AutoSize = .T., ;
        FontSize = 12, ;
        BackStyle = 0, ;
        Caption = "String to find", ;
        Height = 21, ;
        Left = 0, ;
        Top = 84, ;
        Width = 89, ;
        ForeColor = Rgb(0,255,0), ;
        Name = "Label1"

    Add Object command2 As CommandButton With ;
        Top = 32, ;
        Left = 42, ;
        Height = 37, ;
        Width = 37, ;
        Caption = "....", ;
        MousePointer = 15, ;
        ToolTipText = "Path ", ;
        BackColor = Rgb(255,128,0), ;
        Name = "Command2"

    Add Object text2 As TextBox With ;
        BackStyle = 0, ;
        Height = 25, ;
        Left = 90, ;
        ReadOnly = .T., ;
        Top = 40, ;
        Width = 428, ;
        Name = "Text2"


    Add Object label2 As Label With ;
        AutoSize = .F., ;
        FontBold = .T., ;
        FontSize = 12, ;
        BackStyle = 0, ;
        Caption = "file extension to search in:prg,txt,html,h,sct,vbs,....* ", ;
        Height = 22, ;
        Left = 8, ;
        Top = 112, ;
        Width = 395, ;
        ForeColor = Rgb(0,255,0), ;
        Name = "Label2"

    Add Object command3 As CommandButton With ;
        Top = 36, ;
        Left = 525, ;
        Height = 85, ;
        Width = 97, ;
        FontBold = .T., ;
        FontSize = 16, ;
        Caption = "Search", ;
        MousePointer = 15, ;
        ForeColor = Rgb(255,0,0), ;
        BackColor = Rgb(0,255,0), ;
        Name = "Command3"

    Add Object image1 As Image With ;
        Picture =Home(1)+"GRAPHICS\ICONS\WIN95\EXPLORER.ICO",;
        BackStyle = 0, ;
        Height = 32, ;
        Left = 545, ;
        MousePointer = 15, ;
        Top = 123, ;
        Width = 32, ;
        ToolTipText = "yfindstr.txt", ;
        Name = "Image1"

    Add Object label3 As Label With ;
        AutoSize = .T., ;
        FontBold = .T., ;
        FontSize = 20, ;
        BackStyle = 0, ;
        Caption = "?", ;
        Height = 35, ;
        Left = 528, ;
        MousePointer = 15, ;
        Top = 3, ;
        Width = 19, ;
        ForeColor = Rgb(0,255,0), ;
        Name = "Label3"

    Add Object image2 As Image With ;
        Picture = "bigrotation2.gif", ;
        Stretch = 2, ;
        Height = 32, ;
        Left = 406, ;
        Top = 156, ;
        Visible = .F., ;
        Width = 32, ;
        Name = "Image2"

    Add Object check1 As Checkbox With ;
        Top = 228, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check1"

    Add Object check2 As Checkbox With ;
        Top = 250, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check2"


    Add Object check3 As Checkbox With ;
        Top = 273, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check3"

    Add Object check4 As Checkbox With ;
        Top = 298, ;
        Left = 8, ;
        Height = 17, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check4"

    Add Object check5 As Checkbox With ;
        Top = 321, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check5"

    Add Object check6 As Checkbox With ;
        Top = 346, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check6"

    Add Object check7 As Checkbox With ;
        Top = 370, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check7"


    Add Object check8 As Checkbox With ;
        Top = 392, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check8"

    Add Object check9 As Checkbox With ;
        Top = 419, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check9"


    Add Object check10 As Checkbox With ;
        Top = 441, ;
        Left = 8, ;
        Height = 14, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check10"

    Add Object check11 As Checkbox With ;
        Top = 465, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check11"

    Add Object check12 As Checkbox With ;
        Top = 490, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Name = "Check12"

    Add Object check13 As Checkbox With ;
        Top = 513, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Enabled = .F., ;
        Name = "Check13"


    Add Object check14 As Checkbox With ;
        Top = 538, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Enabled = .F., ;
        Name = "Check14"

    Add Object check15 As Checkbox With ;
        Top = 562, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Enabled = .F., ;
        Name = "Check15"

    Add Object check16 As Checkbox With ;
        Top = 584, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Enabled = .F., ;
        Name = "Check16"

    Add Object check17 As Checkbox With ;
        Top = 611, ;
        Left = 8, ;
        Height = 17, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Enabled = .F., ;
        Name = "Check17"

    Add Object check18 As Checkbox With ;
        Top = 633, ;
        Left = 8, ;
        Height = 14, ;
        Width = 540, ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "Check1", ;
        Enabled = .F., ;
        Name = "Check18"

    Add Object label4 As Label With ;
        AutoSize = .T., ;
        FontBold = .T., ;
        FontSize = 14, ;
        FontUnderline = .T., ;
        BackStyle = 0, ;
        Caption = "O P T I O N S", ;
        Height = 25, ;
        Left = 12, ;
        MousePointer = 15, ;
        Top = 204, ;
        Width = 119, ;
        ForeColor = Rgb(255,0,0), ;
        ToolTipText = "expand to set options", ;
        Name = "Label4"

    Add Object zlab As Label With ;
        FontBold = .T., ;
        FontSize = 10, ;
        BackStyle = 0, ;
        Caption = "", ;
        Height = 23, ;
        Left = 72, ;
        Top = 6, ;
        Width = 432, ;
        ForeColor = Rgb(128,0,64), ;
        Name = "zLab"

    Add Object text3 As TextBox With ;
        BackStyle = 0, ;
        Height = 25, ;
        Left = 411, ;
        Top = 111, ;
        Width = 109, ;
        Name = "Text3"

    Add Object ycmd As Checkbox With ;
        Top = 149, ;
        Left = 449, ;
        Height = 17, ;
        Width = 67, ;
        FontBold = .T., ;
        Alignment = 0, ;
        BackStyle = 0, ;
        Caption = "CMD", ;
        tooltiptext="Show/hide CMD",;
        MousePointer = 15, ;
        ForeColor = Rgb(0,255,255), ;
        Name = "yCMD"

    Add Object ylab As EditBox With ;
        FontBold = .T., ;
        FontSize = 8, ;
        BackStyle = 0, ;
        BorderStyle = 0, ;
        Height = 59, ;
        Left = 0, ;
        ScrollBars = 0, ;
        Top = 133, ;
        Width = 396, ;
        ForeColor = Rgb(128,0,64), ;
        Name = "yLab"

    Procedure Init

        With Thisform

             .image2.pictureval=strconv(m.myvar0,14)  &&animated gif
            .check1.Caption="/B   Match pattern if at the Beginning of a line.."
            .check2.Caption="/E   Match pattern if at the END of a line."
            .check3.Caption="/L   Use search string(s) literally."
            .check4.Caption="/R   Uses search strings as regular expressions."
            .check5.Caption="/S   Search subfolders."
            .check6.Caption="/I   Case-insensitive search."
            .check7.Caption="/X   Print lines that match exactly."
            .check8.Caption="/V   Print only lines that do NOT contain a match."
            .check9.Caption="/N   Print the line number before each line that matches."
            .check10.Caption="/M  Print only the filename if a file contains a match."
            .check11.Caption="/O  Print character offset before each matching line "
            .check12.Caption="/P  Skip any file that contains non-printable characters"

            *can extend possibilities of findstr with these other attributes
            *.check13.caption="/ OFF[LINE] Ne pas ignorer les fichiers dont l'attribut hors connexion a ‚t‚ r‚gl‚."
            *.check14.caption=[/A:attr Spécifie l'attribut de couleur avec 2 chiffres hexadécimaux. Entrez "color /?]
            *.check15.caption="/F:fichier  Lit la liste des fichiers dans le fichier spécifié (/ pour la console). "
            *.check16.caption="/C:chaine  Recherche la chaine spécifiée littéralement. "
            *.check17.caption="/G:fichier  Obtient les chaines … rechercher … partir du fichier spécifié (/ pour la console)."
            *.check18.caption=" /D:r‚p     Recherche dans une liste de répertoires délimitée par des points-virgules."
        Endwith

        &&my default settings
        Thisform.check5.Value=1
        Thisform.check6.Value=1
        Thisform.check9.Value=1
        Thisform.Height=229
    Endproc

    Procedure Destroy
        Clea Events
    Endproc

    Procedure command2.Click
        Local m.yrep
        m.yrep=Getdir()
        If Empty(m.yrep)
            Return .F.
        Else
            Thisform.text2.Value=m.yrep
        Endi
        Thisform.ylab.Value=""
    Endproc

    Procedure command3.Click
        With Thisform
            If .ycmd.Value=1
                .WindowState=1
            Endi
            .time0=Datetime()
        Endwith

        Thisform.zlab.Caption=""
        Local m.yoption
        m.yoption=""

        If  Thisform.check1.Value=1
            m.yoption=m.yoption+"/B "
        Endi
        If  Thisform.check2.Value=1
            m.yoption=m.yoption+"/E "
        Endi
        If  Thisform.check3.Value=1
            m.yoption=m.yoption+"/L "
        Endi
        If  Thisform.check4.Value=1
            m.yoption=m.yoption+"/R "
        Endi
        If  Thisform.check5.Value=1
            m.yoption=m.yoption+"/S "
        Endi
        If  Thisform.check6.Value=1
            m.yoption=m.yoption+"/I "
        Endi
        If  Thisform.check7.Value=1
            m.yoption=m.yoption+"/X "
        Endi
        If  Thisform.check8.Value=1
            m.yoption=m.yoption+"/V "
        Endi
        If  Thisform.check9.Value=1
            m.yoption=m.yoption+"/N "
        Endi
        If  Thisform.check10.Value=1
            m.yoption=m.yoption+"/M "
        Endi
        If  Thisform.check11.Value=1
            m.yoption=m.yoption+"/O "
        Endi
        If  Thisform.check12.Value=1
            m.yoption=m.yoption+"/P "
        Endi
        *if  thisform.check13.value=1
        *m.yoption=m.yoption+"/OFF "
        *endi
        *if  thisform.check14.value=1
        *m.yoption=m.yoption+"/A "
        *endi
        *if  thisform.check15.value=1
        *m.yoption=m.yoption+"/F "
        *endi
        *if  thisform.check16.value=1
        *m.yoption=m.yoption+"/C "
        *endi
        *if  thisform.check17.value=1
        *m.yoption=m.yoption+"/G "
        *endi
        *if  thisform.check18.value=1
        *m.yoption=m.yoption+"/D "
        *endi


        Set Defa To (Allt(Thisform.text2.Value))
        Local m.cmdline
        TEXT to m.cmdline textmerge noshow
        findstr  <<m.yoption>> "<<allt(thisform.text1.value)>>"  *.<<allt(thisform.text3.value)>> ><<m.yrep0>>yfindStr.txt
        ENDTEXT

        Thisform.ylab.Value=m.cmdline
        _Cliptext=M.cmdline
        Strtofile(m.cmdline,m.yrep0+"yfindstr.bat")
        Local oshell
        oshell=Createobject("wscript.shell")
        Thisform.image2.Visible=.T.
        Thisform.t0=Seconds()

        oshell.Run[m.yrep0+"yfindstr.bat",;
Thisform.ycmd.Value,.T.]

                Thisform.zlab.Caption=[Time elapsed=]+;
Trans[Seconds()-Thisform.t0,;
"99999"]+[sec.]

        Dele File (m.yrep0+"yfindstr.bat")
        *modi file f:\yfindstr.txt noedit
        Thisform.image2.Visible=.F.

        Local m.oo
        m.oo=m.yrep0+"yfindstr.txt"
        Run/N notepad  &oo

        Local m.y
        m.y=Lower(Filetostr(m.oo))

        Thisform.zlab.Caption=Thisform.zlab.Caption;
+"-->"+Trans( Occurs(Lower(Allt(Thisform.text1.Value)),m.y))+" found."

        Set Defa To (yrep0)
    Endproc

    Procedure image1.Click
        Local m.lcfilename,m.myvar
        m.lcfilename=m.yrep0+"yfindstr.txt"
        TEXT to m.myvar textmerge noshow
        run/n Explorer /select,"<<m.lcfilename>>"
        ENDTEXT
        &myvar
    Endproc

    Procedure label3.Click
        Local m.cmdline
        TEXT to m.cmdline textmerge noshow
        findstr /? ><<m.yrep0>>yfindStr.txt
        ENDTEXT
        Thisform.ylab.Value=m.cmdline

        Strtofile(m.cmdline,m.yrep0+"yfindstr.bat")
        Local oshell
        oshell=Createobject("wscript.shell")

     oshell.Run[m.yrep0+"yfindstr.bat",;
0,.T.]

        Dele File (m.yrep0+"yfindstr.bat")
        Local m.oo
        m.oo=m.yrep0+"yfindstr.txt"
        Run/N notepad &oo
    Endproc

    Procedure label4.Click
        Do Case
            Case This.Caption="O P T I O N S"
                This.Caption="C O L L A P S E"
                Thisform.Height=660

            Case This.Caption="C O L L A P S E"
                This.Caption="O P T I O N S"
                Thisform.Height=229
        Endcase
    Endproc

Enddefine
*

*Endcode

 


can download the animated gif and save it as  "bigrotation2.gif" in source folder. its built in code with pictureval property.
can download the animated gif and save it as  "bigrotation2.gif" in source folder. its built in code with pictureval property.
can download the animated gif and save it as  "bigrotation2.gif" in source folder. its built in code with pictureval property.

can download the animated gif and save it as "bigrotation2.gif" in source folder. its built in code with pictureval property.


*2* Making number line in front of any code line and returning the code-using findstr.

*This  can use the following command and let DOS quickly tell  the number of lines in the file.
*this adds a number at the begining of each line of the code
*can view on notepad and as html page
*This is very fast comparing with vfp functions memlines,lines()..whose are relatively slow.
*Tried on code more 3100 lines of code and works perfectly.
*DOS: the redirection operators  > overwrite, >> append to the file

*Begin code

Clea All
Local lcfilename
lcfilename=Getfile("prg|txt|mp|h")  &&any similar file to txt
If Empty(m.lcfilename)
    Return .F.
Endi

Local m.xtype, m.number
m.xtype=Int(Val(Inputbox("Line numbers:0, no numbers:1","","0")))
If m.xtype=0
    m.number=" /N"
Else
    m.number=""
Endi


Set Textmerge On To "f:\yfindstr.bat"  Noshow
If m.xtype=0
\  echo Lines number of <<justfname(m.lcfilename)>> :>  f:\mycode.txt
\ findstr /R <<m.number>>  "^"   <<m.lcfilename>> | find /C ":" >> f:\mycode.txt
\ echo.  >> f:\mycode.txt
Else
\ echo.  > f:\mycode.txt
Endi
\ echo.********************************************************************************************  >> f:\mycode.txt
\ findstr /R <<m.number>> "^"   <<m.lcfilename>> >> f:\mycode.txt
Set Textmerge To
Set Textmerge Off
*modi comm  f:\yfindstr.bat

Local oshell
oshell=Newobject("wscript.shell")

oshell.Run["f:\yfindstr.bat",;
0,.T.]

dele file "f:\yfindstr.bat"
Run/N notepad F:\mycode.txt

*create an html file with beautified with some css
Local m.myvar
TEXT to m.myvar textmerge noshow
<style type="text/css">.mydiv {
width: 100%;  //% of screen width or px units
box-shadow: 10px 10px 5px #888888;
border:1px solid #ffffff;
background-color:bisque;
margin-left:10px;
margin-top:10px;
margin-bottom:10px;
margin-right:10px;

}
.yp {
line-height: 95%;
margin:auto;
padding:5px;
width:90%;
color:navy;
text-indent: 10px;
}

h1 {
  text-shadow: 0 1px 0 #ccc,
               0 2px 0 #c9c9c9,
               0 3px 0 #bbb,
               0 4px 0 #b9b9b9,
               0 5px 0 #aaa,
               0 6px 1px rgba(0,0,0,.1),
               0 0 5px rgba(0,0,0,.1),
               0 1px 3px rgba(0,0,0,.3),
               0 3px 5px rgba(0,0,0,.2),
               0 5px 10px rgba(0,0,0,.25),
               0 10px 10px rgba(0,0,0,.2),
               0 20px 20px rgba(0,0,0,.15);
  text-align: center;
}
</style>
<div class="mydiv">
<h1 class="h1"><<justfname(m.lcfilename)>></h1>

<p class="yp" ><br />
<<strtran(filetostr("f:\mycode.txt"),chr(13),"<br>")>>
ENDTEXT

Local m.lcdest
m.lcdest=Addbs(Sys(2023))+"mycode.html"
Strtofile(m.myvar,m.lcdest)

local m.oo

m.oo=Newobject("hyperlink")
m.oo.NavigateTo(m.lcdest)

*Endcode

 


se also codes to do that in :http://yousfi.over-blog.com/2015/01/around-syntax-highlighting-in-visual-foxpro.html

se also codes to do that in :http://yousfi.over-blog.com/2015/01/around-syntax-highlighting-in-visual-foxpro.html

some relative findstr links:( some bugs also)

https://technet.microsoft.com/en-us/library/bb490907.aspx
http://ss64.com/nt/findstr.html
http://www.computerhope.com/findstr.htm

 


*3* Windows  FIND engine,PDF find

 

*1-uses the standard windows search.this searches filenames by default but can set advanced options  to search in files.Its the exact  window explorer in win8.1.The search engine is very performant and fast.
*2-for pdfs i used a multi PDFS search with acrobat reader
.

 

*Begin code

Local m.xrep
m.xrep=Inputbox("Windows standard FIND(1)-SEARCH IN MANY PDFS WITH Acrobat Reader (2)","","1")
If ! Inlist(m.xrep,"1","2")
    Return .F.
Endi


Declare Integer ShellExecute In shell32.Dll ;
    INTEGER hndWin, ;
    STRING cAction, ;
    STRING cFileName, ;
    STRING cParams, ;
    STRING cDir, ;
    INTEGER nShowWin

Do Case
    Case m.xrep="1"
        cFileName = "c:\"   &&folder  to search for
        cAction ="find"
        =ShellExecute(0,cAction,cFileName,"","",0)

    Case m.xrep="2"

        cFileName = "acroRD32.exe"
        =ShellExecute(0,"open",cFileName,"","",3)
        Inkey(3)
        Local oshell
        oshell=Newobject("wscript.shell")
        oshell.Sendkeys("+^F")
Endcase

*endcode


Search,find strings &amp; Findstr &amp;shellexecute
Search,find strings &amp; Findstr &amp;shellexecute

Remark :I used recursive folders to search filenames , extensions,...but in big folders there is an error raised "stackoverflow".i changed the value below but the error raises yet.
STACKSIZE = nValue
Specifies the number of nesting levels from 32 to 64,000 for operations such as the DO command.can change the nesting level only during
Visual FoxPro startup.Default: 128

ref:https://msdn.microsoft.com/en-us/library/6eks5f35%28v=vs.80%29.aspx


*4* Considerations on Shellexecute API
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/gg537745%28v=vs.85%29.aspx

Shellexecute API

The first parameter is the window handle, can be null.
The second parameter is the operation to perform on the file.
The third parameter refer to the file.
The fourth parameter refer to what working directory to change to when opening the file, can be null.
The fifth parameter refers to in what mode to open the file/program in.

try the codes (uncomment successively each code pat and run)

This shellexecute behavior have always existed and MS dont correct it  or dont gives any *explanation or samples.Some entries works, some works partially, some dont work at all !

Particulary the option "Find" dont work as expected !

See the error returned if the case.i guess the shellexecute depends on what is set in the registry.


*Begin code
Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
    STRING cOperation,;
    STRING cFileName,;
    STRING cParameters,;
    STRING cDirectory,;
    INTEGER nShowWindow
Local m.result


**open : works -open the file with the associated defined application
m.result=  ShellExecute(0, "open", Getfile(),"","",1)
If Between(m.result,0,32)
    =yerror(m.result)
Endi


*print : works for txt files for ex.-If lpFile is not a document file, the function fails.
*m.result=  ShellExecute(0, "print", getfile(),"","",1)
*if between(m.result,0,32)
*=yerror(m.result)
*endi

**find in folder : works launch the windows utility search for a folder
*can input a string to search in filename or in files (configure the search  options in toolbar)
*m.result=ShellExecute(0, "find", getdir(), "", "", 1)
*if between(m.result,0,32)
*=yerror(m.result)
*endi


**find :  dont work  for searchable string !
**Local m.xstr
*m.xstr="declare"
*m.result=  ShellExecute(0, "find", m.xstr,"",Getdir(),1)
*If Between(m.result,0,32)
 *   =yerror(m.result)
*Endi

*Custom find working.this start the windows utility and paste the string o search+return

**find in folder : works launch the windows utility search for a folder
**can input a string to search in filename or in files (configure the search  options in toolbar)
*local m.ystr
*m.ystr="jpg"
*m.result= ShellExecute(0, "find", getdir(), "", "", 1)
*if between(m.result,0,32)
*=yerror(m.result)
*endi
*inkey(1)

*local oshell
*oshell=newobject("wscript.shell")
*oshell.sendkeys("png")
*oshell.sendkeys("~")
*oshell=null


*edit works for txt file for ex.,not files as prg.. must be a document file(msdn)
*m.result=  ShellExecute(0, "edit", getfile('prg'),"","",1)  &&dont work-must set application associated  in registry
*if between(m.result,0,32)
*=yerror(m.result)
*endi


*Explore : works (same as :run/n explorer &lcdir)
*m.result=  ShellExecute(0, "explore", getdir(),"","",1)
*if between(m.result,0,32)
*=yerror(m.result)
*endi

*properties :Displays the object's properties.- dont work
*m.result=  ShellExecute(0, "properties", getfile(),"","",1)
*if between(m.result,0,32)
*=yerror(m.result)
*endi


Function yerror()
    Lparameters xresult
    TEXT to m.myvar textmerge  noshow
Last error=<<xresult>>
 0 The operating system is out of memory or resources.
2-3 The specified file was not found
5-8-32  Windows 95 only: denied access to the specified file- not enough memory -dynamic-link library was not found
10  Wrong Windows version
11 The .EXE file is invalid (non-Win32 .EXE or  error in .EXE image).
12-13  Application was designed for a different operating system or for MS-DOS 4.0
15 Attempt to load a real-mode program
16 Attempt to load a second instance of an application with non-readonly data segments
19 Attempt to load a compressed application file
20 Dynamic-link library (DLL) file failure
26 A sharing violation occurred.
27 The filename association is incomplete or invalid.
28 The DDE transaction could not be completed because request timed out.
29 The DDE transaction failed.
30 The DDE transaction could not be completed because other DDE transactions were being processed.
31 no application associated with the given filename extension.
OTHERWISE undocumented
    ENDTEXT
    Return  Messagebox(m.myvar,0+32+4096,"Shellexecute errors")
Endfunc

*End code

 


*5* A sample search strings  in editbox on form

*this code search any string in an editbox on form and highlight it.
*The dialog is fired bt CTRL+F key.
*this makes  sensitive or insensitive search

*Begin code
Publi yform
yform=Newobject("yfind")
yform.Show
Read Events
Return
*
Define Class yfind As Form
    Height = 399
    Width = 654
    ShowWindow = 2
    AutoCenter = .T.
    Caption = "Find string in editbox"
    Name = "Form1"

    Add Object edit1 As EditBox With ;
        Anchor = 15, ;
        Height = 276, ;
        Left = 0, ;
        Top = 36, ;
        Width = 649, ;
        Name = "Edit1"

    Add Object command1 As CommandButton With ;
        Top = 7, ;
        Left = 60, ;
        Height = 25, ;
        Width = 73, ;
        Caption = "Any txt file...", ;
        Name = "Command1"

    Add Object ysearchedtxt1 As ysearchedtxt With ;
        Top = 315, ;
        Left = 207, ;
        Visible = .F., ;
        obj = "thisform.edit1", ;
        Name = "Ysearchedtxt1", ;
        cboSearchString.Name = "cboSearchString", ;
        lblText.Name = "lblText", ;
        cmdFind.Name = "cmdFind", ;
        chkCase.Alignment = 0, ;
        chkCase.Name = "chkCase", ;
        Label1.Name = "Label1", ;
        Label2.Name = "Label2", ;
        Label3.Name = "Label3"

    Add Object Label1 As Label With ;
        AutoSize = .T., ;
        FontBold = .T., ;
        Caption = "CTRL+F to show dialog box", ;
        Height = 17, ;
        Left = 144, ;
        Top = 8, ;
        Width = 154, ;
        ForeColor = Rgb(255,0,0), ;
        BackColor = Rgb(255,255,0), ;
        Name = "Label1"

    Procedure Init
        DoDefault()
        TEXT to thisform.edit1.value noshow
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat
fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac rutrum
nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst. Nulla in iaculis nisi.
Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non, porta congue dolor. Aenean viverra
auctor sagittis. Integer lobortis dignissim auctor. Proin et volutpat massa.
Cras vitae felis venenatis, egestas sem quis, sodales neque. Donec venenatis hendrerit odio, non
pellentesque metus scelerisque ac. Suspendisse aliquet rhoncus odio id viverra. Vestibulum feugiat
lectus a nisl pulvinar, in tempor metus eleifend. Nunc id odio quam. Praesent egestas lorem ut
sollicitudin consectetur. Vestibulum id bibendum est. Ut vel lacus sapien. Quisque eget molestie
sem. Integer eget purus eu orci molestie aliquam quis in ante. Integer a magna eget lectus finibus
porttitor. Donec fringilla sapien a quam aliquet, pellentesque blandit nisl placerat. Nam hendrerit
velit vel ex aliquam, eget convallis ante mollis.
        ENDTEXT

    Endproc

    Procedure Destroy
        loEDT=Null
        Clea Events
    Endproc

    Procedure edit1.KeyPress
        Lparameters nKeyCode, nShiftAltCtrl
        If nKeyCode=6    &&ctrl+f
            Nodefault
            Thisform.ysearchedtxt1.Visible=.T.
            Thisform.ysearchedtxt1.cboSearchString.SetFocus
        Endi
    Endproc

    Procedure command1.Click
        Local cfilename
        m.cfilename=Getfile('txt')
        If !Empty(m.cfilename)
            Thisform.edit1.Value=Filetostr(m.cfilename)
            Thisform.edit1.SetFocus
        Endi
    Endproc

Enddefine
*
*-- EndDefine: yfind


*
Define Class ysearchedtxt As Container
    Anchor = 768
    Width = 240
    Height = 81
    Name = "ysearchedtxt"

    Add Object cboSearchString As ComboBox With ;
        FontBold = .F., ;
        FontName = "MS Sans Serif", ;
        FontSize = 8, ;
        Height = 23, ;
        Left = 4, ;
        TabIndex = 6, ;
        Top = 20, ;
        Width = 209, ;
        Name = "cboSearchString"

    Add Object lblText As Label With ;
        AutoSize = .T., ;
        FontBold = .F., ;
        FontName = "MS Sans Serif", ;
        FontSize = 8, ;
        BackStyle = 0, ;
        Caption = "Text to \<search for:", ;
        Height = 15, ;
        Left = 2, ;
        Top = 5, ;
        Width = 88, ;
        TabIndex = 5, ;
        Name = "lblText"

    Add Object cmdFind As CommandButton With ;
        Top = 44, ;
        Left = 4, ;
        Height = 23, ;
        Width = 73, ;
        FontBold = .T., ;
        FontName = "MS Sans Serif", ;
        FontSize = 8, ;
        Caption = "\<Find", ;
        Enabled = .F., ;
        TabIndex = 7, ;
        ForeColor = Rgb(255,0,0), ;
        BackColor = Rgb(0,255,0), ;
        Name = "cmdFind"

    Add Object chkCase As Checkbox With ;
        Top = 45, ;
        Left = 81, ;
        Height = 17, ;
        Width = 143, ;
        AutoSize = .T., ;
        Alignment = 0, ;
        Caption = "Case Sensitive Search", ;
        Value = .T., ;
        Enabled = .F., ;
        TabIndex = 8, ;
        Name = "chkCase"


    Add Object Label1 As Label With ;
        AutoSize = .T., ;
        FontBold = .T., ;
        BackStyle = 0, ;
        Caption = "Statsitics", ;
        Height = 17, ;
        Left = 127, ;
        MousePointer = 15, ;
        Top = 2, ;
        Width = 56, ;
        ForeColor = Rgb(255,0,0), ;
        Name = "Label1"

    Add Object Label2 As Label With ;
        AutoSize = .T., ;
        FontBold = .T., ;
        FontSize = 12, ;
        Caption = "X", ;
        Height = 22, ;
        Left = 222, ;
        MousePointer = 15, ;
        Top = 4, ;
        Width = 13, ;
        ForeColor = Rgb(255,0,0), ;
        Name = "Label2"


    Add Object Label3 As Label With ;
        AutoSize = .T., ;
        BackStyle = 0, ;
        Caption = "", ;
        Height = 17, ;
        Left = 84, ;
        Top = 62, ;
        Width = 2, ;
        Name = "Label3"

    Procedure waitmode
        Lparameters tlWaitMode
        lnMousePointer = Iif(tlWaitMode, 11, 0)
        Thisform.MousePointer = lnMousePointer
        Thisform.SetAll('MousePointer', lnMousePointer)
    Endproc

    Procedure Destroy
        loEDT=Null
        Release loEDT
    Endproc


    Procedure Init
        Publi loEDT
        loEDT =Eval("thisform.edit1")
        If !Lower(loEDT.Class)==[editbox]
            Messagebox("There is not  Editbox !",16+4096,"error")
            Return .F.
        Endi
    Endproc

    Procedure cboSearchString.InteractiveChange
        If !Empty(This.Text)
            This.Parent.cmdFind.Enabled = .T.
            This.Parent.chkCase.Enabled = .T.
        Else
            This.Parent.cmdFind.Enabled = .F.
            This.Parent.chkCase.Enabled = .F.
        Endif
    Endproc

    Procedure cboSearchString.Valid
        If !Empty(This.Text)
            For i = 1 To This.ListCount
                If This.List(i) = This.Text
                    Return
                Endif
            Endfor
            This.AddItem(This.Text)
        Endif
    Endproc


    Procedure cboSearchString.GotFocus
        This.Parent.Label3.Caption=""
    Endproc


    Procedure cmdFind.Click
        Local loCBO, i, llFound, lnStart, lnLen, lnChoice, llKeepLooking, llCaseSensitive  && loEDT,
        llFound = .F.
        llCaseSensitive = This.Parent.chkCase.Value

        * Make sure there is something to search for
        loCBO = This.Parent.cboSearchString
        If Empty(loCBO.Text)
            #Define EMPTY_LOC "Please specify some text to search for."
            Wait Window EMPTY_LOC Timeout 1.5
            loCBO.SetFocus
            Return
        Endif

        N=Occurs(Alltrim(loCBO.Text),loEDT.Value)
        This.Parent.Label3.Caption=Trans(N)+" found"

        * Search for the first instance of the text
        lnLen = Len(Alltrim(loCBO.Text))

        *lnStart = 0
        lnStart = loEDT.SelStart

        * See if value is already selected
        If loEDT.SelText = Alltrim(loCBO.Text) Or ;
                (!llCaseSensitive And (Upper(loEDT.SelText) = Upper(Alltrim(loCBO.Text))))
            lnStart = lnStart + 1
        Endif

        Thisform.LockScreen = .T.
        loEDT.HideSelection = .T.
        This.Parent.waitmode(.T.)

        llKeepLooking = .T.
        Do While llKeepLooking
            For i = lnStart To Len(loEDT.Value)
                loEDT.SelStart = i
                loEDT.SelLength = lnLen
                If loEDT.SelText = Alltrim(loCBO.Text) Or ;
                        (!llCaseSensitive And ;
                        (Upper(loEDT.SelText) = Upper(Alltrim(loCBO.Text))))
                    llFound = .T.
                    llKeepLooking = .F.
                    Exit
                Endif
            Endfor

            If !llFound
                #Define NOTFOUND_LOC "Search string not found." + Chr(13) ;
                    + "Do you want to continue searching from the beginning?"
                #Define CAP_LOC "Not Found"
                lnChoice=Messagebox(NOTFOUND_LOC,64+0+4,CAP_LOC)
                If lnChoice = 6 && Yes
                    llKeepLooking = .T.
                    lnStart = 0
                Else
                    llKeepLooking = .F.
                Endif
            Endif
        Enddo
        loEDT.HideSelection = .F.
        Thisform.LockScreen = .F.
        This.Parent.waitmode(.F.)
    Endproc


    Procedure Label1.Click

        Local cstring
        cstring=loEDT.Value
        This.Parent.waitmode(.T.)
        Local lnWords, lnParas, llWord, lnChars
        #Define ALPHA_LOC "ABCDEFGHIJKLMNOPQRSTUVWXYZ."
        #Define CR Chr(13)
        #Define Tab Chr(9)
        lnWords = 0
        lnParas = 0
        llWord = .F.
        lnChars = Len(cstring)
        Sys(2002) && turn the cursor off
        For i = 1 To lnChars
            If Inkey() = 13
                Wait Clear
                This.Parent.waitmode(.F.)
                This.txtCharacters.Value = ""
                This.txtWords.Value = ""
                This.txtParagraphs.Value = ""
                Sys(2002,1)
                Return
            Endif
            lcLetter = Upper(Substr(cstring, i, 1))
            If lcLetter$ALPHA_LOC
                llWord = .T.
                Loop
            Endif
            If lcLetter = CR
                lnParas = lnParas + 1
            Endif
            If llWord And Inlist(lcLetter, " ", Tab, CR)
                lnWords = lnWords + 1
                llWord = .F.
            Endif
        Endfor

        * In case the last word is not followed by a white character
        If llWord
            lnWords = lnWords + 1
        Endif

        Local m.xx
        TEXT to m.xx textmerge noshow
        -Characters.=<<trans( lnChars)>>
        -Words       =<<trans( lnWords)>>
        -Paragraphs =<<trans( lnParas)>>
        ENDTEXT
        Messagebox(m.xx,0+32+4096,"Statistics")

        Wait Clear
        This.Parent.waitmode(.F.)
        Sys(2002,1)
    Endproc

    Procedure Label2.Click
        This.Parent.Visible=.F.
    Endproc

Enddefine
*
*-- EndDefine: ysearchedtxt

*Endcode

*for searching in rtfbox, highlighting,replacing...Can see this post :
*http://yousfi.over-blog.com/2015/02/building-a-vfp-navigable-richtextbox.html

can Also use the vfp native class home(1)+ ffc\_table.vcx  to make string searches

can Also use the vfp native class home(1)+ ffc\_table.vcx to make string searches


 

*6*This code search and highlight(red/yellow) a string searched in any web page
*and count the occurences of this string in this page

*Begin code
Declare Integer Sleep In kernel32 Integer
Declare Integer BringWindowToTop In user32 Integer
Local m.xstr,m.x,m.url
m.url="http://yousfi.over-blog.com/2015/03/search-find-strings-findstr-shellexecute.html"

m.xstr=Inputbox("String to search","","Add")
If Empty(m.xstr)
    Return .F.
Endi

Publi apie
apie=Newobject("internetexplorer.application")
With apie
    .Navigate(m.url)
    *.visible=.t.
    Do While .busy Or .readystate#4
        Sleep(100)
    Enddo
    Sleep(500)
    m.x=.Document.body.innerhtml
    Local m.n
    m.n=Occurs(m.xstr,m.x)
    m.x=Strtran(m.x,m.xstr,'<span style="color:red;background-color:yellow">'+m.xstr+'</span> ')
    .Document.body.innerhtml=m.x
    .Width=Sysmetric(1)
    .Height=Sysmetric(2)
    .Top=0
    .Left=0
    .Visible=.T.
    Messagebox(Trans(m.n)+" occurences of ["+m.xstr+"] in web the page "+m.url,0+32+4096,"")
    =BringWindowToTop(.HWnd)
Endwith

*endcode

 


Search,find strings &amp; Findstr &amp;shellexecute
Search,find strings &amp; Findstr &amp;shellexecute

Click on code to select [then copy] -click outside to deselect


*7*
*created on friday 17 of november 2017  for UT user.
*Fires programmatly the search dialog in pdf document embed on a vfp browser.
*can implement simply the famous CTRL+F but after giving the focus to the browser.
*ctrl+f fires the simple search dialog in acrobat document
*CTRL+F fires the advanced search in the acrobat document (warning here its sensitive).
*see the 2 photos attached.

publi oform
oform=newObject("yacrobat")
oform.show
read events
retu
*
DEFINE CLASS yacrobat AS form
	Height = 576
	Width = 1151
	ShowWindow = 2
	AutoCenter = .T.
	Caption = "Form1"
	BackColor = RGB(212,208,212)
	Name = "Form1"

	ADD OBJECT obrowser AS olecontrol WITH ;
        oleclass="shell.explorer.2", ;
		Top = 36, ;
		Left = 0, ;
		Height = 541, ;
		Width = 1153, ;
		Anchor = 15, ;
		Name = "oBrowser"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 2, ;
		Left = 36, ;
		Height = 25, ;
		Width = 85, ;
		FontBold = .T., ;
		Anchor = 768, ;
		Caption = "Open a pdf", ;
		MousePointer = 15, ;
		SpecialEffect = 2, ;
		ForeColor = RGB(0,255,255), ;
		BackColor = RGB(128,0,64), ;
		Name = "Command1"

	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 2, ;
		Left = 156, ;
		Height = 27, ;
		Width = 96, ;
		FontBold = .T., ;
		Anchor = 768, ;
		Caption = "Simple search", ;
		MousePointer = 15, ;
		SpecialEffect = 2, ;
		BackColor = RGB(255,255,0), ;
		Name = "Command2"

	ADD OBJECT command3 AS commandbutton WITH ;
		Top = 2, ;
		Left = 265, ;
		Height = 27, ;
		Width = 107, ;
		FontBold = .T., ;
		Anchor = 768, ;
		Caption = "Advanced search", ;
		MousePointer = 15, ;
		SpecialEffect = 2, ;
		BackColor = RGB(128,255,0), ;
		Name = "Command3"

	PROCEDURE Destroy
		clea events
	ENDPROC


	PROCEDURE obrowser.Init
		this.silent=.t.
	ENDPROC


	PROCEDURE command1.Click
		local m.lcfile
		m.lcfile=getfile('pdf')
		if ! inlist(lower(justext(m.lcfile)),"pdf")  &&only pdf filter
		return .f.
		endi
		thisform.oBrowser.navigate(m.lcfile)
	ENDPROC


	PROCEDURE command2.Click
		local oshell
		oshell=newObject("wscript.shell")
		thisform.oBrowser.setFocus
		oshell.sendkeys("^f")   &&sensitive f minuscule open search in acrobat document
		oshell=null
	ENDPROC


	PROCEDURE command3.Click
		local oshell
		oshell=newObject("wscript.shell")
		thisform.oBrowser.setFocus
		oshell.sendkeys("^F")   &&sensitive F majuscule  open advanced search in acrobat document
		oshell=null
	ENDPROC


ENDDEFINE
*
*-- EndDefine: yacrobat


Search,find strings &amp; Findstr &amp;shellexecute
Search,find strings &amp; Findstr &amp;shellexecute
Search,find strings &amp; Findstr &amp;shellexecute
To be informed of the latest articles, subscribe:
Comment on this post