Jump to content

Uzo

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Uzo

  1. Hi, How can I fix the code below so that it runs? Thanks much #include <ScreenCapture.au3> $chartFolder = "C:\Scripts\deepdive\" $tickerFile = "C:\Scripts\tickers.txt" $chartWinTitle = "TC2000 – Naked Charts" $chartWidth = 1280 $chartHeight = 720 ;========================================================================== ; Do not modify code below unless you are sure ; Open ticker file to read Local $hFileOpen = FileOpen($tickerFile, $FO_READ) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the ticker file: " & $tickerFile ) Exit 1 EndIf ; create the chart folder If DirCreate ($chartFolder) = 0 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when creating folder: " & $chartFolder ) Exit 1 EndIf ; read and process ticker one by one $line = FileReadLine($hFileOpen) While Not @error $A = StringLower ($line) $hGUI = WinActivate($chartWinTitle) MsgBox($MB_SYSTEMMODAL, "", "An error occurred when activating window: " & $chartWinTitle) Exit 1 If $hGUI = 0 Then Endif Send($A & "{ENTER}") ; resize the window to specified size for the chart image ; this also slows down the code a bit such that the window is ready for capture $hGUI = WinActivate($chartWinTitle) WinMove($hGUI, "", 0, 0, $chartWidth, $chartHeight) ; avoid mouse on chart $x = MouseGetPos(0) $y = MouseGetPos(1) MouseMove(0, $chartHeight+20) if($x <= $chartWidth and $y <= $chartHeight) Then Endif ; capture window and save to a file $JFile = $chartFolder & $line & ".png" FileDelete($JFile) ; wait for the chart to load. Necessary for slow network ;Sleep(500) _ScreenCapture_CaptureWnd($JFile, $hGUI) If StringLen($line) <> 0 Then Endif $line = FileReadLine($hFileOpen) WEnd Exit 0
×
×
  • Create New...