AutoHotkey Community

It is currently May 27th, 2012, 12:01 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: December 3rd, 2010, 2:49 pm 
Offline

Joined: September 23rd, 2005, 8:18 pm
Posts: 55
Is it possible to set the value of an objects param as the value of another objects param without having to store the value in a temporary variable.

I am trying to accomplish something like this.

Object1 := Object()
Object2 := Object()

Object1["value1"] = "test"
Object2["value2"] = Object1["value1"]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2010, 2:54 pm 
Did you try this code?
Code:
Object1 := Object()
Object2 := Object()

Object1["value1"] := "test"
Object2["value2"] := Object1["value1"]
MsgBox, % Object2["value2"] ; shows "test"


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2010, 2:57 pm 
Offline

Joined: September 23rd, 2005, 8:18 pm
Posts: 55
a4u wrote:
Did you try this code?
Code:
Object1 := Object()
Object2 := Object()

Object1["value1"] := "test"
Object2["value2"] := Object1["value1"]
MsgBox, % Object2["value2"] ; shows "test"


Yes that actually works. The := operator means assign the value of Object1["value1"] instead of the actual text right?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2010, 3:02 pm 
Offline

Joined: July 10th, 2008, 8:49 am
Posts: 1865
Location: Brussels, Belgium
"Object()" ?

In AHK_L so ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Concatinate
PostPosted: January 14th, 2011, 8:53 am 
Offline

Joined: September 23rd, 2005, 8:18 pm
Posts: 55
I can't get the following expression to work the result is empty. How would you go about concatenating values from to different object in to one value in another object?

Code:
Object1["Value"] = Object2["value1"] . Object3["value1"]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2011, 9:07 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
Don't forget this is an expression, try this and see if it works:

Code:
Object1["Value"] := Object2["value1"] . Object3["value1"]

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2011, 2:37 pm 
Offline

Joined: September 23rd, 2005, 8:18 pm
Posts: 55
sinkfaze wrote:
Don't forget this is an expression, try this and see if it works:

Code:
Object1["Value"] := Object2["value1"] . Object3["value1"]



I've tried it and it doesn't work.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2011, 3:39 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
Phoenix wrote:
I've tried it and it doesn't work.


You sure about that? Run this and tell me what you get:

Code:
eval1 :=   Object(), eval2 :=   Object(), result :=   Object()
Loop, 10
   eval1.Insert(A_Index), eval2.Insert(A_Index)
result["Concatenate"] :=   eval1[4] . eval2[5]
MsgBox %   result["Concatenate"]

_________________
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 Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher, Yahoo [Bot] and 18 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