Jump to content
Sign in to follow this  
ezzetabi

A command to convert strings to Handles?

Recommended Posts

More than once I needed to manage windows list and doing this is very easy via strings. Handles ATM can't be stored in strings being a different type.

Is it hard to convert a string to handle type?

Probably it is not, I'd like to see a command that do so, after all commands to convert string to numbers already exists.

Share this post


Link to post
Share on other sites

More than once I needed to manage windows list and doing this is very easy via strings. Handles ATM can't be stored in strings being a different type.

Is it hard to convert a string to handle type?

Probably it is not, I'd like to see a command that do so, after all commands to convert string to numbers already exists.

Why is it easier?

Share this post


Link to post
Share on other sites

@this is me: I meant handle of windows :idiot: .

@Jon

It is easier since strings can be concatenated (adding windows to the list), replaced (removing windows from the list), splitted (making an array for any mass operation)

Arrays instead need resizing and removing from list force recoping all valuesto a position behind...

Please, it is so hard? I guess it is more of less 10 lines of code... :D

Edited by ezzetabi

Share this post


Link to post
Share on other sites

The "handle" type is implemented as an integer AFIAK. Since AutoIt automatically (IIRC) handles conversions of strings, ints, dwords, and the like, you should have no problem passing a string containing an integer and AutoIt should be smart enough to figure it out.


Who else would I be?

Share this post


Link to post
Share on other sites

Try this.

$a = WinGetHandle('')

Select
   Case IsString($a)
      MsgBox(0, '', 'String')
   Case IsInt($a)
      MsgBox(0, '', 'Int')
   Case IsFloat($a)
      MsgBox(0, '', 'Float')
   Case IsArray($a)
      MsgBox(0, '', 'Array')
   Case Else
      MsgBox(0, '', 'I am sorry this-is-me, but it is not nothing we know.')
EndSelect

Share this post


Link to post
Share on other sites

I think Jon removed the "handle=" syntax in the window titles using WinTitleMatchMode, 4 since autoit naturally supports the handle. You used to be able to set up a list of handles and use WinGetTitle("handle=" & $handle) or the like.

@Jon, seeing this, does the "redundant" (Jon's description) handle= need to be reintroduced?


Who else would I be?

Share this post


Link to post
Share on other sites

This is the point of the whole thread this-is-me, as you said Handle= has been removed, even if you can spot it sometime around the helpfile like in the WinGetHandle( ) entry, so I need a way to convert a string to handle or this old feature back.

Share this post


Link to post
Share on other sites

I still don't see any need for converting handles to strings, I went to a lot of trouble to make proper handles supported and the string display was added just a way of debugging.

The handle= syntax is still in, just undocumented, as I need it for AutoItX

Anyway, I might put some IsHandle/Conversion functions in next version but i've still not seen any overwhelming reason for it.

Share this post


Link to post
Share on other sites

Anyway, I might put some IsHandle/Conversion functions in next version but i've still not seen any overwhelming reason for it.

<{POST_SNAPBACK}>

Please do :)

I really need it.

Unless you, developers, make AutoIt accept the 'handle=' syntax without the need to do Opt('WinTitleMatchMode', 4).

Because else I have to turn on the 'matchmode' when starting a UDF and off at the end of the UDF.

Edited by SlimShady

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...