Jump to content

search text in .xls .ppt .pdf


gius
 Share

Recommended Posts

My idea was:
search "words" in the file,

displaying the string where there is the word,

and then open the file,
with the help of Melba23 and MikahS
the final code is this:

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstants.au3>
#include <GUIlistview.au3>
#include <FontConstants.au3>
#include <WinAPI.au3>

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
Global $listView
Global $folders[2] = [@DesktopDir, @MyDocumentsDir]
Global $aResult[100000][2], $n = 0

Local $sFilter = "*.doc;*.txt" ; Create a string with the correct format for multiple filters
Local $word = GUICtrlCreateInput("", 464, 24, 129, 37)
$Form1 = GUICreate(" ", 623, 438, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_TABSTOP))


GUISetFont(18, 600, 0, "MS Sans Serif") ; Set the font for all controls in one call
$Label1 = GUICtrlCreateLabel("Search:", 16, 24, 422, 41)
ì
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$input = GUICtrlCreateInput("", 364, 24, 129, 37) ; $input is the ControlID of the input control
GUISetState(@SW_SHOW)



While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $input ; When {ENTER} pressed in input
$word = GUICtrlRead($input) ; Read the content of the input
GUIDelete($Form1) ; Delete GUI
SplashTextOn("", "...", 200, 200, -1, -1, 4, "", 24)
ExitLoop
EndSwitch
WEnd

For $k = 0 To UBound($folders) - 1 ; loop through folders
$aFiles = _FileListToArrayRec($folders[$k], "*" & $sFilter, 1, 1, 0, 2) ; list files
If Not @error Then
For $i = 1 To $aFiles[0] ; loop through files
$content = FileRead($aFiles[$i])
; the following regex captures the full lines containing $word
$res = StringRegExp($content, '(?im)(.*\b\Q' & $word & '\E\b.*)\R?', 3) ; if $word must be a lone word
; $res = StringRegExp($content, '(?im)(.*\Q' & $word & '\E.*)\R?', 3) ; if $word can be part of another word
If IsArray($res) Then
$aResult[$n][0] = $aFiles[$i] ; file path
For $j = 0 To UBound($res) - 1
$aResult[$n + $j][1] = $res[$j] ; lines
Next
$n += $j
EndIf
Next
EndIf
Next

ReDim $aResult[$n][2]
aGUI($aResult)
SplashOff()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Func aGUI($array, $title = "")
Local $gui, $i, $findStrPos, _
$itemText, $replacedText, _
$leftStr
;$gui = GUICreate($title, 1024, 768, 192, 124)
$gui = GUICreate($title, 800, 640, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_TABSTOP))
$Label1 = GUICtrlCreateLabel("", 100, 0, 400, 35, $SS_CENTER )
GUICtrlSetFont(-1, 16, 400, 4, 'Comic Sans Ms')
$listView = _GUICtrlListView_Create($gui, "file", 20, 35, @DesktopWidth - 20, @DesktopHeight -120, BitOR($LVS_REPORT, $LVS_SINGLESEL))
$hFont1 = _WinAPI_CreateFont(25, 6, 0, 0, $FW_MEDIUM, False, False, False, _
$DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $PROOF_QUALITY, $DEFAULT_PITCH, 'Tahoma') ; <<<<<<<<<<<<<<<< make our own font using WinAPI
_WinAPI_SetFont($listView, $hFont1, True) ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Here we set the font for the $listview items
$header = HWnd(_GUICtrlListView_GetHeader($listView)) ; <<<<<<<<<<<<<<<< Here we get the header handle
_WinAPI_SetFont($header, $hFont1, True) ; <<<<<<<<<<<<<<<<<<< Here we set the header font
_GUICtrlListView_SetExtendedListViewStyle($listView, $LVS_EX_GRIDLINES)
_GUICtrlListView_AddColumn($listView, "Text")
_GUICtrlListView_AddColumn($listView, "")
_GUICtrlListView_AddArray($listView, $array)
For $i = 0 To UBound($array) - 1 Step 1
$itemText = _GUICtrlListView_GetItemText($listView, $i)
If $itemText <> "" Then
$findStrPos = StringInStr($itemText, "\", 0, -1)
$leftStr = StringLeft($itemText, $findStrPos)
$replacedText = StringReplace($itemText, $leftStr, "")
_GUICtrlListView_SetItemText($listView, $i, $replacedText)
EndIf
Next
_GUICtrlListView_SetColumnWidth($listView, 0, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($listView, 1, $LVSCW_AUTOSIZE_USEHEADER)
GUISetState(@SW_SHOW)
EndFunc ;==>aGUI

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, _
$sIndices, $sData, $sAdata, $file, $splitFile
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $listView
Switch $iCode
Case $NM_DBLCLK
$sIndices = _GUICtrlListView_GetSelectedIndices($listView)
$sData = _GUICtrlListView_GetItemText($listView, $sIndices)
$sAdata = _ArraySearch($aResult, $sData, Default, Default, Default, 3)
$file = _ArrayToString($aResult, Default, $sAdata, 0, Default)
$splitFile = StringSplit($file, "|")
ShellExecute($splitFile[1])
EndSwitch
EndSwitch
EndFunc

The problem is that they are "read" files: .doc .txt .html

but are not "read" important files as .xls .ppt .pdf .rtf

It is possible to improve this code?

Or, in the Forum exists an example of Omga4000 that reads any file
'?do=embed' frameborder='0' data-embedContent>>

it is also possible to receive in the file Log.txt  the string with the search word?

thank you

Link to comment
Share on other sites

the link you provided is based on findstr which is also limited to text files. use xdoc2txt (google it) to extract text and then feed the text to your AutoIt script.

EDIT: here is a WinMerge plugin that is based on xdoc2txt, you can use it independently. this is an older version though, look for the newer one from the author site (Japanese, but manageable)

Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

http://ebstudio.info/home/xdoc2txt.html

http://ebstudio.info/download/KWICFinder/xd2tx207.zip

Local $obj = ObjCreate("xd2txcom.Xdoc2txt.1")
Local $sfileText = $obj.ExtractText("sample.doc",False)

MsgBox(0,'',$sfileText)

Awesome

mLipok

EDIT:

REMARKS: Here is Commercial Licence

http://ebstudio.info/home/commercial/xdoc2txt.html

Edited by mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Can you explain how to insert

amb_xdocdiffPlugin.dll

in the folders autoit?

 

sorry, but i'm using the command-line tool, not the DLL.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

@gius

try my example from post #4

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I tried your code mlipok
I have this error

                                                                                   Variable must be of type "Object".:
Local $sfileText = $obj.ExtractText("sample.doc",False)
Local $sfileText = $obj^ ERROR

Link to comment
Share on other sites

use regsvr32.exe

for example in my Windows System:

c:WindowsSystem32regsvr32.exe "z:TOOLsActiveX Components__TEXT_EXTRACTIONxd2tx207comxd2txcom.dll" 

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

1.

You can edit OP and Tidy your code.

2.

Be more specyfic.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

In this code, how can I insert the possibility to read files with xd2txcom.dll?

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstants.au3>
#include <GUIlistview.au3>
#include <FontConstants.au3>
#include <WinAPI.au3>

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
Global $listView
Global $folders[2] = [@DesktopDir, @MyDocumentsDir]
Global $aResult[100000][2], $n = 0

Local $obj = ObjCreate("xd2txcom.Xdoc2txt.1")

Local $sFilter = "*.doc;*.txt;*.pdf;*xls" ; Create a string with the correct format for multiple filters
Local $word = GUICtrlCreateInput("", 464, 24, 129, 37)
$Form1 = GUICreate(" ", 623, 438, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_TABSTOP))


GUISetFont(18, 600, 0, "MS Sans Serif") ; Set the font for all controls in one call
$Label1 = GUICtrlCreateLabel("Search:", 16, 24, 422, 41)
ì
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$input = GUICtrlCreateInput("", 364, 24, 129, 37) ; $input is the ControlID of the input control
GUISetState(@SW_SHOW)



While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $input ; When {ENTER} pressed in input
$word = GUICtrlRead($input) ; Read the content of the input
GUIDelete($Form1) ; Delete GUI
SplashTextOn("", "...", 200, 200, -1, -1, 4, "", 24)
ExitLoop
EndSwitch
WEnd

For $k = 0 To UBound($folders) - 1 ; loop through folders
$aFiles = _FileListToArrayRec($folders[$k], "*" & $sFilter, 1, 1, 0, 2) ; list files
If Not @error Then
For $i = 1 To $aFiles[0] ; loop through files
$content = FileRead($aFiles[$i])
; the following regex captures the full lines containing $word
$res = StringRegExp($content, '(?im)(.*\b\Q' & $word & '\E\b.*)\R?', 3) ; if $word must be a lone word
; $res = StringRegExp($content, '(?im)(.*\Q' & $word & '\E.*)\R?', 3) ; if $word can be part of another word
If IsArray($res) Then
$aResult[$n][0] = $aFiles[$i] ; file path
For $j = 0 To UBound($res) - 1
$aResult[$n + $j][1] = $res[$j] ; lines
Next
$n += $j
EndIf
Next
EndIf
Next

ReDim $aResult[$n][2]
aGUI($aResult)
SplashOff()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Func aGUI($array, $title = "")
Local $gui, $i, $findStrPos, _
$itemText, $replacedText, _
$leftStr
;$gui = GUICreate($title, 1024, 768, 192, 124)
$gui = GUICreate($title, 800, 640, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_TABSTOP))
$Label1 = GUICtrlCreateLabel("", 100, 0, 400, 35, $SS_CENTER )
GUICtrlSetFont(-1, 16, 400, 4, 'Comic Sans Ms')
$listView = _GUICtrlListView_Create($gui, "file", 20, 35, @DesktopWidth - 20, @DesktopHeight -120, BitOR($LVS_REPORT, $LVS_SINGLESEL))
$hFont1 = _WinAPI_CreateFont(25, 6, 0, 0, $FW_MEDIUM, False, False, False, _
$DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $PROOF_QUALITY, $DEFAULT_PITCH, 'Tahoma') ; <<<<<<<<<<<<<<<< make our own font using WinAPI
_WinAPI_SetFont($listView, $hFont1, True) ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Here we set the font for the $listview items
$header = HWnd(_GUICtrlListView_GetHeader($listView)) ; <<<<<<<<<<<<<<<< Here we get the header handle
_WinAPI_SetFont($header, $hFont1, True) ; <<<<<<<<<<<<<<<<<<< Here we set the header font
_GUICtrlListView_SetExtendedListViewStyle($listView, $LVS_EX_GRIDLINES)
_GUICtrlListView_AddColumn($listView, "Text")
_GUICtrlListView_AddColumn($listView, "")
_GUICtrlListView_AddArray($listView, $array)
For $i = 0 To UBound($array) - 1 Step 1
$itemText = _GUICtrlListView_GetItemText($listView, $i)
If $itemText <> "" Then
$findStrPos = StringInStr($itemText, "\", 0, -1)
$leftStr = StringLeft($itemText, $findStrPos)
$replacedText = StringReplace($itemText, $leftStr, "")
_GUICtrlListView_SetItemText($listView, $i, $replacedText)
EndIf
Next
_GUICtrlListView_SetColumnWidth($listView, 0, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($listView, 1, $LVSCW_AUTOSIZE_USEHEADER)
GUISetState(@SW_SHOW)
EndFunc ;==>aGUI

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, _
$sIndices, $sData, $sAdata, $file, $splitFile
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $listView
Switch $iCode
Case $NM_DBLCLK
$sIndices = _GUICtrlListView_GetSelectedIndices($listView)
$sData = _GUICtrlListView_GetItemText($listView, $sIndices)
$sAdata = _ArraySearch($aResult, $sData, Default, Default, Default, 3)
$file = _ArrayToString($aResult, Default, $sAdata, 0, Default)
$splitFile = StringSplit($file, "|")
ShellExecute($splitFile[1])
EndSwitch
EndSwitch
EndFunc
Link to comment
Share on other sites

this is code with using TIDY (CTRL+T in SciTe4AutoIt)

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstants.au3>
#include <GUIlistview.au3>
#include <FontConstants.au3>
#include <WinAPI.au3>

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
Global $listView
Global $folders[2] = [@DesktopDir, @MyDocumentsDir]
Global $aResult[100000][2], $n = 0

Local $obj = ObjCreate("xd2txcom.Xdoc2txt.1")

Local $sFilter = "*.doc;*.txt;*.pdf;*xls" ; Create a string with the correct format for multiple filters
Local $word = GUICtrlCreateInput("", 464, 24, 129, 37)
$Form1 = GUICreate(" ", 623, 438, 192, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP))


GUISetFont(18, 600, 0, "MS Sans Serif") ; Set the font for all controls in one call
$Label1 = GUICtrlCreateLabel("Search:", 16, 24, 422, 41)
i
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$input = GUICtrlCreateInput("", 364, 24, 129, 37) ; $input is the ControlID of the input control
GUISetState(@SW_SHOW)



While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $input ; When {ENTER} pressed in input
            $word = GUICtrlRead($input) ; Read the content of the input
            GUIDelete($Form1) ; Delete GUI
            SplashTextOn("", "...", 200, 200, -1, -1, 4, "", 24)
            ExitLoop
    EndSwitch
WEnd

For $k = 0 To UBound($folders) - 1 ; loop through folders
    $aFiles = _FileListToArrayRec($folders[$k], "*" & $sFilter, 1, 1, 0, 2) ; list files
    If Not @error Then
        For $i = 1 To $aFiles[0] ; loop through files
            $content = FileRead($aFiles[$i])
            ; the following regex captures the full lines containing $word
            $res = StringRegExp($content, '(?im)(.*\b\Q' & $word & '\E\b.*)\R?', 3) ; if $word must be a lone word
            ; $res = StringRegExp($content, '(?im)(.*\Q' & $word & '\E.*)\R?', 3) ; if $word can be part of another word
            If IsArray($res) Then
                $aResult[$n][0] = $aFiles[$i] ; file path
                For $j = 0 To UBound($res) - 1
                    $aResult[$n + $j][1] = $res[$j] ; lines
                Next
                $n += $j
            EndIf
        Next
    EndIf
Next

ReDim $aResult[$n][2]
aGUI($aResult)
SplashOff()
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func aGUI($array, $title = "")
    Local $gui, $i, $findStrPos, _
            $itemText, $replacedText, _
            $leftStr
    ;$gui = GUICreate($title, 1024, 768, 192, 124)
    $gui = GUICreate($title, 800, 640, 192, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP))
    $Label1 = GUICtrlCreateLabel("", 100, 0, 400, 35, $SS_CENTER)
    GUICtrlSetFont(-1, 16, 400, 4, 'Comic Sans Ms')
    $listView = _GUICtrlListView_Create($gui, "file", 20, 35, @DesktopWidth - 20, @DesktopHeight - 120, BitOR($LVS_REPORT, $LVS_SINGLESEL))
    $hFont1 = _WinAPI_CreateFont(25, 6, 0, 0, $FW_MEDIUM, False, False, False, _
            $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $PROOF_QUALITY, $DEFAULT_PITCH, 'Tahoma') ; <<<<<<<<<<<<<<<< make our own font using WinAPI
    _WinAPI_SetFont($listView, $hFont1, True) ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Here we set the font for the $listview items
    $header = HWnd(_GUICtrlListView_GetHeader($listView)) ; <<<<<<<<<<<<<<<< Here we get the header handle
    _WinAPI_SetFont($header, $hFont1, True) ; <<<<<<<<<<<<<<<<<<< Here we set the header font
    _GUICtrlListView_SetExtendedListViewStyle($listView, $LVS_EX_GRIDLINES)
    _GUICtrlListView_AddColumn($listView, "Text")
    _GUICtrlListView_AddColumn($listView, "")
    _GUICtrlListView_AddArray($listView, $array)
    For $i = 0 To UBound($array) - 1 Step 1
        $itemText = _GUICtrlListView_GetItemText($listView, $i)
        If $itemText <> "" Then
            $findStrPos = StringInStr($itemText, "\", 0, -1)
            $leftStr = StringLeft($itemText, $findStrPos)
            $replacedText = StringReplace($itemText, $leftStr, "")
            _GUICtrlListView_SetItemText($listView, $i, $replacedText)
        EndIf
    Next
    _GUICtrlListView_SetColumnWidth($listView, 0, $LVSCW_AUTOSIZE_USEHEADER)
    _GUICtrlListView_SetColumnWidth($listView, 1, $LVSCW_AUTOSIZE_USEHEADER)
    GUISetState(@SW_SHOW)
EndFunc   ;==>aGUI

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, _
            $sIndices, $sData, $sAdata, $file, $splitFile
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $listView
            Switch $iCode
                Case $NM_DBLCLK
                    $sIndices = _GUICtrlListView_GetSelectedIndices($listView)
                    $sData = _GUICtrlListView_GetItemText($listView, $sIndices)
                    $sAdata = _ArraySearch($aResult, $sData, Default, Default, Default, 3)
                    $file = _ArrayToString($aResult, Default, $sAdata, 0, Default)
                    $splitFile = StringSplit($file, "|")
                    ShellExecute($splitFile[1])
            EndSwitch
    EndSwitch
EndFunc   ;==>WM_NOTIFY

Now anybody can easily see what you need.

Edited by mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

You can try to change this:

$content = FileRead($aFiles[$i])

like this:

If StringRight($aFiles[$i],4) = '.doc' Then
    $content = $obj.ExtractText($aFiles[$i], False)
Else
    $content = FileRead($aFiles[$i])
EndIf

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Since I know a litle about using DllCall, I wanted to try and learn something new.

Can somebody show me the way:

Here is C++ example

// Sample3.cpp : R“\[‹ AvŠP[V‡“‚ĚG“gŠ |C“g‚đ’č‹`‚µ‚Ü‚·B
//
#include "stdafx.h"
#include "OleAuto.h"
#include "comutil.h"
#include <io.h>
#include <fcntl.h>

typedef int (*FUNCTYPE)(BSTR lpFilePath, bool bProp,  BSTR*lpFileText);

int _tmain(int argc, _TCHAR* argv[])
{
    HINSTANCE   hInstDLL;       /*  DLL‚ĚC“X^“Xn“h‹                */
    FUNCTYPE       ExtractText;    /*  DLL‚ĚŠÖ”‚Ö‚Ě|C“^    */

    if((hInstDLL=LoadLibrary( _T("xd2txlib.dll") ) ) == NULL ) {
        abort();
    }

    ExtractText = (FUNCTYPE)GetProcAddress(hInstDLL,"ExtractText");
    if( ExtractText != NULL ) {

        BSTR fileText = ::SysAllocString( _T("") );

        int nFileLength = ExtractText( _T("sample.doc"), false, &fileText );

        BYTE BOM[2] = {0xff, 0xfe};
        _setmode( _fileno( stdout ), _O_BINARY );
        fwrite( BOM, 2, 1, stdout );
        fwrite( (LPCTSTR)fileText, nFileLength, 1, stdout );
    }
    return 0;
}

and my AU3 attempts:

MsgBox(0, '_xdoc2txt()  Result:', _xdoc2txt(@ScriptDir & "\sample.doc"))

Func _xdoc2txt($sFileName)
    Local $sfileText = ''
    Local $fileLength = DllCall("xd2txlib.dll", "int", 'ExtractText', "str", $sFileName, 'BOOL', False, 'str', $sfileText)
    MsgBox(0, '@error', @error)
    MsgBox(0, '', VarGetType($fileLength))
    MsgBox(0, '', $sfileText)
    Return $sfileText
EndFunc   ;==>_xdoc2txt

and I see I'am doing something wrong, as I get this:

 

!>15:06:11 AutoIt3.exe ended.rc:-1073741783

 

Can I get some help in DllCall ?

Edited by mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Mlipok,

Your code works fine!
Even if I am not expert in the code, your examples were really clear.

I do not know if it's a problem of my PC,
but do not work file.odt, .docx, .xlsx, .pptx
is a problem only for me?

thanks

Link to comment
Share on other sites

I do not check it.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Moderators

gius,

docx, .xlsx, .pptx files are actually zipped containers of the real files used by the app. Yu may need to expand them to get at the internal files before looking for the text. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

gius,

This thread would be a good place to start your research. Come back if you run into difficulties. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...