Jump to content

Recommended Posts

Posted (edited)

This UDF is no longer supported/developed, please check AppInteract UDF.

 

AutoIt version: 3.3.6.1

UDF versionя: 1.1

Description: Another scripts interaction method. Distinctive feature of this method, it's the ability to transfer whole arrays as data, and even COM objects.

System requirements: Win 2000+, IE 7 +.

Example:

Spoiler

[sENDER] - Interaction Demo.au3

#include <Container.au3>

$sVar = "Test"
$sValue = InputBox('Container', 'Please type a value for "' & $sVar & '" variable:')
If @error Then Exit

$oFSO = ObjCreate("Scripting.FileSystemObject")
$avArray = StringSplit('AutoIt is the Best!', ' ')

$oContainer = _Container_Open("storage", 1)

_Container_PutProperty($oContainer, $sVar, $sValue)
_Container_PutProperty($oContainer, "FSO", $oFSO)
_Container_PutProperty($oContainer, "Array", $avArray)

MsgBox(64, "Container", "Values are set. Now, before closing this message, open: [RECIEVER] - Interaction Demo.au3")

_Container_Close($oContainer)

[RECIEVER] - Interaction Demo.au3

#include <Container.au3>

$oContainer = _Container_Open("storage", 0)

If @error Then
    MsgBox(48, 'Container', '_Container_Open() failed!')
    Exit
EndIf

$vTestVar_Value = _Container_GetProperty($oContainer, "Test")
$vFSOVar_Value = _Container_GetProperty($oContainer, "FSO")
$aArrayVar_Value = _Container_GetProperty($oContainer, "Array")

MsgBox(64, 'Container', '"Test" variable value: ' & $vTestVar_Value)
MsgBox(64, 'Container', '"FSO" variable type: ' & VarGetType($vFSOVar_Value))
MsgBox(64, 'Container', '"Array" variable type: ' & VarGetType($aArrayVar_Value))
MsgBox(64, 'Container', '"Array[1]" variable value: ' & $aArrayVar_Value[1])

Attachments:

Container_UDF_1.1.zipFetching info...

Container_UDF.zipFetching info...

Changelog:

Spoiler

v1.1

* Added IE version verification. This library requierd IE 7 (and windows 2000+).

* Better errors handling.

v1.0

First version.

Edited by MrCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

Great stuff as usual mate. Haven't done speed tests yet but looking through the code I think its safe to say the transfer rates will be just fine. The entire setup is well done and easy to use, and I can't think of any possible compatibility issues off the top of my head. Good stuff.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Posted

Here are my speed tests, getting between 4700 and 6500.

Sender.uu3

#include <Container.au3>

$oContainer = _Container_Open("storage", 1)

If @error Then
    MsgBox(48, 'SENDER', '_Container_Open() failed!')
    Exit
EndIf

ShellExecute("RECIEVER.au3")
Sleep(100)

_Container_PutProperty($oContainer, "ReadyFlag", 0)

$i = 0
$iTimer = TimerInit()

While TimerDiff($iTimer) < 10000
    If _Container_GetProperty($oContainer, "ReadyFlag") = 0 Then
        _Container_PutProperty($oContainer, "Test", $i)
        _Container_PutProperty($oContainer, "ReadyFlag", 1)
        $i += 1
    EndIf
WEnd

_Container_PutProperty($oContainer, "ReadyFlag", -1)
Sleep(1000)
Exit

_Container_Close($oContainer)

Reciever.au3

#include <Container.au3>

$oContainer = _Container_Open("storage", 0)

If @error Then
    MsgBox(48, 'RECIEVER', '_Container_Open() failed!')
    Exit
EndIf

$vTest = 0

Sleep(100)

While 1
    If _Container_GetProperty($oContainer, "ReadyFlag") = 1 Then
        $vTest = _Container_GetProperty($oContainer, "Test")
        _Container_PutProperty($oContainer, "ReadyFlag", 0)
    EndIf
    If _Container_GetProperty($oContainer, "ReadyFlag") = -1 Then
        MsgBox(0,"Test result","Recieved " & $vTest & " variables")
        Exit
    EndIf
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

A quick thought, is there any way to poll the contents of the container? Perhaps returning an array of variable names?

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Posted

  On 3/26/2011 at 10:32 PM, 'BillLuvsU said:

A quick thought, is there any way to poll the contents of the container? Perhaps returning an array of variable names?

I would guess there is no need. You only need to have the sender add all the names to a CONTENTS name and the reciever can read it. As the sender or reciever adds a name it could be added to the list.

@ MrCreatoR

Looks really good :)

How do you avoid 2 applications trying to change the same value at the same time? Or is it up the the script writer to ensure that doesn't happen?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

  On 3/26/2011 at 10:46 PM, 'martin said:

I would guess there is no need. You only need to have the sender add all the names to a CONTENTS name and the reciever can read it. As the sender or reciever adds a name it could be added to the list.

@ MrCreatoR

Looks really good :)

How do you avoid 2 applications trying to change the same value at the same time? Or is it up the the script writer to ensure that doesn't happen?

No application except in the context of a rather complex system, such as more than just two scripts working in synchronization, like a plugin system of sorts perhaps. While it wont likely be used it would still be a nice feature.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Posted

  On 3/28/2011 at 7:12 AM, 'ptrex said:

I am getting a COM error on line 52 ?

What am I doing wrong.

I both tried a compiled an non compiled test. Both of them give errors ?

rgds

ptrex

Maybe the CLSID for ShellBrowserWindow is not {C08AFD90-F2A1-11D1-8455-00A0C91F3880} in W7.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
  • Moderators
Posted

MrCreatoR,

Cracking UDF! :)

It must be the easiest inter-script communication method yet. Thank you for posting it. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

What is the persistency (if that's a word) of the data? Or should I say of the container? Does it exist only as long as a running script has it open? Until a shutdown? Or does it survive a reboot?

My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!
Posted

  On 3/28/2011 at 2:52 PM, 'martin said:

Maybe the CLSID for ShellBrowserWindow is not {C08AFD90-F2A1-11D1-8455-00A0C91F3880} in W7.

Nope, the demos worked just fine for me, Win7 x64, running as either 32-bit or 64-bit scripts. FYI, this CLSID does NOT exist in the registry... so I'm not clear on exactly how it work, but it does.
Posted

  On 3/29/2011 at 5:59 PM, 'Klaatu said:

What is the persistency (if that's a word) of the data? Or should I say of the container? Does it exist only as long as a running script has it open? Until a shutdown? Or does it survive a reboot?

In a quick test, the container exists until it is closed with _Container_Close(), even if you close the initial creating application. I did not test a reboot though... I'm going to assume that won't survive.
Posted

  On 3/29/2011 at 7:51 PM, 'wraithdu said:

In a quick test, the container exists until it is closed with _Container_Close(), even if you close the initial creating application. I did not test a reboot though... I'm going to assume that won't survive.

Container is shell window. Explorer's window. If you add:

$oContainer.Visible = True

... below setting status text to $sName in _Container_Open you will see what I mean.

If the UDF isn't working that's because IE is less than 7 or some other shell is used instead of explorer.exe. Let's ask ptrex what's the case with him?

Btw, UDF is leaking because it never closes created windows. It just losses the reference by setting StatusText property to empty string.

Other than that it's great. Thanks for sharing MrCreatoR.

♡♡♡

.

eMyvnE

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...