LearningEW Posted June 23, 2021 Posted June 23, 2021 Hi, I want AutoIt to scroll through the specified watchlist having stock names in it continuously in technical analysis software Amibroker. A utility to auto scroll the charts in the watchlist of Amibroker say every 10-15sec (stopping at each chart for 2sec) so that no need to manually go through each chart. Have no idea about coding so request your help make this utility.
Moderators Melba23 Posted June 23, 2021 Moderators Posted June 23, 2021 Moved to the appropriate forum. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Luke94 Posted June 29, 2021 Posted June 29, 2021 I'm not familiar with AmiBroker but I'll try and point you in the right direction. Are you trying to cycle through those tabs marked in red?
LearningEW Posted June 29, 2021 Author Posted June 29, 2021 Im trying to auto scroll even in background through the stocks highlighted in blue. This watchlist may have say 100 or 2000 stocks.
Luke94 Posted June 29, 2021 Posted June 29, 2021 (edited) If you're not familiar with it - check out the AutoIt Window Information Tool. Post back the Control Information for all of the controls you can find in the area you've highlighted. Edit: Just post screenshots of the AutoIt Window Information Tool (Control tab) for each control. Edited June 29, 2021 by Luke94
LearningEW Posted June 29, 2021 Author Posted June 29, 2021 Auto.docx Have attached 2 screenshots. Hope this is OK.
Luke94 Posted June 29, 2021 Posted June 29, 2021 Did you use the Finder Tool on the actual list? I would assume it's a ListView. (SysListView32) Those screenshots are of the column headers. Use the Finder Tool on some text within the list - Try the scrollbars as well. You can paste the screenshot directly into your reply, rather than uploading as a document.
Luke94 Posted June 29, 2021 Posted June 29, 2021 I'm not able to test this but give it a try: #include <GuiListView.au3> Global $g_hWnd Global $g_hListView Global $g_iCount Global $g_iIndex $g_hWnd = WinGetHandle('AmiBroker') ; Get AmiBroker window handle If IsHWnd($g_hWnd) = 1 Then ; Check the window handle is valid If WinActive($g_hWnd) = 0 Then ; Check if AmiBroker is NOT active WinActivate($g_hWnd) ; If it's NOT active, activate it WinWaitActive($g_hWnd, '', 5) ; Wait for the handle to become active EndIf While 1 ; Loop forever $g_hListView = ControlGetHandle($g_hWnd, '', '[CLASS:SysListView32; INSTANCE:5]') ; Get the ListView handle $g_iCount = (_GUICtrlListView_GetItemCount($g_hListView) - 1) ; Get the number of items in the ListView $g_iIndex = 0 Do _GUICtrlListView_EnsureVisible($g_hListView, $g_iIndex) ; Scrolls the ListView to the given index - which we're increasing by one below $g_iIndex += 1 Sleep(2000) ; Wait 2000ms (2 seconds) Until $g_iIndex > $g_iCount ; Loop until we've reached the end of the ListView _GUICtrlListView_EnsureVisible($g_hListView, 0) ; Once we've reached the end of the ListView above, move back to the top of the ListView Sleep(15000) ; Wait 15000ms (15 seconds) - once we've waited, the While loop will restart WEnd EndIf I assume the two screenshots you've sent are different ListViews on different tabs? In that case, the above will only work (if it does) on the currently selected tab. If it does work, we can look into changing the tab periodically. Any errors, post them back. ☺️
LearningEW Posted June 29, 2021 Author Posted June 29, 2021 (edited) Thanks. I can see the scroll bar moving, but its not selecting(next stock/chart) and scrolling the stocks. Edited June 29, 2021 by LearningEW
Luke94 Posted June 29, 2021 Posted June 29, 2021 How do you select next stock/chart? Do you click the item in the ListView?
Luke94 Posted June 29, 2021 Posted June 29, 2021 Try this - it should double click each item. #include <GuiListView.au3> Global $g_hWnd Global $g_hListView Global $g_iCount Global $g_iIndex $g_hWnd = WinGetHandle('AmiBroker') ; Get AmiBroker window handle If IsHWnd($g_hWnd) = 1 Then ; Check the window handle is valid If WinActive($g_hWnd) = 0 Then ; Check if AmiBroker is NOT active WinActivate($g_hWnd) ; If it's NOT active, activate it WinWaitActive($g_hWnd, '', 5) ; Wait for the handle to become active EndIf While 1 ; Loop forever $g_hListView = ControlGetHandle($g_hWnd, '', '[CLASS:SysListView32; INSTANCE:5]') ; Get the ListView handle $g_iCount = (_GUICtrlListView_GetItemCount($g_hListView) - 1) ; Get the number of items in the ListView $g_iIndex = 0 Do _GUICtrlListView_EnsureVisible($g_hListView, $g_iIndex) ; Scrolls the ListView to the given index - which we're increasing by one below _GUICtrlListView_ClickItem($g_hListView, $g_iIndex, 'Left', False, 2, 0) ; Double click the ListView Item $g_iIndex += 1 Sleep(2000) ; Wait 2000ms (2 seconds) Until $g_iIndex > $g_iCount ; Loop until we've reached the end of the ListView _GUICtrlListView_EnsureVisible($g_hListView, 0) ; Once we've reached the end of the ListView above, move back to the top of the ListView Sleep(15000) ; Wait 15000ms (15 seconds) - once we've waited, the While loop will restart WEnd EndIf
LearningEW Posted June 29, 2021 Author Posted June 29, 2021 Thanks. Its working fine when Amibroker is in front but when i open another window say chrome and Amibroker is in background then it scrolls but doesn't click the stock. Is it possible to click/select the charts/stock even when Amibroker is in background.
Luke94 Posted June 29, 2021 Posted June 29, 2021 7 minutes ago, LearningEW said: Thanks. Its working fine when Amibroker is in front but when i open another window say chrome and Amibroker is in background then it scrolls but doesn't click the stock. Is it possible to click/select the charts/stock even when Amibroker is in background. Not that I'm aware of. Someone else may be able to help with that though.
LearningEW Posted June 29, 2021 Author Posted June 29, 2021 Many thanks Luke. Will use this and give feedback tomorrow. Thanks again.
LearningEW Posted June 29, 2021 Author Posted June 29, 2021 Luke, One query....this script is using mouse click function to select the stock. Can this also be done by using arrow key function, as next stock can be selected by arrow keys also. Asking as this might then work in background.
Luke94 Posted June 29, 2021 Posted June 29, 2021 #include <GuiListView.au3> Global $g_hWnd Global $g_hListView Global $g_iCount Global $g_iIndex $g_hWnd = WinGetHandle('AmiBroker') ; Get AmiBroker window handle If IsHWnd($g_hWnd) = 1 Then ; Check the window handle is valid If WinActive($g_hWnd) = 0 Then ; Check if AmiBroker is NOT active WinActivate($g_hWnd) ; If it's NOT active, activate it WinWaitActive($g_hWnd, '', 5) ; Wait for the handle to become active EndIf While 1 ; Loop forever $g_hListView = ControlGetHandle($g_hWnd, '', '[CLASS:SysListView32; INSTANCE:5]') ; Get the ListView handle $g_iCount = (_GUICtrlListView_GetItemCount($g_hListView) - 1) ; Get the number of items in the ListView $g_iIndex = 0 Do _GUICtrlListView_EnsureVisible($g_hListView, $g_iIndex) ; Scrolls the ListView to the given index - which we're increasing by one below ; _GUICtrlListView_ClickItem($g_hListView, $g_iIndex, 'Left', False, 2, 0) ; Double click the ListView Item _GUICtrlListView_SetItemSelected($g_hListView, $g_iIndex) $g_iIndex += 1 Sleep(2000) ; Wait 2000ms (2 seconds) Until $g_iIndex > $g_iCount ; Loop until we've reached the end of the ListView _GUICtrlListView_EnsureVisible($g_hListView, 0) ; Once we've reached the end of the ListView above, move back to the top of the ListView Sleep(15000) ; Wait 15000ms (15 seconds) - once we've waited, the While loop will restart WEnd EndIf See if this works in the background first.
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