Jump to content

StringInStr with start search at nth character


Recommended Posts

I am trying to speed up some searching and cannot find in help file and forum a way to have a starting position for stringinstr function.

Does this exist in AutoIt?

see for example where I am in need of this

http://www.autoitscript.com/forum/index.ph...t=0#entry493137

Something like stringInStr(<StringToSearchIn>,<StringToSearchFor>,<StartingAtPosition>)

I don't want to do splitting and mid functions as then the string has to get moved/stripped around in memory which takes more time then to actually look from the start. String in size is about 3 megabytes (as its a bitmap of the desktop)

Link to comment
Share on other sites

Have you tested the string functions to see what memory utilization occurs. The logic underneath may not be as dumb as you think it is.

(I haven't checked, it may be every bit that 'dumb'. ) ; but I am continually amazed at how capable the language is, and how it continues to grow, and how many things were really thought out well when they were implemented.

If you need to search almost all the string, it's pointless to skip a few bytes.

If you need to search almost none of it, then Try StringTrim or StringTrimRight -- it should only have to allocate the bytes necessary

Or maybe it would be faster to duplicate the variable in its entirety first -- that operation will certainly have been made as fast as possible.

And, as has been said many times before, in many various contexts...If it's too slow, write a DllCall() or switch languages. Compromises do have to be made.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

I am trying to speed up some searching and cannot find in help file and forum a way to have a starting position for stringinstr function.

Does this exist in AutoIt?

see for example where I am in need of this

http://www.autoitscript.com/forum/index.ph...t=0#entry493137

Something like stringInStr(<StringToSearchIn>,<StringToSearchFor>,<StartingAtPosition>)

I don't want to do splitting and mid functions as then the string has to get moved/stripped around in memory which takes more time then to actually look from the start. String in size is about 3 megabytes (as its a bitmap of the desktop)

The string is a bitmap of the desktop... wha...? :)

At any rate, have you tried using StringRegExp() instead?

:)

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

The string is a bitmap of the desktop... wha...? :)

At any rate, have you tried using StringRegExp() instead?

:)

I am still in trial mode and doing it different ways and for the moment I prefer to have it in AutoIt language.

Performance of imagefinding is quitte good (I use it for testautomation not for recognizing sprites in games) although I see that when image is more on the upper left of the desktop searching takes a while (<4-5 seconds).

Fastest improvement I most likely have to make is to do a bitblt when I am in an area where a match can be done (this is currently about 50-60% of the matching time, when partial match is done this decreases significantly and all searches on my machine are under a second regardless of desktopsize and imagesize to find).

So far not tried the regexp as when you search a BMP of height 100 I would have 100 parts in my regexp where I have doubt if this will be properly handled. First trials I did not get to work.

Finally I have 2 goals with the samplecode

* Find virtual objects on screen for testautomation (Easy for powerbuilder, java objects, citrix/terminal server image)

* Find BMP within BMP on pictures stored on harddisk

Other things I am investigating to speed up the BMP search (within AutoIt language)

* PixelChecksum on a BMP (so far not found an equivalant for this function to do this on a devicecontext)

* When I am in an area that could match make another snapshot and save to BMP file and compare that for match (saving to harddisk is not fastest but its not the critical timeeater at the moment storing full desktop is about 0.2 seconds.)

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...