AutoHotkey Community

It is currently May 27th, 2012, 3:14 am

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 29, 30, 31, 32, 33, 34, 35 ... 70  Next
Author Message
 Post subject:
PostPosted: March 28th, 2010, 8:16 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
I noticed the shorthand assign operators don't seem to work for objects. Here's an example of what I mean for Concatenate:
Code:
obj := object( 1, "Auto" )
obj[1] .= "Hotkey"
MsgBox,  %   obj[1] "`n" ; should display AutoHotkey?
         .   obj[1] := obj[1] . "Hotkey"
fincs wrote:
... Object feature can also do arrays.
Agreed - & a solution could be to have object libraries that come with the AHK download ( or a listing of libraries & URL ). IMO however, if AHK is seeking to be noobie-friendly, a built-in array object is more important than a built-in file object.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2010, 4:10 pm 
Offline

Joined: March 20th, 2010, 9:49 am
Posts: 224
nice
this WHILE thing used to be in AutoIt
thx for the update in AHK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2010, 9:01 pm 
Offline

Joined: November 26th, 2009, 3:00 am
Posts: 13
The code for getting a path of an explorer window as shown in this post works perfectly in AutoHotkey.exe but fails to run correctly in AutoHotkey_L. It returns what looks like a garbage string rather than the folder name.

The code is basically just a bunch of DLL calls and a SendMessage. I would think this should work fine in AutoHotkey_L. Any idea what might be the issue here?

I'm on Windows XP, btw.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2010, 9:21 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
jethrow wrote:
I noticed the shorthand assign operators don't seem to work for objects. Here's an example of what I mean for Concatenate:
Code:
obj := object( 1, "Auto" )
obj[1] .= "Hotkey"
MsgBox,  %   obj[1] "`n" ; should display AutoHotkey?
         .   obj[1] := obj[1] . "Hotkey"


In that case, meta-functions would need to be extended I think.
You would need to know what operation is being performed, so there would be __Add, __Sub, __Concat, __Mult, __Div...
Quote:
IMO however, if AHK is seeking to be noobie-friendly, a built-in array object is more important than a built-in file object.
Why would a build in array be more user friendly?

senseful wrote:
The code for getting a path of an explorer window as shown in this post works perfectly in AutoHotkey.exe but fails to run correctly in AutoHotkey_L. It returns what looks like a garbage string rather than the folder name.

The code is basically just a bunch of DLL calls and a SendMessage. I would think this should work fine in AutoHotkey_L. Any idea what might be the issue here?

I'm on Windows XP, btw.

Use Unicode version, I wonder why it is not used automatically :shock:
Code:
;Instead
..."Shell32\SHGetPathFromIDList"...
;use
..."Shell32\SHGetPathFromIDListW"...

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2010, 9:35 pm 
Offline

Joined: November 26th, 2009, 3:00 am
Posts: 13
Thanks, it works.

I'm guessing the only way to get the call to work for both AutoHotkey and AutoHotkey_L then, would be to use an IF statement and examine the A_IsUnicode variable to determine which one is running?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2010, 11:01 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
HotKeyIt wrote:
I wonder why it is not used automatically
Shell32.dll exports "SHGetPathFromIDList" in addition to "SHGetPathFromIDListA" and "SHGetPathFromIDListW".
senseful wrote:
use an IF statement and examine the A_IsUnicode variable
That, or use the ANSI build of AHK_L.
Code:
AorW := A_IsUnicode ? "W" : "A"
...
DllCall("Shell32\SHGetPathFromIDList" AorW, ...)
jethrow wrote:
I noticed the shorthand assign operators don't seem to work for objects.
Right, they currently require a variable to be on the left-hand side. obj[1] is evaluated and its return value used in the assignment (obviously that won't work).
HotKeyIt wrote:
In that case, meta-functions would need to be extended I think.
Why? IMO, if obj[1] contains a string, obj[1] .= "Hotkey" should act like any other concatenation. Otherwise obj[1] . "Hotkey" would also need to call a meta-function for consistency, but that would be rarely useful and would complicate all of the supported operators.
jethrow wrote:
Are there any plans to incorporate a built-in array object in the future?
No. What features should it have? FYI, Object started out as just an associative array.
UMAR wrote:
this WHILE thing used to be in AutoIt
thx for the update in AHK
While was integrated into the official AHK release over a year ago... :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2010, 7:49 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Lexikos wrote:
HotKeyIt wrote:
In that case, meta-functions would need to be extended I think.
Why? IMO, if obj[1] contains a string, obj[1] .= "Hotkey" should act like any other concatenation. Otherwise obj[1] . "Hotkey" would also need to call a meta-function for consistency, but that would be rarely useful and would complicate all of the supported operators.

But obj[1] . "string" does already call meta-function __Get and that is alright.
When obj[1] .= "string" would be implemented, meta-function would need to know that you are trying to concatenate and not __Set, otherwise it would be confusing and you would get unexpected results, the same for the other operators like +=, *= ...

So are there any plans to support any other operators than := :?:

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2010, 1:25 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
HotKeyIt wrote:
But obj[1] . "string" does already call meta-function __Get and that is alright.
How does that support your argument?
Quote:
When obj[1] .= "string" would be implemented, meta-function would need to know that you are trying to concatenate and not __Set,
obj[1] retrieves a value and . "string" concatenates that value with a string. This works intuitively, without obj ever being aware that a concatenation is to be performed. obj[1] .= "string" requires only one extra, independent step: pass the result back into obj[1], as in:
Code:
obj[1] := obj[1] . "string"
Quote:
otherwise it would be confusing and you would get unexpected results,
Allowing or requiring the object to handle each operation (concatenation, addition, subtraction, etc.) is more likely to cause confusion and unexpected results, especially if the assignment operators are allowed to behave differently to their non-assignment equivalents.
Quote:
So are there any plans to support any other operators than := :?:
Nothing beyond what has been discussed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2010, 7:09 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Lexikos wrote:
...obj[1] .= "string" requires only one extra, independent step: pass the result back into obj[1], as in:
Code:
obj[1] := obj[1] . "string"

I agree, sorry for any confusion :?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2010, 5:39 pm 
Offline
User avatar

Joined: April 4th, 2009, 8:19 pm
Posts: 1143
Location: Croatia
Just want to say: Lexikos thank you for AutoHotkey_L!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Variable Trouble
PostPosted: April 6th, 2010, 10:38 pm 
Offline

Joined: May 18th, 2005, 6:46 pm
Posts: 16
I am having an issue and I can't figure out how to make it work with AHK_L.

Say I have a function where I pass the HWND of a window as a parameter. I then want to store information for the window such that each variable name becomes the HWND + my text.

So if HWND := 0x1234

My variable would be 0x1234WinX

Example:

Code:
Win( MWin ) {
    global

%MWin%WinX := WinX
%MWin%WinY := WinY
%MWin%WinWidth := WinWidth
%MWin%WinHeight := WinHeight
%MWin%SpeedX := SpeedX
%MWin%SpeedY := SpeedY
....


Now I want to be able to access these variable names i.e.

Code:
MsgBox %MWin%SpeedX


This works with AHK before _L, and I am wondering what I need to change to get it to work with _L.

Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2010, 9:21 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
That works with AHK_L. You probably have some other kind of a problem. I use similar things in almost all my modules. If I execute your code I get in ListVars:

Code:
Global Variables (alphabetical)
--------------------------------------------------
0x123123WinHeight[1 of 3]: 4
0x123123WinWidth[1 of 3]: 3
0x123123WinX[1 of 3]: 1
0x123123WinY[1 of 3]: 2
ahk_version[13 of 63]: 1.0.48.05.L50


BTW, if you happen to obtain negative Hwnd the code will break. Such Hwnd could be get by using DllCall without specifying UINT as return value.

On related note, its better to use object for such things in AHKL:

Code:
x := Win(0x123123)
m( x.Hwnd, x.WinX )

Win(Hwnd) {
   res := Object()

   res.Hwnd := Hwnd
   res.WinX := 1
   res.WinY := 2
       ;.......

   return res
}

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2010, 5:51 pm 
Is these a unknown problem with Autohotkey_L? Please have a look into my post from today in this thread: http://www.autohotkey.com/forum/topic10393.html

Thanks for your great work...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2010, 9:01 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
Quote:
Is these a unknown problem with Autohotkey_L?

A known problem, if you use ansi but should use unicode version of the functions.

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2010, 10:20 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Has anything changed about ImageSearch with AHK_L? I have to use an ImageSearch command to tell when a Citrix application is ready to use; in plain vanilla AHK it works fine, but AHK_L (Unicode) never detects the image. Here's the command I use:

Code:
ImageSearch, , , 240, 80, 270, 95, *5 Query.bmp

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 29, 30, 31, 32, 33, 34, 35 ... 70  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group