Jump to content

InterProcess UDF - Runs a remote function!


JScript
 Share

Recommended Posts

Hello folks,

You can remotely execute a function in another script, spending almost all kinds of variables including arrays (1D only) and receive the results of function calls.

Current functions:

; #CURRENT# =====================================================================================================================
; _IPC_Startup
; _IPC_Shutdown
; _IPC_IsStarted
; _IPC_CallRemote
; ===============================================================================================================================

Example:

Compile and run this first...

#AutoIt3Wrapper_Compression=0                                           ;Compression parameter 0-4  0=Low 2=normal 4=High. Default=2
#AutoIt3Wrapper_UseUpx=n                                                ;(Y/N) Compress output program. Default=Y

#Include <Array.au3>
#Include "InterProcess.au3"

_IPC_Startup()

While 1
    Sleep(100)
WEnd

Then run it and see the result...

#AutoIt3Wrapper_Compression=0                                           ;Compression parameter 0-4  0=Low 2=normal 4=High. Default=2
#AutoIt3Wrapper_UseUpx=n                                                ;(Y/N) Compress output program. Default=Y

#Include <Array.au3>
#Include "InterProcess.au3"

Global $aNewArray
Dim $aArray[10] = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]

_ArrayDisplay($aArray, "$aArray")

If _IPC_IsStarted("script2.exe") Then $aNewArray = _IPC_CallRemote("script2.exe", 5000, "_ArrayUnique", $aArray, 1, 0, 1, "-")

_ArrayDisplay($aNewArray, "$aNewArray represents the 1st Dimension of $aArray")

Make tests and post comments...

Updated code!

Here's a link to the source code:

InterProcess.zip

- This UDF uses MailSlot by @trancexx.

Again, my thanks to @trancexx for the excellent work with Mailslots...

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Make tests and post comments...

Well, the example is not working, so i can't really test it, i don't really understand the concept behind this.

P.S: And the syntax check shows a lot of errors/warnings.

 

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

Well, the example is not working, so i can't really test it, i don't really understand the concept behind this.

P.S: And the syntax check shows a lot of errors/warnings.

Updated, see the first post...

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Can it call Native functions?

It makes no sense to run native functions that way! Since your script is interpreted with an executable that contains all the native functions...

This was designed to use functions that are not part of your script, but other than running.

Edit: Although the example above use #include <Array.au3> in both scripts, but could be another function that was not part of the second script...

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

@ptrex

Thank you! Next step is to implement the use of ByRef parameter and 2d arrays or more...

@ValeryVal

I'm glad you like it!!!

The worst is that I had not tested without compiling... :unsure:

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

  • 1 year later...
  • 4 months later...

You know what really caps off this UDF? Using the JSON UDF on top to send serialized messages and multi-dimensional arrays through to the other application.

Blah, blah, blah... lip service... lip service.Working on a number of projects right now, just waiting for my time to post them here on AutoIt forums.

Link to comment
Share on other sites

  • 3 months later...

You know what really caps off this UDF? Using the JSON UDF on top to send serialized messages and multi-dimensional arrays through to the other application.

So does that mean you have used JSON with this UDF or you think it would improve the UDF?

If you have combined the 2 then post your code (in another thread) it'd be great to see a "complete" (all singing all dancing) Inter-process communications method. :)

Link to comment
Share on other sites

  • 7 months later...

So does that mean you have used JSON with this UDF or you think it would improve the UDF?

If you have combined the 2 then post your code (in another thread) it'd be great to see a "complete" (all singing all dancing) Inter-process communications method. :)

 

JSON UDF would improve on this UDF for the fact that the JSON UDF will serialize quite a bit of information including 2D arrays, thus expanding the capabilities of this UDF greatly. I'll get a working example together, but it's pretty straightforward, use the JSON UDF to serialize and pipe that through IPC, reverse on receiving end.

I would like to point out that while this is acceptable for IPC and multi-threading things, it's not the greatest at these feats, I've switched to MailSlot directly, which this is based on.

Edited by Cynagen

Blah, blah, blah... lip service... lip service.Working on a number of projects right now, just waiting for my time to post them here on AutoIt forums.

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