Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/12/2022 in all areas

  1. JLogan3o13

    Beginer to JavaScript

    I have had good experience with Pluralsight in the past for other languages. I have not done their javascript courses, but I see quite a bit of content out there. You get a 10-day free all-access pass to try it out: https://www.pluralsight.com/browse?=&q=javascript&type=all&sort=default
    3 points
  2. WebDriver is the way to go. A good starting point is the WebDriver section in the wiki.
    1 point
  3. NewCommer

    Websockets and AutoIt

    My websocket UDF: Only AutoIt code (combine Js from IE core): 😃 #RequireAdmin MsgBox(0x1000, 'Begin', 'Example1') example1() MsgBox(0x1000, 'Begin', 'Example2') example2() MsgBox(0x1000, 'Begin', 'Example3') example3() Func example1() Local $oWS = Websocket_Connect('wss://api.bitfinex.com/ws') Local $recv = Websocket_Send($oWS) For $index = 0 To $recv.length - 1 ConsoleWrite(' - Index ' & $index & ': ' & $recv.index($index) & @CRLF & @CRLF) Next Websocket_Close($oWS, 1000, '', 20000) EndFunc Func example2() Local $oWS = Websocket_Connect('wss://api.bitfinex.com/ws') Local $recv = Websocket_Send($oWS) $oJson = $recv.index(0, True) ;<= True = turn on Json parse MsgBox(0x1000, '$oJson.serverId', $oJson.serverId) Websocket_Close($oWS, 1000, '', 20000) EndFunc Func example3() Local $oWS = Websocket_Connect('wss://api.bitfinex.com/ws') Local $recv = Websocket_Send($oWS, '{"event":"subscribe","channel":"ticker","pair":"BTCUSD"}') Local $Timer = TimerInit() Do Sleep(1000) For $index = 0 To $recv.length - 1 ConsoleWrite(' - Index ' & $index & ': ' & $recv.index($index) & @CRLF & @CRLF) Next ConsoleWrite('-------------------------------------------------' & @CRLF) Until TimerDiff($Timer) > 30000 Websocket_Close($oWS, 1000, '', 20000) EndFunc Func Websocket_Connect($Ws_URL, $protocol = '', $binaryType = False, $timeout = 20000) _IE_Emulation(True) If @error Then Exit MsgBox(0x40000, 'Fatal Error', 'You must install Internet Explorer 11') Local Static $oEvent = ObjEvent('AutoIt.Error', '') Local $oWS = ObjCreate("HTMLFILE") $Ws_URL = '"' & $Ws_URL & '"' If $protocol Then $Ws_URL &= ', [' & StringRegExpReplace(StringRegExpReplace($protocol, '(?i)Sec-WebSocket-Protocol:\s+', '', 1), '(\w+)', '"${1}"') & ']' If $binaryType = Default Then $binaryType = False With $oWS.parentwindow .execScript( _ 'Array.prototype.item = function(i,parseJson) {if(typeof parseJson==''undefined''){return this[i]}else{return JSON.parse(this[i])}};' & _ ;Ma thuật giúp autoit thÆ°Æ¡ng tác JS Array 'Array.prototype.index = Array.prototype.item;' & _ 'var recv_data=[], event_close = [], event_error ;' & _ 'let socket = new WebSocket(' & $Ws_URL & ');' & _ 'socket.binaryType = "' & ($binaryType ? 'arraybuffer' : 'blob') & '";' & _ 'socket.onopen = function(event) {};' & _ 'socket.onmessage = function(event) {recv_data.push(event.data)};' & _ 'socket.onclose = function(event) {event_close = event};' & _ 'socket.onerror = function(error) {event_error= error.message};') If @error Then Return SetError(1, ConsoleWrite(@CRLF & '! [Websocket_Connect] Your IE don''t support websocket. Please update to IE11' & @CRLF & @CRLF), 0) Local $ti = TimerInit() Do Sleep(25) If TimerDiff($ti) > $timeout Then Return SetError(2, ConsoleWrite(@CRLF & '! [Websocket_Connect] Connect timeout' & @CRLF & @CRLF)) Until .eval('socket.readyState') = 1 EndWith ConsoleWrite(@CRLF & '> [Websocket_Connect] Connection established' & @CRLF & @CRLF) Return $oWS EndFunc Func Websocket_Send(ByRef $oWS, $Data = '', $timeout = 60000) If $Data Then $oWS.parentwindow.eval('socket').send($Data) Local $recv_data = $oWS.parentwindow.eval('recv_data') Local $ti = TimerInit() Do Sleep(25) If TimerDiff($ti) > $timeout Then Return SetError(1, ConsoleWrite('! [Websocket_Send] Receive timeout' & @CRLF & @CRLF)) Until $recv_data.length > 0 Return $recv_data EndFunc Func Websocket_ResetRecvData(ByRef $oWS) $oWS.parentwindow.eval('recv_data.splice(0, recv_data.length);') EndFunc Func Websocket_Close(ByRef $oWS, $Code = 1000, $Reason = '', $wait_ms = 0) With $oWS.parentwindow.eval('socket') .close() If .readyState >= 2 Then ConsoleWrite('> [Websocket_Close] The connection is in the process of closing...') If IsKeyword($wait_ms) Then $wait_ms = 0 If $wait_ms > 0 Then If $wait_ms < 10000 Then $wait_ms = 10000 Local $ti = TimerInit() Do Sleep(25) If TimerDiff($ti) > $wait_ms Then ExitLoop Until .readyState = 3 If .readyState = 3 Then Local $event_close = $oWS.parentwindow.eval('event_close') ConsoleWrite('The connection is closed with Code=' & $event_close.code & ($event_close.reason ? ' and Reason=' & $event_close.reason : '')) EndIf EndIf $oWS = Null ConsoleWrite(@CRLF & @CRLF) EndWith EndFunc Func _IE_Emulation($vTurnOn = True) ;By Huân Hoàng ;https://blogs.msdn.microsoft.com/patricka/2015/01/12/controlling-webbrowser-control-compatibility/ Local Static $isOn = False If $vTurnOn = True And $isOn = True Then Return Local Static $_Reg_BROWSER_EMULATION = '\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION' Local Static $_Reg_HKCU_BROWSER_EMULATION = 'HKCU\SOFTWARE' & $_Reg_BROWSER_EMULATION Local Static $_Reg_HKLM_BROWSER_EMULATION = 'HKLM\SOFTWARE' & $_Reg_BROWSER_EMULATION Local Static $_Reg_HKLMx64_BROWSER_EMULATION = 'HKLM\SOFTWARE\WOW6432Node' & $_Reg_BROWSER_EMULATION Local $_IE_Mode, $_AutoItExe = StringRegExp(@AutoItExe, '(?i)\\([^\\]+.exe)$', 1)[0] Local $_IE_Version = StringRegExp(FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe"), '^\d+', 1) If @error Then $isOn = False Return SetError(1, ConsoleWrite('! [_IE_Emulation]: Cannot get IE Version' & @CRLF & @CRLF), False) EndIf $_IE_Version = Number($_IE_Version[0]) Switch $_IE_Version Case 10, 11 $_IE_Mode = $_IE_Version * 1000 + 1 Case Else Return SetError(2, ConsoleWrite('! [_IE_Emulation]: You must install Internet Explorer 10 and Internet Explorer 11' & @CRLF & @CRLF), False) EndSwitch If $vTurnOn Then If RegRead($_Reg_HKCU_BROWSER_EMULATION, $_AutoItExe) <> $_IE_Mode Then RegWrite($_Reg_HKCU_BROWSER_EMULATION, $_AutoItExe, 'REG_DWORD', $_IE_Mode) If RegRead($_Reg_HKLM_BROWSER_EMULATION, $_AutoItExe) <> $_IE_Mode Then RegWrite($_Reg_HKLM_BROWSER_EMULATION, $_AutoItExe, 'REG_DWORD', $_IE_Mode) If @AutoItX64 And RegRead($_Reg_HKLMx64_BROWSER_EMULATION, $_AutoItExe) <> $_IE_Mode Then RegWrite($_Reg_HKLMx64_BROWSER_EMULATION, $_AutoItExe, 'REG_DWORD', $_IE_Mode) $isOn = True Else RegDelete($_Reg_HKCU_BROWSER_EMULATION, $_AutoItExe) RegDelete($_Reg_HKLM_BROWSER_EMULATION, $_AutoItExe) If @AutoItX64 Then RegDelete($_Reg_HKLMx64_BROWSER_EMULATION, $_AutoItExe) $isOn = False EndIf Return True EndFunc
    1 point
  4. @mLipok, thanks for the testing and I was indeed able to replicate this so just uploaded a fix for that. I also noticed that using a tab on a dropdownlist wouldn't (always) add the #include statement at the top when missing and fixed that too.
    1 point
  5. Excuse me, I rushed to write on the subject. Please delete this post as there are many posts about it in the forum
    1 point
  6. jaberwacky

    Themes for SciTE

    Note: This has been deprecated by >SciTE Customization GUI. I highly recommend SCG for all of your theme needs. Thank you. and your SciTE customization knowledge too. Here is a dark theme for SciTE for all you dark theme fans. I got this theme from Notepad++ which got the theme from the Dejavu font project (http://dejavu.sourceforge.net/wiki/index.php/Main_Page). Customized by hand because the original themese aren't perfect. They had black text on dark background. The line number margin, fold margin, editor, and console is themed! I encourage you to post your theme too. Also, if you have any knowledge that would enhance this and any other theme then I encourage you to post that too. Please post a fairly high quality screenshot too please. Instructions: (this works for me anyway. If you know a better method lemme know) 1) create the file named 'Twilight.SciTEConfig' in the 'SciTEConfig' folder found in the SciTE folder of your AutoIt installation 2) fire up SciTE and press 'Ctrl+1' 3) select the 'Color Settings' tab 4) click 'New Scheme' 5) select 'Twilight' from the drop down list 6) finally, click 'Update' Screenshot: Twilight.SciTEConfig -- Updated: November 26, 2010 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # START: DO NOT CHANGE ANYTHING AFTER THIS LINE #-#-#-#-# # Twilight -- 06/21/2011 #------------------------------------------------------------ find.close.on.find=1 proper.case=1 check.updates.scite4autoit3=1 indent.size.au3=4 highlight.current.word=1 highlight.current.word.colour=#CF6A4C highlight.current.word.by.style =1 autocomplete.*.ignorecase=1 autocomplete.*.start.characters=2 calltip.*.ignorecase=1 save.position=1 default.file.ext=au3 strip.trailing.spaces=1 ensure.final.line.end=1 ensure.consistent.line.ends=1 # Background style.au3.32=back:#141414 # Brace highlight style.au3.34=fore:#FCE94F,bold # Brace incomplete highlight style.au3.35=fore:#EF2929,bold #CaretLine Fore caret.fore=#DADADA #CaretLine Back caret.line.back=#F8F8F8 caret.line.back.alpha=0 #Selection selection.fore=#CF6A4C selection.back=#DADADA selection.alpha=25 #White Space style.au3.0=fore:#F8F8F8 #Comment line style.au3.1=fore:#5F5A60 #Comment block style.au3.2=fore:#5F5A60 #Number style.au3.3=fore:#CF6A4C #Function style.au3.4=fore:#DAD085 #Keyword style.au3.5=fore:#F9EE98 #Macro style.au3.6=fore:#DADADA #String style.au3.7=fore:#8F9D6A #Operator style.au3.8=fore:#CDA869 #Variable style.au3.9=fore:#7587A6 #Sent keys style.au3.10=fore:#DADADA #Pre-Processor style.au3.11=fore:#8996A8 #Special style.au3.12=fore:#DADADA #Abbrev-Expand style.au3.13=fore:#DADADA #Com Objects style.au3.14=fore:#DADADA #Standard UDFs style.au3.15=fore:#0080FF # Line Number Margin style.au3.33=$(font.monospaced),fore:#F8F8F8,back:#2E3436 # Fold Margin fold.margin.colour=#555753 fold.margin.highlight.colour=#2E3436 error.marker.fore=#DADADA error.marker.back=#2E3436 # Error Output style.errorlist.0=fore:#DADADA # Program Output style.errorlist.1=fore:#DADADA # Error Line style.errorlist.3=fore:#DADADA # command or return status style.errorlist.4=fore:#8F9D6A # diff changed ! style.errorlist.10=fore:#CF6A4C # # Diff addition + style.errorlist.11=fore:#7587A6 # diff deletion - style.errorlist.12=fore:#F9EE98 # Console Background style.errorlist.32=$(font.monospace),back:#141414 # END => DO NOT CHANGE ANYTHING BEFORE THIS LINE #-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    1 point
  7. You can make your own function. #include <AutoItConstants.au3> ConsoleWrite("value: " & 0xFFFA0000 & @CRLF) ConsoleWrite("value: " & Int(0xFFFA0000, $NUMBER_AUTO) & @CRLF) ConsoleWrite("value: " & _UINT(0xFFFA0000) & @CRLF) Func _UINT($INT) Local $tUINT = DllStructCreate("UINT") DllStructSetData($tUINT, 1, $INT) Return DllStructGetData($tUINT, 1) EndFunc ;==>_UINT Saludos
    1 point
×
×
  • Create New...