Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

AutoItX: WinGetText & WinGetTitle


  • Please log in to reply
8 replies to this topic

#1 Uhu

Uhu

    Seeker

  • Active Members
  • 14 posts

Posted 13 July 2007 - 09:46 AM

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







#2 Uhu

Uhu

    Seeker

  • Active Members
  • 14 posts

Posted 13 July 2007 - 11:55 AM

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.

#3 Uhu

Uhu

    Seeker

  • Active Members
  • 14 posts

Posted 23 July 2007 - 08:41 AM

ControlCommand has the same problem:

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


#4 Uhu

Uhu

    Seeker

  • Active Members
  • 14 posts

Posted 23 July 2007 - 09:45 AM

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, 23 July 2007 - 09:46 AM.


#5 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 23 July 2007 - 02:07 PM

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

#6 Uhu

Uhu

    Seeker

  • Active Members
  • 14 posts

Posted 23 July 2007 - 02:13 PM

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

Edited by Uhu, 23 July 2007 - 02:14 PM.


#7 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,777 posts

Posted 24 July 2007 - 09:11 AM

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:

#8 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 25 December 2007 - 12:01 PM

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)?

#9 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 9,777 posts

Posted 25 December 2007 - 02:20 PM

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.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users