themax90 Posted January 30, 2008 Share Posted January 30, 2008 Well I'm trying to get a script a.au3 and b.au3 to communicate via console instead of TCP. Problem is I can't understand the console and stdin stuff. Can someone explain it? Lol - never thought I'd be in a "dumbstuck" situation. Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 30, 2008 Share Posted January 30, 2008 Are the two files a.au3 and b.au3 on the same computer? Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Swift Posted January 30, 2008 Share Posted January 30, 2008 Doubt It if I think what hes asking... Link to comment Share on other sites More sharing options...
themax90 Posted January 30, 2008 Author Share Posted January 30, 2008 Yes. On the same computer. b.au3 is compiled and ran by a.au3. I need to know how I can communicate without using tcp/udp between the scripts. Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 30, 2008 Share Posted January 30, 2008 (edited) Yes. On the same computer. b.au3 is compiled and ran by a.au3.I need to know how I can communicate without using tcp/udp between the scripts.I usually use RegWrite and RegRead and so using the Windows system registry. You can store an almost unlimited number of bits of information there, even binary data.Most kids new to programming might start out using IniWrite and IniRead, perhaps because it is a little easier, you don't need to know the language of the Windows registry, and the file involved is a very small and simple .ini file you might store in the same folder with your script.Another way to go is to use the FileWrite and FileRead functions, etc., and this is just a little more involved. But with these, you can pass very large volumes of information between applications.Then there is the $CmdLine array you can read about in the AutoIt help file go to:AutoIt help file > AutoIt > Using AutoIt > Comman Line ParametersAnd lastly, you can read there about StdoutRead and StdErrRead Edited January 30, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
themax90 Posted January 30, 2008 Author Share Posted January 30, 2008 I usually use RegWrite and RegRead and so using the Windows system registry. You can store an almost unlimited number of bits of information there, even binary data.Most kids new to programming might start out using IniWrite and IniRead, perhaps because it is a little easier, you don't need to know the language of the Windows registry, and the file involved is a very small and simple .ini file you might store in the same folder with your script.Another way to go is to use the FileWrite and FileRead functions, etc., and this is just a little more involved. But with these, you can pass very large volumes of information between applications.Then there is the $CmdLine array you can read about in the AutoIt help file go to:AutoIt help file > AutoIt > Using AutoIt > Comman Line ParametersAnd lastly, you can read there about StdoutRead and StdErrReadWow. That is extremely inefficient and slow - not to meantion just plain weird especially when I will be sending mainly single characters. I need COMMUNICATION between the two scripts. Not saving information.I need someone a little bit more experienced to help. Link to comment Share on other sites More sharing options...
BrettF Posted January 30, 2008 Share Posted January 30, 2008 Wow. That is extremely inefficient and slow - not to meantion just plain weird especially when I will be sending mainly single characters. I need COMMUNICATION between the two scripts. Not saving information.I need someone a little bit more experienced to help.What about having a hidden window of the script that needs to access the data containg an edit control? A simple Control Send from the other script would be your easiest bet. Gimme 10 for an example... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 30, 2008 Share Posted January 30, 2008 (edited) Wow. That is extremely inefficient and slow - not to meantion just plain weird especially when I will be sending mainly single characters. I need COMMUNICATION between the two scripts. Not saving information.I need someone a little bit more experienced to help.These are the only ways we have which at all native to the compilable scripting language AutoIt - perhaps you usually write programs in C++ or VB.There is EnvSet and EnvGet for in the case that one script is a "child process" of the other.There is at least one other way, but I forget what that is just now.Edit 1:With Bert's mention, that makes it to be at least two other ways, one of them being found here:AutoIt help file > AutoIt > Function Reference > Window Management > Controls Edited January 30, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
BrettF Posted January 30, 2008 Share Posted January 30, 2008 (edited) How's this go??Could have a lot more done to refine... Oh well!Save and compile all of the scripts into the same folder. To start, run Receive.exe then send.exe. To exit, close receive.eceConsole.au3;Script 1 $GUI = GUICreate ("App Name- Hidden Window", 200, 200) $edit = GUICtrlCreateEdit ("", 0, 0, 200, 200) GUISetState (@SW_SHOW) While 1 Sleep (10) WEndSend.au3; Script 2 (Sends data to console) Dim $arr[6] = ["@ComputerName = " & @ComputerName, "@IPAddress1 = " & @IPAddress1, "@OSBuild = " & @OSBuild, "@OSLang = " & @OSLang, "@OSTYPE = " & @OSTYPE] While 1 If Not ProcessExists ("console.exe") Then Run ("console.exe") WinWait ("App Name- Hidden Window") $data = $arr[Random (0, 5)] ControlSend ("App Name- Hidden Window", "", "[CLASSNN:Edit1]", $data & "<[]>" & @LF) WEndRecieve.au3; Receive.au3 Dim $last #Include <GuiEdit.au3> $gui = GUICreate ("App Name", 500, 300) $edit = GUICtrlCreateEdit ("", 0, 0, 500, 300) GUISetState (@SW_SHOW) While 1 If GUIGetMsg () = -3 Then CloseScript () If Not WinExists ("App Name- Hidden Window") Then ; Do Nothing Else $controltext = ControlGetText ("App Name- Hidden Window", "", "[CLASSNN:Edit1]") $split = StringSplit ($controltext, "<[]>") $text = $split[$split[0] -1] If $text <> $Last And $text <> "" Then GUIWrite ($text) $last = $text EndIf EndIf WEnd Func GUIWrite ($text) _GUICtrlEdit_AppendText ($edit, $text & @LF) EndFunc Func CloseScript () ProcessClose ("console.exe") ProcessClose ("send.exe") Exit EndFunc Edited January 30, 2008 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted January 30, 2008 Share Posted January 30, 2008 With Env Vars.Compile, and run send.exe first. Send.au3#include <GUIConstants.au3> Run ("Recv.exe") Dim $arr[6] = ["@ComputerName = " & @ComputerName, "@IPAddress1 = " & @IPAddress1, "@OSBuild = " & @OSBuild, "@OSLang = " & @OSLang, "@OSTYPE = " & @OSTYPE] $Form1 = GUICreate("Send.au3", 179, 80, 193, 125) $Button1 = GUICtrlCreateButton("Get EnvVar1", 16, 16, 147, 25, 0) $Button2 = GUICtrlCreateButton("Set EnvVar1", 16, 43, 147, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE CloseScript () Case $Button1 _GetVar ("[!EnvVar1!]") Case $button2 EnvSet ("[!EnvVar1!]", $arr[Random (0, 5)]) EndSwitch WEnd Func _GetVar ($var) $res = EnvGet($var) MsgBox(4096, $var & " is:", $res) EndFunc Func CloseScript () ProcessClose ("send.exe") Exit EndFuncRecv.au3#include <GUIConstants.au3> Dim $arr[6] = ["@ComputerName = " & @ComputerName, "@IPAddress1 = " & @IPAddress1, "@OSBuild = " & @OSBuild, "@OSLang = " & @OSLang, "@OSTYPE = " & @OSTYPE] $Form1 = GUICreate("Recv.au3", 179, 80, 193, 125) $Button1 = GUICtrlCreateButton("Get EnvVar1", 16, 16, 147, 25, 0) $Button2 = GUICtrlCreateButton("Set EnvVar1", 16, 43, 147, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE CloseScript () Case $Button1 _GetVar ("[!EnvVar1!]") Case $button2 EnvSet ("[!EnvVar1!]", $arr[Random (0, 5)]) EndSwitch WEnd Func _GetVar ($var) $res = EnvGet($var) MsgBox(4096, $var & " is:", $res) EndFunc Func CloseScript () ProcessClose ("send.exe") Exit EndFunc Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
themax90 Posted January 30, 2008 Author Share Posted January 30, 2008 @Bert Thx I'll fiddle around with this. Might be exactly what I need. The point in my direction. @Squirel. All of those options (and I was being nice before) are utterly STUPID as a means of communications. No offense but it's not I was looking for - quit posting. Thx. Link to comment Share on other sites More sharing options...
BrettF Posted January 30, 2008 Share Posted January 30, 2008 @Bert Thx I'll fiddle around with this. Might be exactly what I need. The point in my direction.@Squirel. All of those options (and I was being nice before) are utterly STUPID as a means of communications. No offense but it's not I was looking for - quit posting. Thx.Thats ok. I was learning too @Squirel- I agree with Smithy... Quite while your ahead, or to quote your Valik Cannon, before you start to do this:Yet he continued to defend his flawed views until such time as every point he tried to make was blown away by multiple people. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 30, 2008 Share Posted January 30, 2008 (edited) Okay, now I know where you guys are coming from - you both are somewhat conspicuously refraining from dis-inviting me to address communications in society these days, in a more general way. I'll bite. On commnications: Chapter 1, "@ Terrestrial Aliens" My species is not innately or considerably lacking in intuition, imagination or intelligence, just like your expert epistemologists and socialogists concluded. Chapter 2, "@ Terrestrial Native Species" You deserve the governors God places over you, and you get the government you deserve. Knowledge is power. Don't be so powerless. Chapter 3, "@ Everyone" I still feel bad about so many young people going to libraries both school libraries and public ones, only to find only mostly useless books, and waste their time with so many useless pieces of literature, and so waste their whole lives, living surrounded by so much engineered misunderstanding. Edited January 30, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
BrettF Posted January 30, 2008 Share Posted January 30, 2008 You lost me there... Libriaries? Valik Cannon 4 That last post you made in response to mine doesn't convey "I get it now" to me. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 30, 2008 Share Posted January 30, 2008 (edited) @Bert: I get it now. I have studied philosophy more than I have programming, so I hope you guys can forgive me a few transgressions I mean digressions when things aren't going so well for me - either with my social/political station or with my scripting. Open response to Swift: No ... the Hayley Mills avatar on every one of my posts is a picture of a British actress who can't natively speak any of Isabella's proper Spanish at all, as she appeared in the B & W 1959 American movie called "Tiger Bay". Hayley Mills is the head angel - a lot prettier than LocoDarwin's avatar, which is closer to what I really look like. Edited January 31, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
McGod Posted January 30, 2008 Share Posted January 30, 2008 Try the Script Communication in my sig. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
themax90 Posted January 30, 2008 Author Share Posted January 30, 2008 Try the Script Communication in my sig.OMG Thx so much! Exactly what I need!~ Link to comment Share on other sites More sharing options...
seandisanti Posted January 30, 2008 Share Posted January 30, 2008 @Bert Thx I'll fiddle around with this. Might be exactly what I need. The point in my direction.@Squirel. All of those options (and I was being nice before) are utterly STUPID as a means of communications. No offense but it's not I was looking for - quit posting. Thx.Alright, I get that he was suggesting ideas that you didn't want to utilize, though they would actually do what you were asking for (asking for without providing any code even), and i will even agree that his response to this same post lost me a bit, but i really don't see why you're being so harsh as to call his help stupid. Way to encourage people to try to help others or give ideas when the OP hasn't said what he's tried already, dick. -No offense Link to comment Share on other sites More sharing options...
themax90 Posted January 31, 2008 Author Share Posted January 31, 2008 (edited) Alright, I get that he was suggesting ideas that you didn't want to utilize, though they would actually do what you were asking for (asking for without providing any code even), and i will even agree that his response to this same post lost me a bit, but i really don't see why you're being so harsh as to call his help stupid. Way to encourage people to try to help others or give ideas when the OP hasn't said what he's tried already, dick. -No offenseI'm going to take BIG offense at that. I asked for COMMUNICATION not passing data. Those ideas are criminally inefficient, don't accomplish the task without massive amounts of scripting, aren't flexible, or plug-n-play. Spotlight is about plug and play. Using Inis - Files - etc are not. Dick - offense meant. Edited January 31, 2008 by AutoIt Smith Link to comment Share on other sites More sharing options...
BrettF Posted January 31, 2008 Share Posted January 31, 2008 I'm going to take BIG offense at that. I asked for COMMUNICATION not passing data. Those ideas are criminally inefficient, don't accomplish the task without massive amounts of scripting, aren't flexible, or plug-n-play. Spotlight is about plug and play. Using Inis - Files - etc are not. Dick - offense meant.Hahahahaha... LOL! @Chip- Thanks! I'm taking a look at that when my Physics homework, chemistry, maths and enlish homework is done! Yay! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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