HCand Posted January 26, 2008 Share Posted January 26, 2008 i've been looking a bit into the helpfiles and posts at the forum, and couldn't really find anything about this, so i'll ask.. is it possible to share variables and arrays between running scripts? could that have anything to do with child processes? because i want it to be one program running more than one time, sharing the necessary variables, so i can get past the fact that autoit will slow down when it handles greater mengths of data. i'm still planning, so i dont have any actual code to show. but i hope you can help Link to comment Share on other sites More sharing options...
Aceguy Posted January 26, 2008 Share Posted January 26, 2008 im not sure is i can be read from the memory from one app to another. so why dont you save the array to an ini file. then use other app to _FileReadToArray [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
HCand Posted January 26, 2008 Author Share Posted January 26, 2008 im not sure is i can be read from the memory from one app to another.so why dont you save the array to an ini file.then use other app to _FileReadToArraywell.. i wanted to be able to transfer the variables without putting anything through the harddisk, as it may wear it out in time.but i'll look into that, thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted January 26, 2008 Developers Share Posted January 26, 2008 (edited) You could use WM_COPYDATA with SendMessage to send information between the applications. Pretty sure somebody posted some UDF for this in the Examples forum. Its is also possible to use a hidden GUI with a number of controls that you modify in the other program using the control functions. Jos Edited January 26, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Aceguy Posted January 26, 2008 Share Posted January 26, 2008 try Clipput() and clipget() writes to the clipbaord [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
HCand Posted January 26, 2008 Author Share Posted January 26, 2008 You could use WM_COPYDATA with SendMessage to send information between the applications. Pretty sure somebody posted some UDF for this in the Examples forum.Its is also possible to use a hidden GUI with a number of controls that you modify in the other program using the control functions.Josthanks.. gonna check up on those commands and the UDF. Link to comment Share on other sites More sharing options...
erezlevi Posted January 26, 2008 Share Posted January 26, 2008 try Clipput() and clipget() writes to the clipbaordyes, but clipput and clipget, when to go to the clipboard exactly? he needs a trigger! use windows messages, it is the best solution for moving data between scripts. you will need both scripts to allways be in listening mode : guiregistermsg... if you only want something simple use the clipboard and use something like send ("{ctrl e}")and in the other script use HotKeySet to get it. but here you will need a loop again.the best solution were if JON will insert Object registaring to windows, then we were all happy. Link to comment Share on other sites More sharing options...
martin Posted January 26, 2008 Share Posted January 26, 2008 i've been looking a bit into the helpfiles and posts at the forum, and couldn't really find anything about this, so i'll ask..is it possible to share variables and arrays between running scripts?could that have anything to do with child processes? because i want it to be one program running more than one time, sharing the necessary variables,so i can get past the fact that autoit will slow down when it handles greater mengths of data.i'm still planning, so i dont have any actual code to show. but i hope you can help There are various ways The fastest way to transfer data to another program is using messageas and reading memory.Here is one example to look at. NOte that one line in each script needs to have comments removed if using the latest AutoIt Beta. 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 More sharing options...
Squirrely1 Posted January 26, 2008 Share Posted January 26, 2008 (edited) This method didn't interfere with the user's clipboard. I needed a way to get a string of over 300 bytes including @CR characters to another script. I thought at first I would have to convert the string to binary format, but that method didn't work for me. In the data producing script I just put the string in a REG_SZ registry value: RegWrite("HKEY_CURRENT_USER\Software\SquirrelWare\WeatherTray", "WeatherData", "REG_SZ", $_Return_Value) And in the script that needs to receive the data I put this: $reg_read = RegRead("HKEY_CURRENT_USER\Software\SquirrelWare\WeatherTray", "WeatherData") I would sure like to know what the maximum size of data I can transfer this way, and what characters can not be used. I think that much of the registry resides in memory but that what is there is eventually written to disk, as at logoff or shutdown. My machine uses a great big pagefile anyway since I only have 384 MB's of memory. But in my experience, the registry can be written to and read from more quickly and reliably than a .ini file, and using the registry you won't need elaborate bloated code. An easy way to pass $myArray if it isn't too big: #include <Array.au3> $myArrString = _ArrayToString($myArray, "|") RegWrite($myRegistryKey, $myRegValuename, "REG_SZ", $myArrString) And in the receiving script you would have this: $reg_read = RegRead($myRegistryKey, $myRegValuename) Sleep(140) $myArray = StringSplit($reg_read, "|") _ArrayDelete($myArray, 0) Your array should now be in $myArray in the receiving script. If your array contains pipe characters - "|" - choose a different delimiter. Edited January 26, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
HCand Posted January 26, 2008 Author Share Posted January 26, 2008 There are various ways The fastest way to transfer data to another program is using messageas and reading memory.Here is one example to look at. NOte that one line in each script needs to have comments removed if using the latest AutoIt Beta.i wanted to see the script (edited first post) working, and then read the code. but it replies with an error when i start send.au3Line -1: Error: can not redeclare a constantshould i use the one you originally posted instead? Link to comment Share on other sites More sharing options...
martin Posted January 26, 2008 Share Posted January 26, 2008 (edited) i wanted to see the script (edited first post) working, and then read the code. but it replies with an error when i start send.au3Line -1: Error: can not redeclare a constantshould i use the one you originally posted instead?If the const which is being redeclared is the one I commented out then just replace the comment. It depends on the version of AutoIt you are using, the predefined constants are changed with each release (some added some removed) .In general if a Const is defined in a script and you get the error that it's already defined then just remove the declaration from your script.Edit: I think that if you had the error Line -1 then you have compiled the script. If so then you don't need to do that. Just run the sender script from Scite if you use it. Edited January 26, 2008 by martin 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now