Jump to content

Recommended Posts

Posted (edited)

EDIT: BTW, what's the difference between _Timer_Init() and TimerInit()? I don't see anything extra features in the former.

That is exactly my point. There is no difference so it's absolutely unnecessary to add the extra bloat an un-native func would be.

Edit:

Since the function works on minimized windows, maybe it ran into an active one that's GETTING minimized and crashes there ...

I didn't even think about that, but I guess it could very well be. If you want to know for sure do a WinGetState and check which value are returned when it fails. Edited by AdmiralAlkex
Posted

And I just used UBound() as a quick and dirty way to check for an array. Somewhat unintuitive, but it works

You're not checking for an array, you're wasting cycles! In case the target isn't an array, an error would be raised few statement later in that case anyway.

You might as well try $var[0] directly (I wouldn't call that checking, maybe "early probing" or something). It doesn't give you any chance to recover.

Try by yourself if that triggers an error:

Local $a = 1
UBound($a)
; even
ConsoleWrite(UBound($a) & @LF)

The proper way is to be safe and check for error conditions (using If and return value, @error or @extended depending on the function specification) right after the call. Of course, error checking is most recommended for functions that access external objects, events, which are likely to fail more surely than internal functions applied to arguments you know are correct by construction (except spectacular Windows/memory/processor/you_name_it failure, in which case all is lost). From this point of view, AutoIt is no different from any language.

I'm sorry I had to rely on "stronger" tone to help you realize you were wrong in your assumptions, specially regarding arrays. Now look again at your first post and try to dissect what happens exactly at each step, so you'll see that there is no black magic involved and that you can rely on the language foundations and build securely from there.

There are dark corners and weird cases in AutoIt, but given the diameter of the library and contributed code, they are essentially anecdotical as well as being fixed or improved regularly. Also issues where you hit real caveats belong typically to advanced usage and, should the case arise, you can rely on a strong and helpful community to guide you out.

I hope you'll consider giving AutoIt a second and more rigorous look before throwing it away: it's well worth the effort.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted

I know I must be getting pretty frustrating now, and I admit I've been ignoring the array tutorial a bit, but looking at the issue, how can WinGetTitle() return zero...

In the doc:

Return Value
Success: Returns a string containing the complete window title. 
Failure: Returns numeric 0 if no title match.

So a 0 means it did not find what you were looking for.

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
  • Recently Browsing   0 members

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