Jump to content

Container UDF - Scripts interaction library


MrCreatoR
 Share

Recommended Posts

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.zip

Container_UDF.zip

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

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

  • Moderators

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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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!
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

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