Sign in to follow this  
Followers 0

AutoItX: WinGetText & WinGetTitle

9 posts in this topic

Posted

I'm using AutoItX 3.2.4.9 with Javascript.

According to the documentation, WinGetText and WinGetTitle should return numeric 0 on no match.

Instead these functions return string "0" in this case:

autoIt.WinGetTitle('NonexistingWindow', '')

"0"

autoIt.WinGetText('NonexistingWindow', '')

"0"

This means, that

if (autoIt.WinGetText('NonexistingWindow', ''))
      WScript.Echo('NonexistingWindow exists');

will display 'NonexistingWindow exists'.

Share this post


Link to post
Share on other sites



Posted

It seems to me, that both functions should return an empty string instead of numeric 0:

Things like

if (autoIt.WinGetText(caption, '').match(/&Close/))
      ...

should be possible.

Share this post


Link to post
Share on other sites

Posted

ControlCommand has the same problem:

autoIt.ControlCommand(caption, '', 'Button1', 'IsEnabled', '')
   "0"

Share this post


Link to post
Share on other sites

Posted (edited)

According to AutoItX Help, CdTray should return 1 in case of success, 0 otherwise.

In version 3.2.4.9 it always returns nothing.

autoIt.CdTray('d:', 'open')
   undefined

There is also an inconsistence in the help for parameter status: 'closed' or 'close'? -- both work.

Edited by Uhu

Share this post


Link to post
Share on other sites

Posted

Before I go hunting for bugs, does the full version of AutoIt work in the same way or is it purely an AutoItX bug?

Share this post


Link to post
Share on other sites

Posted (edited)

Sorry, I do not use full AutoIt, so I don't know.

Edited by Uhu

Share this post


Link to post
Share on other sites

Posted

Before I go hunting for bugs, does the full version of AutoIt work in the same way or is it purely an AutoItX bug?

I can confirm that the AutoIt return numeric 0 when not found :whistle:

Share this post


Link to post
Share on other sites

Posted

in AutoItX we can't easily return different types so this should really return "" and set the @AutoitError to 1. In the same way I notice that the full version of Autoit is also returning 0 rather than "". I think this should be changed so that "" is returned and @error is set to 1.

Anyone any objections (it is a potential script breaker)?

Share this post


Link to post
Share on other sites

Posted

in AutoItX we can't easily return different types so this should really return "" and set the @AutoitError to 1. In the same way I notice that the full version of Autoit is also returning 0 rather than "". I think this should be changed so that "" is returned and @error is set to 1.

Anyone any objections (it is a potential script breaker)?

previous script was OK only if the user was checking the type return as IsNumber($text) as "if $text = 0" was wrong with windows with empty title. (Vista generate a lot of them)

At least we can add a @error to 1.

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.