Jump to content

goldenix

Active Members
  • Posts

    734
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

goldenix's Achievements

Universalist

Universalist (7/7)

2

Reputation

  1. That is an interesting function, I tested it out with exact window title (just in case) and nop, the video is still getting minimized. so youtube still recognizes I pressed the esc key. I will look into the hook thingie.
  2. Aa I see what you mean, I thought you were talking about Autoit solution hire, but you were talking about general regedit. Regedit requires log off or reboot for the changes to take effect. Im not going to reboot every time I want to press esc.
  3. Remote is not the issue hire. Like I said before. I want to press escape key on the keyboard. and nothing should happen.
  4. I searched before I posted, did not see any registry setting solution, what did you enter into the search field? When I watch a video in full screen I would like to pause it by sending space key with my remote. My remote has only 1 button & it sends Esc key. The problem is that autoit does not disable escape key. Instead it sends (escape and space key at the same time) when I press esc button on my keyboard or btn on my remote. As result == Video is exited from full screen & then paused.
  5. Umm...what kind of registry setting? I mean reg setting to hotkey set command ?
  6. Hi I want to press escape key & nothing should happen. Is this possible? Following code seems to be working with other other hotkeys, but does not work with escape key. Open any video on yotube for example & fullscreen it, then run code below, the video will exit from fullscreen indicating that esc key was pressed. Is there a workaround perhaps ? HotKeySet("{Esc}","disable_esc") func disable_esc() ;send('{space}') EndFunc while 1 sleep(100) WEnd
  7. I think this topic can be set as Solved. Hire are the results. Pretty neat actually, ill see if I can control a minirobot with hotkeys later. Idea was to press the button, the led turns on & sends data to autoit script, press it again, led turns off (and sends data to autoit again.) Btn went from off to on Led is On Btn went from off to on Led is Off Setup used: (that is a 10k resistor (a pulldown resistor), can be bigger) Arduino 1.0.6 code: // this constant won't change: const int buttonPin = 2; // the pin that the pushbutton is attached to const int ledPin = 13; // the pin that the LED is attached to // Variables will change: int ledState = 0; int buttonState = 0; // current state of the button int lastButtonState = 0; // previous state of the button void setup() { // initialize the button pin as a input: pinMode(buttonPin, INPUT); // initialize the LED as an output: pinMode(ledPin, OUTPUT); // initialize serial communication: Serial.begin(9600); } void loop() { // read the pushbutton input pin: buttonState = digitalRead(buttonPin); delay(50); // compare the buttonState to its previous state if (buttonState != lastButtonState) { if (buttonState == HIGH) { // if the current state is HIGH then the button // wend from off to on: Serial.println("Btn went from off to on"); if(ledState == 0){ digitalWrite(ledPin, 1); // Turn led on ledState = 1; Serial.println("Led is On"); } else{ digitalWrite(ledPin, 0); ledState = 0; Serial.println("Led is Off"); } } else { // if the current state is LOW then the button // wend from on to off: //Serial.println("wend from on to off"); } } // save the current state as the last state, //for next time through the loop lastButtonState = buttonState; } Autoit stripped gui code (stripped version of the example in the first post): #include <GUIConstants.au3> #include 'CommMG.au3';or if you save the commMg.dll in the @scripdir use #include @SciptDir & '\commmg.dll' #include <GuiEdit.au3> #include <windowsconstants.au3> #include <buttonconstants.au3> HotKeySet("{ESC}", "alldone") #Region ### START Koda GUI section ### Form=d:\my documents\miscdelphi\commg\ExampleComm.kxf $Form2 = GUICreate("COMMG Example", 473, 349, 339, 333, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Edit1 = GUICtrlCreateEdit("", 10, 25, 449, 223, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_HSCROLL, $WS_VSCROLL)) $BtnSend = GUICtrlCreateButton("Send", 380, 273, 53, 30, $BS_FLAT) $Input1 = GUICtrlCreateInput("1", 18, 279, 361, 21) $Checkbox1 = GUICtrlCreateCheckbox("Add LF to incomming CR", 273, 4, 145, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $Label11 = GUICtrlCreateLabel("Text to send", 24, 261, 63, 17) $BtnSetPort = GUICtrlCreateButton("Set Port", 16, 312, 73, 30, $BS_FLAT) $Label21 = GUICtrlCreateLabel("Received text", 34, 6, 70, 17) $Label31 = GUICtrlCreateLabel("commg.dll version unknown", 272, 328, 135, 17) GUICtrlSetColor(-1, 0x008080) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $resOpen = _CommSetPort(25, 0, 9600, 8, 0, 1, 0) _CommSetXonXoffProperties(11, 13, 100, 100) Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") GUICtrlSetOnEvent($BtnSend, "SendEvent") While 1 ;sleep(40) ;gets characters received returning when one of these conditions is met: ;receive @CR, received 20 characters or 200ms has elapsed $instr = _commGetLine(@CR, 20, 200);_CommGetString() If $instr <> '' Then;if we got something If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then $instr = StringReplace($instr, @CR, @CRLF) GUICtrlSetData($Edit1, $instr, 1) Else Sleep(20) ;MichaelXMike EndIf WEnd Func _exit() Exit EndFunc ;==>justgo Func SendEvent();send the text in the inputand append CR ; _CommSendstring(GUICtrlRead($Input1) & @CR) _CommSendstring(GUICtrlRead($Input1)) GUICtrlSetData($Input1, '0');clear the input ;GUICtrlSetState($edit1,$GUI_FOCUS);sets the caret back in the terminal screen EndFunc ;==>SendEvent NoGui example: #include 'CommMG.au3' $resOpen = _CommSetPort(25, 0, 9600, 8, 0, 1, 0) _CommSendstring("1") sleep(2000) _CommSendstring("0") And No gui port listener example: (this will give you the gui is off or on messages) #include 'CommMG.au3' $resOpen = _CommSetPort(25, 0, 9600, 8, 0, 1, 0) While 1 ;gets characters received returning when one of these conditions is met: ;receive @CR, received 20 characters or 200ms has elapsed $instr = _commGetLine(@CR, 20, 200);_CommGetString() If $instr <> '' Then;if we got something ConsoleWrite($instr) Else Sleep(20) ;MichaelXMike EndIf WEnd
  8. With arduino software im getting proper values, with autoit not, But with autoit im sending: _CommSendstring(1 & @CR) ; note the @cr 13 decimal is cr char _CommSendstring("0") ; This does not work
  9. Thank you for support Breathe. Got everything working, guess all the problems were happening because of the outdated Autoit version. Hire is the code that almost works for me, turns on the led by sending 1, then sleeping for 2 seconds & turning off the led by sending 0. It also returns the data that is transmitted back. But it is still a bit bugged, if I look at the output data there should be : (Any ideas why that my be?) Decimal value: 48 not Decimal value: 13 The code: #include 'CommMG.au3';or if you save the commMg.dll in the @scripdir use #include @SciptDir & '\commmg.dll' $resOpen = _CommSetPort(25, 0, 9600, 8, 0, 1, 0) _CommSendstring(1 & @CR) ; Turn on led While 1 ;gets characters received returning when one of these conditions is met: ;receive @CR, received 20 characters or 200ms has elapsed $instr = _commGetLine(@CR, 20, 200);_CommGetString() If $instr <> '' Then;if we got something ;$instr = StringReplace($instr, @CR, @CRLF) ConsoleWrite($instr) Else Sleep(2000) ;MichaelXMike ExitLoop EndIf WEnd _CommSendstring(0 & @CR) ; turn off led _Commcloseport(true) Outputs Data that is returned back: Decimal value: 49 Integer value: 1 Led is On Decimal value: 13 // this should be 48 not 13, because 48 == 0 & in inputting 0 Integer value: -35 Invalid input, enter 1 or 0 to control led on pin 13! Proper output that I expext to see: Decimal value: 49 Integer value: 1 Led is On Decimal value: 48 Integer value: 0 Led is Off
  10. This makes no sense, I started stripping code from example & if I drag & drop it into AutoIt3.exe, the example is working, but if I try to F5 run it GUI runs, but sending chars does not work. Weird things going on, + I also get this error, so I went & deleted byref in front of the _CommSetPort($iPort, ByRef $sErr, And guess what if I drag & drop it into autoit exe it works, but if I F5 it it does not work... ERROR: _CommSetPort() called with Const or expression on ByRef-param(s). EDIT: This issue with drag & dropping is solved, outdated autoit version was used to try to run this, working of final send code, will post it if it will work:
  11. Looked at the udf & it says You cannot set the same COM port on more than one channel. Does it mean I need to create channel & then set port to the channel? confused.
  12. 2 dll was not open and could not be opened Yes I read that, but the question is why, I mean the example works & I copied the include code from there. So it should work....unless im missing code to make the communication work, Am I?
  13. In not even sure Im using the code correctly. Its my first time programming serial communication. But hire is the return. ConsoleWrite($resOpen & " @error returns: " & @error & @CRLF) 0 @error returns: 2
  14. Edit: This topic was solved, see >Post #15 for the codes and setup that worked for me. Hi I downloaded the COMMGvv2.zip & CommgExample.au3 From >this topic. Ran the example GUI with default parametres, in the Send text field entered number 1 & pressed Send button. Sending 1 as char worked, the LED on my Arduino Leonardo board went on, then I sent 0 & led went off, just the way I programmed the board. But I can not figure out how to make a custom code, a little help would be appreciated. Please. my port: COM 25 baud: 9600 data bits: 8 stop bits: 1 parity: 1 flow control: 0 MY code so far: (consolewrite returns 0) #include <GUIConstants.au3> #include 'CommMG.au3';or if you save the commMg.dll in the @scripdir use #include @SciptDir & '\commmg.dll' $iPort = 25 ; COM 25 $sErr = 'errormsg' $iBaud = 9600 $iBits = 8 $iPar = 0 $iStop = 1 $iFlow = 0 $RTSMode = 0 $DTRMode = 0 $resOpen = _CommSetPort($iPort, $sErr, $iBaud, $iBits, $iPar, $iStop, $iFlow, $RTSMode, $DTRMode) ConsoleWrite($resOpen & @LF) _CommSendstring('1')
  15. im still a bit confused, must go & think it over, but this is what I basically want, yes. Thank you #include <array.au3> Global $mainArray[3][2] ;Create an array with [3-rows][2-columns] Global $childArray[2][3] _ArrayDisplay($mainArray) for $i = 0 to UBound($mainArray)-1 ConsoleWrite($i & @CRLF) $mainArray[$i][0] = $i Assign("array" & $i, $childArray) $aTemp = Eval("array" & $i) if $i = 2 Then $aTemp[0][1] = 'xxx' $mainArray[$i][1] = $aTemp Next _ArrayDisplay($mainArray[2][1])
×
×
  • Create New...