JohnBailey Posted August 28, 2007 Share Posted August 28, 2007 (edited) This is very much a "work in progress" (as with most every example script, but especially this one). If anyone has suggestions, PLEASE let me know. Tear it apart please. Thanks to Martin and PicassoUDFexpandcollapse popup#include-once #include <Misc.au3> ;=============================================================================== ; Name: _AU3COM_SendData() ; ; Description: ; ; Parameter(s): ; ; ; ; Return Value(s): On Success - ; On Failure - Returns zero and sets error ; @Error - 0 The array to hold the string could not be created ; ; Note(s): ; ; Author(s): martin (http://www.autoitscript.com/forum/index.php?showtopic=50110&view=findpost&p=389386) ; ;=============================================================================== Func _AU3COM_SendData($acsd_InfotoSend, $acsd_RecvWinTitle) Local $StructDef_COPYDATA = "dword var1;dword var2;ptr var3";I have changed piccaso's structure Local $CDString = DllStructCreate("char var1[256];char var2[256]");the array to hold the string we are sending If @error Then SetError(0,@error,0) DllStructSetData($CDString,1,$acsd_InfotoSend) Local $pCDString = DllStructGetPtr($CDString);the pointer to the string If @error Then SetError(1,@error,0) Local $vs_cds = DllStructCreate($StructDef_COPYDATA);create the message struct If @error Then SetError(2,@error,0) DllStructSetData($vs_cds,"var1",0);0 here indicates to the receiving program that we are sending a string If @error Then SetError(3,@error,0) DllStructSetData($vs_cds,"var2",String(StringLen($acsd_InfotoSend) + 1));tell the receiver the length of the string If @error Then SetError(4,@error,0) DllStructSetData($vs_cds,"var3",$pCDString);the pointer to the string If @error Then SetError(5,@error,0) Local $pStruct = DllStructGetPtr($vs_cds) If @error Then SetError(6,@error,0) _SendMessage(WinGetHandle($acsd_RecvWinTitle),$WM_COPYDATA,0,$pStruct) $vs_cds = 0;free the struct $CDString = 0;free the struct Return 1 EndFunc ;=============================================================================== ; Name: _AU3COM_RecvData() ; ; Description: ; ; Parameter(s): ; ; ; ; Return Value(s): On Success - ; On Failure - Returns zero and sets error ; @Error - 0 The array to hold the string could not be created ; ; Note(s): ; ; Author(s): piccaso http://www.autoitscript.com/forum/index.php?showtopic=22598&hl= ; ;=============================================================================== Func _AU3COM_RecvData($acomrd_LParam) ; $acomrd_LParam = Poiter to a COPYDATA Struct Local $STRUCTDEF_AU3MESSAGE = "char var1[256];int" Local $StructDef_COPYDATA = "dword var1;dword var2;ptr var3" Local $vs_cds = DllStructCreate($StructDef_COPYDATA, $acomrd_LParam) ; Member No. 3 of COPYDATA Struct (PVOID lpData;) = Pointer to Costum Struct Local $vs_msg = DllStructCreate($STRUCTDEF_AU3MESSAGE, DllStructGetData($vs_cds, 3)) Return $vs_msg EndFuncoÝ÷ Ù´^qè¯z¿Ûjëh×6;original by piccaso http://www.autoitscript.com/forum/index.php?showtopic=22598&hl= Global $Delimiters = '' #include <GUIConstants.au3> #include <GuiEdit.au3> #include "COMAU3.au3" ; Windows Definitions Global Const $WM_COPYDATA = 0x4A Global Const $WM_CLOSE = 0x10 #Region ### START Koda GUI section ### Form=I:\SAI\Auto-It files\GUI Designs\COM Receiver.kxf $ParentWin = GUICreate("COM Receiver", 479, 440, 267, 159) $Button1 = GUICtrlCreateButton("Open Sender", 376, 16, 85, 25, 0) $StatusAreaED = GUICtrlCreateEdit("", 13, 161, 446, 265, -1, $WS_EX_STATICEDGE) $Label1 = GUICtrlCreateLabel("StatusArea", 13, 143, 56, 17) $Group1 = GUICtrlCreateGroup("", 15, 11, 226, 53) $Radio1 = GUICtrlCreateRadio("Radio", 30, 32, 63, 17) $Radio2 = GUICtrlCreateRadio("Radio", 97, 32, 63, 17) $Radio3 = GUICtrlCreateRadio("Radio", 167, 32, 63, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ; Register Windows Messages GUIRegisterMsg($WM_COPYDATA, "_GUIRegisterMsgProc") GUIRegisterMsg($WM_CLOSE, "_GUIRegisterMsgProc") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; Message Handler Func _GUIRegisterMsgProc($hWnd, $MsgID, $WParam, $LParam) If $MsgID = $WM_COPYDATA Then ;=== We Recived a WM_COPYDATA Message ; $LParam = Poiter to a COPYDATA Struct ;Local $STRUCTDEF_AU3MESSAGE = "char var1[256];int" ;Local $StructDef_COPYDATA = "dword var1;dword var2;ptr var3" ;Local $vs_cds = DllStructCreate($StructDef_COPYDATA, $LParam) ; Member No. 3 of COPYDATA Struct (PVOID lpData;) = Pointer to Costum Struct ;Local $vs_msg = DllStructCreate($STRUCTDEF_AU3MESSAGE, DllStructGetData($vs_cds, 3)) Local $vs_msg = _AU3COM_RecvData($LParam) ; Display what we have recived ;MsgBox(0, "Recver - Test String", DllStructGetData($vs_msg, 1)) ;MsgBox(0, "Recver - Test Integer", DllStructGetData($vs_msg, 2)) Local $MSGRECVD = DllStructGetData($vs_msg, 1) Local $MSGRECVD_SplitArray = StringSplit($MSGRECVD,$Delimiters,1) If $MSGRECVD_SplitArray[1] = 'AU3COM' Then If $MSGRECVD_SplitArray[2] = 'StatusArea' Then GUICtrlSetData($StatusAreaED, GUICtrlRead($StatusAreaED) & @CRLF & $MSGRECVD_SplitArray[3]) _GUICtrlEditLineScroll ($StatusAreaED, 0, _GUICtrlEditGetLineCount ($StatusAreaED)) ElseIf $MSGRECVD_SplitArray[2] = 'Radio' Then If $MSGRECVD_SplitArray[3] = 1 Then GUICtrlSetState($Radio1,$GUI_CHECKED) EndIf EndIf EndIf ElseIf $MsgID = $WM_CLOSE Then ;=== We Recived a WM_CLOSE Message Exit EndIf EndFunc ;==>_GUIRegisterMsgProcFurther props to PsaltyDS and Sandman for guiding me to this information.grr for editing messing up your post! Mods, can this get fixed? Edited August 28, 2007 by JohnBailey A decision is a powerful thing Link to comment Share on other sites More sharing options...
KJohn Posted August 28, 2007 Share Posted August 28, 2007 (edited) This is very much a "work in progress" (as with most every example script, but especially this one). If anyone has suggestions, PLEASE let me know. Tear it apart please. Thanks to Martin and Piccaso<SOME CODE IN BETWEEN>Further props to PsaltyDS and Sandman for guiding me to this information.I'm not much of a COM guy... maybe that's why... but what's this supposed to do??Edit: to match edited first post... Edited August 28, 2007 by Koshy John Link to comment Share on other sites More sharing options...
JohnBailey Posted August 28, 2007 Author Share Posted August 28, 2007 (edited) I'm not much of a COM guy... maybe that's why... but what's this supposed to do??I don't know the terms too well, so bear with me. It's a COM-of-sorts. Furthermore, what you quoted was a mess up of my original posting. For some reason when I edit a post it screws up my post pertaining the autoit script and such. I've fixed it now.Just wanting to contribute to everything. Edited August 28, 2007 by JohnBailey A decision is a powerful thing Link to comment Share on other sites More sharing options...
KJohn Posted August 28, 2007 Share Posted August 28, 2007 I don't know the terms too well, so bear with me. It's a COM-of-sorts. Furthermore, what you quoted was a mess up of my original posting. For some reason when I edit a post it screws up my post pertaining the autoit script and such. I've fixed it now.Just wanting to contribute to everything.Not my place to be till I'm more well versed in COM then... btw, edited my post once I understood what you meant... all the best with this.. Link to comment Share on other sites More sharing options...
JohnBailey Posted August 28, 2007 Author Share Posted August 28, 2007 Not my place to be till I'm more well versed in COM then... btw, edited my post once I understood what you meant... all the best with this..hahaha about the edit yeah, thanks. I hope I can get more input. It does what I need it to do, but I'm SURE it can be better and maybe the thread title needs to be redone. That's up to the mods and others. I thought this was a pseudo-COM. I know it's not really a COM, but I'm calling it that because that's what I thought it was most like. Totally up for renaming the title though!! Thanks KJ A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted August 28, 2007 Author Share Posted August 28, 2007 Ok, gang after re-reading http://en.wikipedia.org/wiki/Component_object_model, I think it is a good idea to rename this threads title I just don't know what it should be called.Something like "Params Sending to Open AU3 Scripts." haha I don't know obviously. I went with "COM" because I was generally just referring to the function of COM not the literal definition of it, which I see now is confusing! Any suggestions? A decision is a powerful thing Link to comment Share on other sites More sharing options...
Developers Jos Posted August 28, 2007 Developers Share Posted August 28, 2007 This script is really a form of data interchange between applications using Windows Messages. This same meganism is used by the SciTE Director interface to have external programs "communicate" to SciTE. 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...
JohnBailey Posted August 28, 2007 Author Share Posted August 28, 2007 (edited) This script is really a form of data interchange between applications using Windows Messages.This same meganism is used by the SciTE Director interface to have external programs "communicate" to SciTE.Thank you for the explanation!!!! That's awesome! So, what should I retitle this to?haha I don't think I can retitle it. JdeB, since you're a mod you're MORE than welcome to change my insanity. Edited August 28, 2007 by JohnBailey A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted August 28, 2007 Author Share Posted August 28, 2007 JdeB, thanks for changing the title!!! looks great and makes total sense. A decision is a powerful thing Link to comment Share on other sites More sharing options...
martin Posted August 28, 2007 Share Posted August 28, 2007 This is very much a "work in progress" (as with most every example script, but especially this one). If anyone has suggestions, PLEASE let me know. Tear it apart please. Thanks to Martin and Picasso UDF expandcollapse popup#include-once #include <Misc.au3> ;=============================================================================== ; Name: _AU3COM_SendData() ; ; Description: ; ; Parameter(s): ; ; ; ; Return Value(s): On Success - ; On Failure - Returns zero and sets error ; @Error - 0 The array to hold the string could not be created ; ; Note(s): ; ; Author(s): martin (http://www.autoitscript.com/forum/index.php?showtopic=50110&view=findpost&p=389386) ; ;=============================================================================== Func _AU3COM_SendData($acsd_InfotoSend, $acsd_RecvWinTitle) Local $StructDef_COPYDATA = "dword var1;dword var2;ptr var3";I have changed piccaso's structure Local $CDString = DllStructCreate("char var1[256];char var2[256]");the array to hold the string we are sending If @error Then SetError(0,@error,0) DllStructSetData($CDString,1,$acsd_InfotoSend) Local $pCDString = DllStructGetPtr($CDString);the pointer to the string If @error Then SetError(1,@error,0) Local $vs_cds = DllStructCreate($StructDef_COPYDATA);create the message struct If @error Then SetError(2,@error,0) DllStructSetData($vs_cds,"var1",0);0 here indicates to the receiving program that we are sending a string If @error Then SetError(3,@error,0) DllStructSetData($vs_cds,"var2",String(StringLen($acsd_InfotoSend) + 1));tell the receiver the length of the string If @error Then SetError(4,@error,0) DllStructSetData($vs_cds,"var3",$pCDString);the pointer to the string If @error Then SetError(5,@error,0) Local $pStruct = DllStructGetPtr($vs_cds) If @error Then SetError(6,@error,0) _SendMessage(WinGetHandle($acsd_RecvWinTitle),$WM_COPYDATA,0,$pStruct) $vs_cds = 0;free the struct $CDString = 0;free the struct Return 1 EndFunc ;=============================================================================== What is the second character array for here? It doesn't look like it's used. Local $CDString = DllStructCreate("char var1[256];char var2[256]"); There should be some check made to ensure that the string to send is not longer than 255 characters.(You can probably blame me for that) Maybe have DllStructSetData($CDString,1,StringLeft($acsd_InfotoSend,255)) If you plan to make some sort of UDF for passing information between programs then maybe this could be of interest. 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...
JohnBailey Posted August 28, 2007 Author Share Posted August 28, 2007 What is the second character array for here? It doesn't look like it's used. Local $CDString = DllStructCreate("char var1[256];char var2[256]"); It is apart of the array as far as I know. I had to tweak things to get it to work between your's and Picasso's script. Basically, I'm not totally sure how to explain it . I can work on explaining it though. I'm sure you'll know a lot more than I can in this. There should be some check made to ensure that the string to send is not longer than 255 characters.(You can probably blame me for that) Maybe have DllStructSetData($CDString,1,StringLeft($acsd_InfotoSend,255)) ok, I will do that. Why by the way? If you plan to make some sort of UDF for passing information between programs then maybe this could be of interest.Thanks ! There's tons in there that I should put into this. All in all, I better get started. THANKS! A decision is a powerful thing Link to comment Share on other sites More sharing options...
martin Posted August 28, 2007 Share Posted August 28, 2007 There should be some check made to ensure that the string to send is not longer than 255 characters.(You can probably blame me for that) Maybe have DllStructSetData($CDString,1,StringLeft($acsd_InfotoSend,255)) ok, I will do that. Why by the way? If you create a struct $Struct1 = DllCreateStruct(char[256]) then you are reserving 256 bytes of memory. If you then have DllStructSetData($struct1,$string) and $string is longer than 255 characters then either you will write into an area of memory not reserverved for that element, or Autoit is clever enough to prevent that. (I can't try it at the moment.) But it is best to get it right. I am assuming a string is stored as characters + CHR(0) to indicate the end of the string, so a string of length 255 characters takes 256 bytes. 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...
JohnBailey Posted August 28, 2007 Author Share Posted August 28, 2007 If you create a struct $Struct1 = DllCreateStruct(char[256]) then you are reserving 256 bytes of memory. If you then have DllStructSetData($struct1,$string) and $string is longer than 255 characters then either you will write into an area of memory not reserverved for that element, or Autoit is clever enough to prevent that. (I can't try it at the moment.) But it is best to get it right. I am assuming a string is stored as characters + CHR(0) to indicate the end of the string, so a string of length 255 characters takes 256 bytes. OH!! :"> thanks for the explanation! A decision is a powerful thing Link to comment Share on other sites More sharing options...
Zedna Posted August 28, 2007 Share Posted August 28, 2007 Nice!! Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
martin Posted August 29, 2007 Share Posted August 29, 2007 (edited) Here is a better version of the example of sending data from one program to another.It uses nomadmemory.au3.====================================================================================Updated 15th Sept 2008 for latest production versionUpdated 5th Sept 2007 add faster transfer of 2 extra variables started with the Count Up button.The integer and string in the edit boxes of the sender can still be changed while the count is in progress.You should be able to run this and it will start up the listener script, if not then either you need to edit the line beginning Run on line 42 or comment out the line, compile and run, then run the receiver script.The receiver script (listener) can be stopped and run again at any time and it will be linked to the sender/talker. When it's not running the sender script still works the same. If the talker closes then the listener closes.I have made the sender run the receiver just to make it easier to test.=========================================================expandcollapse popup#include <GUIConstants.au3> ;use with rcv001.au3 #include <GUIConstants.au3> #include <misc.au3> #Include <sendmessage.au3> ;if using AUtoIt 3.2.11.0 remove comment on next line ;#include <sendMessage.au3> Const $innerloop = 4, $outerloop = 5 #Region ### START Koda GUI section ### $Form1 = GUICreate("talker", 192, 366, 20, 200) $Input1 = GUICtrlCreateInput("0", 32, 48, 121, 21) $Input2 = GUICtrlCreateInput("text", 32, 112, 121, 21) $Label1 = GUICtrlCreateLabel("Integer to send", 32, 24, 75, 17) $Label2 = GUICtrlCreateLabel("String to send", 32, 88, 69, 17) $Label4 = GUICtrlCreateLabel("Update Number", 40, 160, 79, 17) $Label3 = GUICtrlCreateLabel("0", 40, 176, 120, 17) $Label5 = GUICtrlCreateLabel("Red = data sent", 40, 200, 75, 17) $Label6 = GUICtrlCreateLabel("Green = acknowledged", 40, 216, 150, 17) $Label7 = GUICtrlCreateLabel("memory starts at", 32, 296, 80, 17) $Label8 = GUICtrlCreateLabel("0x0", 32, 320, 69, 17) $ll = GUICtrlCreateLabel("",32,340,80,17) $but1 = GUICtrlCreateButton('Count up',20,250,70,28) $butstop = GUICtrlCreateButton('Stop Count',100,250,70,28) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GLOBAL $UpDateNo = 0, $Ack = 0, $lastip2 = "", $lastip1 = 0, $labelIsGreen = false, $last = '' $Astruct = DllStructCreate("int;int;int;int;int;int;char[256]") ; w/r means the talker writes the receiver reads ;~ int update numer- increments to indicate new data = w/r ;~ int update last read by receiver = r/w ;~ int integer 1 = w/r ;~ int integer 2 for length of str1 = w/r ;~ str string1 = w/r $Address = DllStructGetPtr($Astruct) GUICtrlSetData($label8,Hex($Address)) GUICtrlSetData($ll,$Address) ;link() $linked = False Run( '"' & @ProgramFilesDir &'\AutoIt3\Beta\AutoIt3.exe" rcv001.au3') While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $but1 $stop = 0 For $n=1 To 100 If $stop = 1 Then ExitLoop For $p = 1 To 200 $msg = GUIGetMsg() If $msg = $butstop Then $stop = 1 If $msg = -3 Then Exit writesharedint($innerloop,$p) writesharedint($outerloop,$n) Sleep(10) If $stop = 1 Or Not WinExists("listener") Then ExitLoop Next Next ConsoleWrite('done loops' & @CRLF) EndSwitch If Not $linked Then link() WEnd Func transmit() If Not WinExists("listener") Then $linked = False ;AdlibDisable() ;link() Return;Exit Else If Not $linked Then link() $linked = True EndIf EndIf $change = False ;doesn't actually transmit anything, just writes the values in the sctruct so listener can read them $ip2 = GUICtrlRead($Input2);integer $ip1 = StringLeft(guictrlread($Input1),255);string If $ip2 <> $lastip2 or $lastip1 <> $ip1 Then $UpDateNo += 1 If $UpDateNo > 1000 Then $UpDateNo = 1 DllStructSetData($Astruct, 1, $UpDateNo);the update nu,ber to send DllStructSetData($Astruct, 3, $ip1);the integer to send DllStructSetData($Astruct, 6, StringLen($ip2));length of the string to send DllStructSetData($Astruct, 7, String($ip2));the string to send $lastip1 = $ip1 $lastip2 = $ip2 EndIf $state = DllStructGetData($Astruct, 2);the last update read by receiver if GUICtrlRead($label3) <> $state then GUICtrlSetData($Label3, $state) If $state <> $UpDateNo Then GUICtrlSetBkColor($Label3, 0xff0000) $labelIsGreen = False Else if not $labelIsGreen Then GUICtrlSetBkColor($Label3, 0x00ff00) $labelIsGreen = True EndIf EndIf EndFunc;==>transmit Func writesharedint($intnum,$intval) DllStructSetData($Astruct,$intnum, $intval) EndFunc Func readsharedint($intnum) Return DllStructGetData($Astruct,$intnum) EndFunc Func link() If Not WinExists("listener") Then If $linked Then AdlibDisable() $linked = False Return EndIf SplashTextOn("waiting for receiver to start", '', 200, 20, 20, 250);, 200, 20, 20, 250) WinWait("listener", "") Sleep(200); if message sent too soon it's not received SplashOff() _SendMessage(WinGetHandle("listener"), 2000, $Address, $Address, 0, "ptr", "ptr") AdlibEnable("transmit", 100) $linked = True EndFunc;==>linkThe receiver script, save it as rcv001.au3 or the talker script won't be able to run it.expandcollapse popup#include <GUIConstants.au3> #include <nomadmemory.au3> #include <editconstants.au3> ;if using AutoIt 3.2.11.0 remove comment on next line ;Const $ES_READONLY = 0x0800 #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("listener", 170, 240, 240, 200) $Label4 = GUICtrlCreateLabel("Number rec'd", 20, 25, 87, 17) $Label1 = GUICtrlCreateInput("",20, 45, 121, 21,$ES_READONLY) GUICtrlSetBkColor(-1,0xffffff) $Label5 = GUICtrlCreateLabel("String rec'd", 20, 75, 187, 17) $Label2 = GUICtrlCreateInput("",20, 90, 121, 21,$ES_READONLY) GUICtrlSetBkColor(-1,0xffffff) $Labelil = GUICtrlCreateInput("",20, 120, 121, 21,$ES_READONLY) $Labelol = GUICtrlCreateInput("",20, 150, 121, 21,$ES_READONLY) $Label3 = GUICtrlCreateLabel("mem", 20, 190, 86, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $update = 0, $lastupdate = -1, $pid = WinGetProcess("talker") Global $MemOpen = _MemoryOpen ($pid), $memadd = 0 AdlibEnable("update", 100) GUIRegisterMsg(2000, "getaddr") ;$d1 = DllStructCreate("int") ;MsgBox(0,'',DllStructGetPtr($d1)) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If Not WinExists("talker") Then Exit WEnd _memoryclose ($pid) Func getaddr($hWndGUI, $MsgID, $WParam, $LParam) If $MsgID = 2000 Then $memadd = $WParam guictrlsetdata($label3,$memadd) ;DllStructCreate("int",Number($memadd)) WinActivate("talker") EndIf EndFunc;==>getaddr Func update() If $memadd = 0 Then Return $update = _MemoryRead ($memadd, $MemOpen, "int") ;read fast variables regardless GUICtrlSetData($labelil,_MemoryRead ($memadd+12, $MemOpen, "int")) GUICtrlSetData($labelol,_MemoryRead ($memadd+16, $MemOpen, "int")) if $update = $lastupdate Then Return;up to date so nothing to do GUICtrlSetData($Label1,_MemoryRead ($memadd+8, $MemOpen, "int")) $SLen = _MemoryRead ($memadd + 20, $MemOpen, "int") ConsoleWrite("striunglen = " & $SLen & @CRLF) $disp2 = _MemoryRead ($memadd + 24, $MemOpen, "char[" & $SLen +1 & "]");"char[256]") works ok GUICtrlSetData($Label2, $disp2) _MemoryWrite($memadd +4, $MemOpen, $update,"int") $lastupdate = $update EndFunc;==>updateEDIT: Minor corrections and improvements to display, added missing code to receiver script.EDIT2 26th Jan 2008 - added comment about change need to each script if using AutoIt 3.2.11.0 Edited September 15, 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...
JohnBailey Posted August 29, 2007 Author Share Posted August 29, 2007 Martin oh wow!!! yeah MUCH MUCH better!! I will update the first post (and my own stuff) later today with your version. Thanks!! A decision is a powerful thing Link to comment Share on other sites More sharing options...
martin Posted August 30, 2007 Share Posted August 30, 2007 Martin oh wow!!! yeah MUCH MUCH better!! I will update the first post (and my own stuff) later today with your version. Thanks!! How did you get the posted code to work?I wrote that code on a French computer and when I downloaded it onto my English laptop I couldn't run it because thee were illegal characters all over the place that I couldn't make out. It took quite a while to get it to run and I had to replace lots of white space with white space. If you had a similar problem I'll replace the code in that post. 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...
JohnBailey Posted August 30, 2007 Author Share Posted August 30, 2007 How did you get the posted code to work?I wrote that code on a French computer and when I downloaded it onto my English laptop I couldn't run it because thee were illegal characters all over the place that I couldn't make out. It took quite a while to get it to run and I had to replace lots of white space with white space. If you had a similar problem I'll replace the code in that post.I didn't get the exact code to work. When I made my post I was just straight reading your code in the forum and I could see (conceptually) why so much is better about it. I just don't have functions like _MemoryRead(), _MemoryWrite(), _MemoryClose(), etc.Other than that, everything syntax checks out ok. A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted August 30, 2007 Author Share Posted August 30, 2007 (edited) btw, I did find the udf containing those functions; it's just the thread is closed and I wasn't sure if I should hold off on using those.http://www.autoitscript.com/forum/index.php?showtopic=28351Edit:Oh, btw if I use the functions in that udf, then your script works (except for the input1 sending info) Edited August 30, 2007 by JohnBailey A decision is a powerful thing Link to comment Share on other sites More sharing options...
martin Posted August 30, 2007 Share Posted August 30, 2007 btw, I did find the udf containing those functions; it's just the thread is closed and I wasn't sure if I should hold off on using those.http://www.autoitscript.com/forum/index.php?showtopic=28351Edit:Oh, btw if I use the functions in that udf, then your script works (except for the input1 sending info)The NomadMemory.au3 udf came from here.The input1 edit has to be an integer or the receiving program will just see 0. 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