Jump to content

Ninjatrader scroll to right


junkone
 Share

Recommended Posts

I have a script that takes screenshots of the ninjatrader charting window. I have 2 issues that i need an idea for solution.

1. i need to scroll the window fully to right? the title of the window =$EURUSD  and the class of the scrollbar =WindowsForms10.SCROLLBAR.app.0.378734a

i am already having the handle of the window using $hWnd = WinGetHandle($Title5) 

how can i click the scrollbar all the way to right?Fixed

2. sometimes the chart scaling is invalid and so there will be a icon F that i have highlighted with arrow on the image. its in the top right hand corder of this window. All i have to do is to click on it to restore the scaling. How can i find that point and automate the click?

IDCl0N9.png

#include <ScreenCapture.au3>
Example()

Func Example()
     Local $hWnd
     Local $Title5 ="$EURUSD"
     
     Local $FilePath="c:\temp\images"
     Local $FileName="Filename"

    Opt("WinTitleMatchMode", 2)

    if($CmdLine[0]>0) Then ; Contains the total number of items in the array.
        $FileName=$CmdLine[1]
        EndIf

     If WinExists($Title5) Then
       ; MsgBox($MB_SYSTEMMODAL, "", $CmdLine[0])
            ; Retrieve the handle of the Notepad window using the classname of Notepad.
     $hWnd = WinGetHandle($Title5)
      ; Activate the Notepad window using the handle returned by WinWait.
    WinActivate($hWnd)
;scroll to the right EndFunc

; click on focus icon 

      ; Capture window
    _ScreenCapture_CaptureWnd( $FilePath & $FileName & $Title5 &".jpg",  $hWnd)

    Else
        MsgBox($MB_SYSTEMMODAL, "", "Window does not exist")
    EndIf
#cs  If WinExists($Title1) Then
###        ; MsgBox($MB_SYSTEMMODAL, "", $CmdLine[0])
###             ; Retrieve the handle of the Notepad window using the classname of Notepad.
###      $hWnd = WinGetHandle($Title1)
###       ; Activate the Notepad window using the handle returned by WinWait.
###     WinActivate($hWnd)
### 
###       ; Capture window
###     _ScreenCapture_CaptureWnd( $FilePath & $FileName & $Title1 &".jpg",  $hWnd)
### 
###     Else
###         MsgBox($MB_SYSTEMMODAL, "", "Window does not exist")
###     EndIf
 #CE



  ShellExecute($FilePath & $FileName & $Title5 &".jpg")
   ShellExecute($FilePath & $FileName & $Title1 &".jpg")
EndFunc   ;==>Example

 

Edited by junkone
fixed half the problem
Link to comment
Share on other sites

When you search the forum you will notice that Windows Forms are hard/impossible to automate.
Doesn't NinjaTrader provide some kind of interface you could automate?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

To scroll to the right I would try the following (can't at the moment): MouseClickDrag

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

i fixed the problem with the scroll part. Ninjatrader supports the {END} key so i fixed it by sending the {END} key after window is active.

my remaining issue is to find a way to click on that F button. its on the topright of the window with class name Class:    WindowsForms10.Window.8.app.0.378734a

how can i find the x and y position of the right edge of the control "Class:    WindowsForms10.Window.8.app.0.378734a" using Autoit dynamically?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...