Jump to content

Get Directory, Read Files, then Search for string


litlmike
 Share

Recommended Posts

I Want To:

1) List the file names in 3 Directories

2) Read those file names for HotKeySet occurences

3) Then count the number of times "HotKeySet" occurs in those 3 Directories

4) View/Export all the HotKeySets occurences

So Far I have Accomlished:

1) List the file names in 3 Directories

I Don't Know:

1) How to read the ENTIRE list of file names for HotKeySet occurences

2) How to count the number of occurences of a String.

Thanks In Advance.

#Include <File.au3>
#Include <Array.au3>

; Read the file names in Directory
; Read those file names for HotKeySet
; Count use of HotKeySet
; Print or export all the HotKeySets

$sFilter = "*.au3"
$FileList1=_FileListToArray(@MyDocumentsDir & "\Personal\AutoIt\MY UDF\Invoices", $sFilter)
If (Not IsArray($FileList1)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList1,"$FileList")

$FileList2=_FileListToArray(@MyDocumentsDir & "\Personal\AutoIt\MY UDF\Tasks UDF", $sFilter)
If (Not IsArray($FileList2)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList2,"$FileList")

$FileList3=_FileListToArray(@MyDocumentsDir & "\Personal\AutoIt\MY UDF\Write Proposal UDF", $sFilter)
If (Not IsArray($FileList3)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList3,"$FileList")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Don't know what to do here;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$FileRead1 = FileRead(@MyDocumentsDir & $FileList1)
$FileRead2 = FileRead(@MyDocumentsDir & $FileList2)
$FileRead3 = FileRead(@MyDocumentsDir & $FileList3)

StringInStr ($FileRead1, "HotKeySet")
StringInStr ($FileRead2, "HotKeySet")
StringInStr ($FileRead3, "HotKeySet")
Link to comment
Share on other sites

I Want To:

1) List the file names in 3 Directories

2) Read those file names for HotKeySet occurences

3) Then count the number of times "HotKeySet" occurs in those 3 Directories

4) View/Export all the HotKeySets occurences

So Far I have Accomlished:

1) List the file names in 3 Directories

I Don't Know:

1) How to read the ENTIRE list of file names for HotKeySet occurences

2) How to count the number of occurences of a String.

Thanks In Advance.

#Include <File.au3>
#Include <Array.au3>

; Read the file names in Directory
; Read those file names for HotKeySet
; Count use of HotKeySet
; Print or export all the HotKeySets

$sFilter = "*.au3"
$FileList1=_FileListToArray(@MyDocumentsDir & "\Personal\AutoIt\MY UDF\Invoices", $sFilter)
If (Not IsArray($FileList1)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList1,"$FileList")

$FileList2=_FileListToArray(@MyDocumentsDir & "\Personal\AutoIt\MY UDF\Tasks UDF", $sFilter)
If (Not IsArray($FileList2)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList2,"$FileList")

$FileList3=_FileListToArray(@MyDocumentsDir & "\Personal\AutoIt\MY UDF\Write Proposal UDF", $sFilter)
If (Not IsArray($FileList3)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList3,"$FileList")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Don't know what to do here;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$FileRead1 = FileRead(@MyDocumentsDir & $FileList1)
$FileRead2 = FileRead(@MyDocumentsDir & $FileList2)
$FileRead3 = FileRead(@MyDocumentsDir & $FileList3)

StringInStr ($FileRead1, "HotKeySet")
StringInStr ($FileRead2, "HotKeySet")
StringInStr ($FileRead3, "HotKeySet")oÝ÷ Ûú®¢×+-^tâ°éëºv j)ì¶l¬r¸©µú%uêɺË^v++­¬uÙbë"*.Á©ív'ßz·§µú%uêí¢Ç­ÈQzË¥¶Æ«{
â¶×§¶¥¢â殶­sb6æ6ÇVFRfÇC¶fÆRæS2fwC°¢6æ6ÇVFRfÇC¶'&æS2fwC° £²7&VFRÆörfÆP¤vÆö&Âb33c´ÆötfÆRÒ67&DF"fײgV÷C²b3#´÷D¶W6WDÆ7BçGBgV÷C°¥ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷Cµ7F'FVB÷D¶W6WDÆ7B6V&6âââgV÷C² £²7&VFRÆ7BöbföÆFW'2Fò6V6°£²VFBFRô'&FBÆæW2FòFB÷&VÖ÷fRföÆFW'2Fò6V6°¤FÒb33c´F$Æ7E³Ð¥ô'&FBb33c´F$Æ7BÂgV÷C²b3#µW'6öæÂb3#´WFôBb3#´ÕTDbb3#´çfö6W2gV÷C²¥ô'&FBb33c´F$Æ7BÂgV÷C²b3#µW'6öæÂb3#´WFôBb3#´ÕTDbb3#µF6·2TDbgV÷C²¥ô'&FBb33c´F$Æ7BÂgV÷C²b3#µW'6öæÂb3#´WFôBb3#´ÕTDbb3#µw&FR&÷÷6ÂTDbgV÷C²¥ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷C´çVÖ&W"öbF&V7F÷&W2Fò6V&6ÒgV÷C²fײT&÷VæBb33c´F$Æ7BÒ £²FW7BV6föÆFW ¢b33c´6÷VçBÒ¤f÷"b33c¶BÒFòT&÷VæBb33c´F$Æ7BÒ b33c´6÷VçB³ÒôF%FW7Bb33c´F$Æ7E²b33c¶EÒ¤æW@¥ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷CµF÷FÂ÷D¶W6WBgVæ7Föç2f÷"ÆÂF&V7F÷&W2ÒgV÷C²fײb33c´6÷VçB¥ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷Cµ6V&66ö×ÆWFRâgV÷C²  £²FW7BF2F&V7F÷'¤gVæ2ôF%FW7Bb33c·4F" Æö6Âb33c·5GFW&âÂb33c¶6V&6Âb33c·4fÆRÂb33c¶D6÷VçBÒ ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷Cµv÷&¶ærvFF&V7F÷'¢gV÷C²fײb33c·4F" b33c·5GFW&âÒb33c·4F"fײgV÷C²b3#²¢æS2gV÷C° b33c¶6V&6ÒfÆTfæDf'7DfÆRb33c·5GFW&â bb33c¶6V&6ÒÓFVà ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷C´W'&÷"ö67W&VB6V&6ærf÷#¢gV÷C²fײb33c·5GFW&â VÇ6P vÆR b33c·4fÆRÒfÆTfæDæWDfÆRb33c¶6V&6 bW'&÷"FVà ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷C´fæ6VB6V&6ærF2F&V7F÷'âgV÷C² WDÆö÷ VÇ6P b33c¶D6÷VçB³ÒôfÆUFW7Bb33c·4fÆR VæD` tVæ@ ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷CµF÷FÂ÷D¶W6WBgVæ7Föç2âF2F&V7F÷'ÒgV÷C²fײb33c¶D6÷VçB &WGW&âb33c¶D6÷Vç@ VæD`¤VæDgVæ2³ÓÒfwCµôF%FW7@ £²FW7BF2fÆP¤gVæ2ôfÆUFW7Bb33c·4fÆR Æö6Âb33c·4FFÂb33c¶d6÷VçBÒ ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷Cµv÷&¶ærvFfÆS¢gV÷C²fײb33c·4fÆR Æö6Âb33c¶fÆRÒfÆT÷Vâb33c·4fÆR²Ò&VBöæÇ bb33c¶fÆRÒÓFVà ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷C´W'&÷"÷VæærfÆS¢gV÷C²fײb33c·4fÆR &WGW&â VæD` vÆR b33c·4FFÒfÆU&VDÆæRb33c¶fÆR bW'&÷"FVâWDÆö÷ b7G&ætå7G"7G&æu7G&u2b33c·4FFÂÂgV÷C´÷D¶W6WBgV÷C²FVâb33c¶d6÷VçB³Ò tVæ@ ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷CµF÷FÂ÷D¶W6WBgVæ7Föç2âF2fÆRÒgV÷C²fײb33c¶d6÷VçB &WGW&âb33c¶d6÷Vç@¤VæDgVæ2³ÓÒfwCµôfÆUFW7

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...