Letraindusoir 5 Posted January 12 Share Posted January 12 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() Local $idButton_Back, $idButton_Forward Local $idButton_Home, $idButton_Stop, $iMsg Local $oIE = ObjCreate("Shell.Explorer.2") GUICreate("Embedded Web control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) GUICtrlCreateObj($oIE, 5, 5, 630, 535) $idButton_Back = GUICtrlCreateButton("Back", 5, 545, 70, 30) $idButton_Forward = GUICtrlCreateButton("Forward", 80, 545, 70, 30) $idButton_Home = GUICtrlCreateButton("Home", 155, 545, 70, 30) $idButton_Stop = GUICtrlCreateButton("Stop", 230, 545, 70, 30) $idinputGetdata = GUICtrlCreateInput("", 305, 545, 330, 30) GUISetState(@SW_SHOW) $oIE.navigate("http://www.aastocks.com/en/stocks/analysis/transaction.aspx?symbol=00005") While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ExitLoop Case $iMsg = $idButton_Home $oIE.navigate("http://www.autoitscript.com") Case $iMsg = $idButton_Back $oIE.GoBack Case $iMsg = $idButton_Forward $oIE.GoForward Case $iMsg = $idButton_Stop $oIE.Stop EndSelect WEnd GUIDelete() EndFunc As shown above. When click the drop-down-box or radio-box of the tag area in the web-page how do the selected values in the web-page show in the input-box in the GUI? thanks a lot! Edited January 12 by Letraindusoir Link to post Share on other sites
markyrocks 46 Posted January 13 Share Posted January 13 My guess is probably through the tag data or through the execution of some javascript and the resulting data. You can scrape web pages information via downloading the source code and parsing through it. Anything stock related is usually hidden bc so many have made stock bots. The selling of stock trading data has turned into its own industry. It's ridiculous really. Letraindusoir 1 Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to post Share on other sites
Letraindusoir 5 Posted January 16 Author Share Posted January 16 Thank markyrocks! Getting the data in the webpage is not difficult.The focus of this post is how to pass the data obtained in the web page to the GUI, Link to post Share on other sites
Nine 1,501 Posted January 16 Share Posted January 16 There is probably something I do not understand in your request. You get the data from the webpage in variables and you store them in GUI controls with GUICtrlSetData. Not much of a signature but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search content in au3 files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
Letraindusoir 5 Posted January 17 Author Share Posted January 17 (edited) 18 hours ago, Nine said: There is probably something I do not understand in your request. You get the data from the webpage in variables and you store them in GUI controls with GUICtrlSetData. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Color.au3> #include <IE.au3> Local $idInpColor, $vGet = "" Local $srcHtml = WebSrcHtml() Test($srcHtml) Func Test($html) Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") #forceref $oErrorHandler Local $iGw = (1024 + (8 * 2)), $iGh = (256 + (8 * 2)) Local $iMsg Local $oIE = ObjCreate("Shell.Explorer.2") GUICreate("", $iGw, $iGh, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) GUICtrlCreateObj($oIE, 8, 8, 1024, ($iGh - 24 - (8 * 3))) $idInpColor = GUICtrlCreateInput("", 8 , ($iGh - 8 - 24),256, 24) GUISetState(@SW_SHOW) ;显示 GUI $oIE.navigate("about:blank") Sleep(1000) _IEDocWriteHTML($oIE, $html) Sleep(3000) ClipPut("") AdlibRegister("GetWebColor", 250) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Sleep(10) WEnd AdlibUnRegister("GetWebColor") GUIDelete() EndFunc ;==>Test Func _ErrFunc($oError) ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM error !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Func GetWebColor() $vGet = ClipGet() If (StringLeft($vGet, 1) = "#") Then GUICtrlSetData($idInpColor, $vGet) GUICtrlSetBkColor($idInpColor, "0x" & StringTrimLeft($vGet, 1)) EndIf EndFunc ;==>GetWebColor Func WebSrcHtml() Local $Str = _ '<HTML xmlns="http://www.w3.org/1999/xhtml">' & _ '<HEAD>' & _ '<META content="IE=11.0000" http-equiv="X-UA-Compatible">' & _ '<META http-equiv="Content-Type" content="text/html; charset=utf-8">' & _ '<style>' & _ 'body {' & _ ' background: url("bj.gif") rgb(53, 62, 68); font-size: 9pt; margin-top: 0px;' & _ '}' & _ 'td {' & _ ' font-size: 9pt;' & _ '}' & _ '.wrap {' & _ ' margin: 0px auto; width: 990px; overflow: hidden; background-color: rgb(255, 255, 255);' & _ '}' & _ '</style>' & _ '</HEAD>' & _ '<BODY text="#333333" bgcolor="#ffffff" link="#333333" alink="#333333" vlink="#333333">' & _ '<DIV class="wrap">' & _ ' <DIV align="center">' & _ ' <CENTER>' & _ ' <TABLE width="990" class="tableborder" border="0" cellspacing="3" cellpadding="5">' & _ ' <TBODY>' & _ ' <TR>' & _ ' <TD width="25%" class="tdborder" bgcolor="#f7acbc" onclick="javascript:window.clipboardData.setData(' & "'" & 'text' & "'" & ',this.currentStyle.backgroundColor);"><FONT ' & _ ' color="#ffffff"><BR>' & _ ' #f7acbc</FONT></TD>' & _ ' <TD width="25%" class="tdborder" bgcolor="#deab8a" onclick="javascript:window.clipboardData.setData(' & "'" & 'text' & "'" & ',this.currentStyle.backgroundColor);"><FONT ' & _ ' color="#ffffff"><BR>' & _ ' #deab8a</FONT></TD>' & _ ' <TD width="25%" class="tdborder" bgcolor="#817936" onclick="javascript:window.clipboardData.setData(' & "'" & 'text' & "'" & ',this.currentStyle.backgroundColor);"><FONT ' & _ ' color="#ffffff"><BR>' & _ ' #817936</FONT></TD>' & _ ' <TD width="25%" class="tdborder" bgcolor="#444693" onclick="javascript:window.clipboardData.setData(' & "'" & 'text' & "'" & ',this.currentStyle.backgroundColor);"><FONT ' & _ ' color="#ffffff"><BR>' & _ ' #444693</FONT></TD>' & _ ' </TR>' & _ ' <TR>' & _ ' <TD class="tdborder" bgcolor="#ef5b9c" onclick="javascript:window.clipboardData.setData(' & "'" & 'text' & "'" & ',this.currentStyle.backgroundColor);"><FONT ' & _ ' color="#ffffff"><BR>' & _ ' #ef5b9c</FONT></TD>' & _ ' <TD class="tdborder" bgcolor="#fedcbd" onclick="javascript:window.clipboardData.setData(' & "'" & 'text' & "'" & ',this.currentStyle.backgroundColor);"><FONT ' & _ ' color="#ffffff"><BR>' & _ ' #fedcbd</FONT></TD>' & _ ' <TD class="tdborder" bgcolor="#ea7522" onclick="javascript:window.clipboardData.setData(' & "'" & 'text' & "'" & ',this.currentStyle.backgroundColor);"><FONT ' & _ ' color="#ffffff"><BR>' & _ ' #ea7522</FONT></TD>' & _ ' <TD class="tdborder" bgcolor="#9b4880" onclick="javascript:window.clipboardData.setData(' & "'" & 'text' & "'" & ',this.currentStyle.backgroundColor);"><FONT ' & _ ' color="#ffffff"><BR>' & _ ' #9b4880</FONT></TD>' & _ ' </TR>' & _ ' </TBODY>' & _ ' </TABLE>' & _ ' </CENTER>' & _ ' </DIV>' & _ '</DIV>' & _ '</BODY>' & _ '</HTML> ' Return $Str EndFunc As shown in the code above The web javascript passes the value to the GUI when you double-click the color-block. What I want to achieve is how does Gui capture the mouse or keyboard actions for a web-page and get the corresponding value for the Dom element in the web-page? Edited January 17 by Letraindusoir Link to post Share on other sites
Nine 1,501 Posted January 17 Share Posted January 17 I see. Take a look at ObjEvent. You can set multiple events for a single HTML element : https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/hh801967(v=vs.85) You can search the forum for specific examples on using ObjEvent with IE. Not much of a signature but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search content in au3 files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
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