Jump to content

FileOpen > FileRead > StringInStr - Not found


Recommended Posts

Good Morning All,

I'm hoping someone here can work their AutoIT magic :sorcerer:

I'm doing a pretty "simple" string search in a HUGE variable.

But I'm doing the basics almost straight out of the Help File...

( sorry, I'm leaving out my main code for privacy reasons )

Local $hFileOpen = FileOpen($sFilePath, $FO_READ)
Local $sFileRead = FileRead($hFileOpen)
Local $sEmailPosition01 = StringInStr ($sFileRead, $sEmailAddress )

Everything looks good with my troubleshooting

I ran IsString against $sFileRead and $sEmailAddress and was okay: "The variable is a string"

So then I ran StringLen($sFileRead) and got string length 68352786

Yeah, I know... That's HUGE - But it worked with the older version of AutoIT (upgraded yesterday) v3.3.14.2

Is there an "Excessive" variable I should set?!? lol. Should I search the string a different way maybe?

I know the string is in there... but I'm getting a StringInStr @error : 0 @extended: 0

Please help! Thank you all

:)

 

 

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Link to comment
Share on other sites

Hello. work correctly for me with a file size of 68352786 bytes. (Autoit Version  v3.3.14.1 & v3.3.14.2)

 

Saludos

Link to comment
Share on other sites

Thanks Danyfirex

Could you try a StringInStr w/ an email address like this please?

first.last@domain.org

Just want to make sure it's just me...

I'm going to uninstall / reinstall everything if your results are fine.

 

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Link to comment
Share on other sites

Keep working. (tested with a txt file UTF8 (without BOM))

Saludos

Edited by Danyfirex
Link to comment
Share on other sites

; Retrieve the character position of where the string 'white' first occurs in the sentence.
Local $iPosition = StringInStr("This is a sentence first.last@domain.org with whitespace.", "first.last@domain.org")
MsgBox($MB_SYSTEMMODAL, "", "The search string 'first.last@domain.org' first appears at position: " & $iPosition)

Almost straight from the HelpFile. Works for me. AutoIt 3.3.14.0

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Well this is whole bunches of odd... I uninstalled, deleted the AutoIT directory from my program files... rebooted, installed - but this used to work I'm tellin ya...

Where is the embedded StringInStr function hiding? - does anyone know? :ph34r:

I want to compare the two if possible. Old version vs New.

To be more exact... I'm loading about a 130MB Address Book and searching for emails.

I mean, I can load it in notepad and find the email no problem to... so I know it's in there... just something changed in the update.

So, in the meantime, I went back from 3.3.14.2 to 3.3.12.0...  and it WORKS!!! HA! I can't believe it lol, I just surprised myself lol, Literally just now... I didn't think it would work LOL. :lmao: Kinda impressed with myself.  Same script - Different version of AutoIT. Yeah, something changed since then obviously. Anyone have any ideas?! Can I export the old StringInStr to a "_StringInStr.au3" file or something?!

Just looking for a workaround.

Thanks!

:ILA2:

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Link to comment
Share on other sites

The udetail.oab file is binary, so I believe the string stops at the first NUL character it sees.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thanks BrewManNH

So what's the difference in StringInStr from AutoIT v3.3.14.2 to v3.3.12.0? Did StringInStr stop doing binary? StringInStr works fine in v3.3.12.0.

:ninja:

Both these come back fine...

MsgBox (0, "", "String Length: " & StringLen($sFileRead) & @CR & "Is String? " & IsString($sFileRead))
MsgBox (0, "", "String Length: " & StringLen($EmailSearch01) & @CR & "Is String? " & IsString($EmailSearch01))

Ah, I see the difference... for some reason I'm getting a longer string length with the older version...

OLD:
String Length: 136692232
Is String? 1

NEW
String Length: 68352786
Is String? 1

Don't hold me to that right now... I'm verifying that data is correct now - I need to have the in paralled imo - both versions of AutoIT to troubleshoot.

Thanks Yall!

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Link to comment
Share on other sites

Please read the section "Script breaking changes" in the help file.
The part about FileOpen describes what has changed.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

K, this worked like a charm :)

Local $hFileOpen = FileOpen($sFilePath, $FO_READ + $FO_UTF8_NOBOM)

NEW:
String Length: 136444713
Is String? 1

:sorcerer::sorcerer::sorcerer:

Thank you again water!

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

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

×
×
  • Create New...