Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

talk() - Interscript communication provider and more


  • Please log in to reply
44 replies to this topic
A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

talk() v0.6

 

talk() is a class to help share data between scripts as easy as it can get.

Uses the SendtMessage example from help file as a base to do the job.

Works with compiled exe's.

 

Changes

  • Added Errorlevels to functions
  • Removed the 2 globals that were in the previous versions
  • Added wait param in setvar() , thanks gunner

 

Methods

  • setvar(var, value, wait=true) - sets/creates variable in a client script . Optionally waits for the value to be set in the client script
  • getvar(var) - gets value of variable in a client script
  • runlabel(label, wait=true) - runs label in a client script . If wait=false , the host script doesnt wait for the label to be completed in the client script
  • terminate() - exits/closes client script
  • suspend(timeinms) - suspends client script for a desired time interval

 

Examples (Recommended)

 

Return Values

Except getVar() which returns the value, all other function returns whether they were successful or not.

          Values

                 Successful = 1
                 Communication Request not accepted = 0
                 (Client) Script not found = FAIL
 

 

Download


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

tested and works. i guess this could have many useful and real applications.



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

tested and works. i guess this could have many useful and real applications.

Good you got it to work. I thought I may have left readers confused in the introductory post.

Do you think more methods can be added to the class ?


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

i defer this to more qualified members since my knowledge is limited. sad.png



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

i defer this to more qualified members since my knowledge is limited. sad.png

So is mine.cool.png
I was just asking do you find/need more functions like this ... 
I personally think getvar, setvar, runlabel and terminate are enough to do all communication works ...


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


faqbot
  • Members
  • 997 posts
  • Last active:
  • Joined: 10 Apr 2012
Does example 1 work for you?

A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Does example 1 work for you?

Definitely, I have tested it.

By the way, Example 1 means Example 1 from the example package.

and then, what about Example 2 and 3 ?


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


faqbot
  • Members
  • 997 posts
  • Last active:
  • Joined: 10 Apr 2012
2 & 3 work from what I can see, but 1 doesn't. It keeps saying "var1 from Rec1.ahk is ---- Rec1's var1" after pressing alt+r (after entering alt+k and new value/text).

A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

2 & 3 work from what I can see, but 1 doesn't. It keeps saying "var1 from Rec1.ahk is ---- Rec1's var1" after pressing alt+r (after entering alt+k and new value/text).

So, I have tested 1 upto 15 times now and it works as the theory says.

Also, note that Ex 1 is a pretty simple example. It makes use of only setvar() method. Example2 is some complex and makes use of setvar(), getvar() and runlabel() . So, if Ex2 works, it's all right..

 

Really cant say, what's happening there. Have you tried using the lib to create your own ( setvar() only ) examples to see if they work.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


noname
  • Members
  • 650 posts
  • Last active:
  • Joined: 12 Nov 2011

Impressive,very useful! There are occasions when running two scripts  would be a solution to overcome the "one thread only", this lib will make it easy to integrate the two happy.png

 

This is also the first time i could transfer more than 32Kb using a CopyDataStruct with ahk i am curious why because this limit has also been reased in other language forums.I usually send from an unicode sender to an "ascii" receiver so that could be a reason.

 

I also had the problem the rec1/sender1 did not work.It took me 40 min to find something.

 

using:

SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
settimer,check,500
sender1 := new talk("Sender1")	;Create client for Sender1.ahk
var1 := "Rec1's var1"
msgbox,% "var1 from Rec1.ahk is ---- " var1
msgbox, Now press Alt+K to show Sender1's InputBox.`nChoose a new value for var1.`nHit ok`nThen press Alt+R to show new var1 in Rec1


!r::
msgbox,% "var1 from Rec1.ahk is ---- " var1
ExitApp
return

check:
counter++
ToolTip, %var1% %counter%
return

#Include talk.ahk

If the msgbox giving the info "Now press Alt+K......." is not closed ( to read the instructions i let it be open or it hided behind another window so i was not aware of it being open) the var1 is not updated.

 

Thanks Avi !

 

 

 

 

 


winXP  and ahk unicode


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Impressive,very useful! There are occasions when running two scripts  would be a solution to overcome the "one thread only", this lib will make it easy to integrate the two happy.png

Thanks . The main aim was to make exchanging data as easy as possible.
 
@faqbot
 Hope you are not doing what lain did.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


faqbot
  • Members
  • 997 posts
  • Last active:
  • Joined: 10 Apr 2012
In that case abandon all hope - that was exactly what I was doing :-( But it does work now... ;-)

A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Good, then..grin.png .. Happy there isn't a architecture/OS bug.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Version updated to 0.2

  • Added Suspend() method....   -  Suspend Client script for a desired period of time

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Version updated to 0.4

  • Added wait param to runlabel
  • Fixed bugs

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan