I am working through a code for a MTGO Bot bit by bit to get it to work ( The code itself was initialy posted on here, saying people could use it so I hope its ok)
I am currently at this part in the code
Func GetPlayer() ;Get the player's Name
Dim $miDoc, $Doc
Dim $str
Dim $oWord
Dim $sArray[500]
Dim $count
Dim $miLayout
;take screenshot
$sTargetImage = @DesktopDir & "\New Smartbot\Player_tgt.jpg"
_ScreenCapture_Capture($sTargetImage, 37, 260, 291, 289, $fCursor = False);233
$miDoc = ObjCreate("MODI.Document")
$miDocView = ObjCreate("MiDocViewer.MiDocView")
$Viewer = GUICreate ( "Embedded MODI Viewer", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2)
GUICtrlCreatePic ( $sTargetImage, 320, 290, 0, 0)
GUICtrlSetResizing ($Viewer, $GUI_DOCKAUTO)
GUISetBkColor(0xFFFFFF)
GUISetState ()
$MiDocView.Document = $miDoc
$MiDocView.SetScale (1, 1)
_ScreenCapture_Capture($sTargetImage, 250, 250, 750, 600, $fCursor = False)
GUISetState (@SW_HIDE)
$miDoc.Create(@DesktopDir & "\New Smartbot\Player_tgt.jpg")
$miDoc.Ocr($miLANG_ENGLISH, True, False)
$i = 0
For $oWord in $miDoc.Images(0).Layout.Words
$str = $str & $oWord.text & @CrLf
ConsoleWrite("FROM GETPLAYER: " & $oWord.text & @CrLf)
$sArray [$i] = $oWord.text
$i += 1
Next
return $sArray [0]
EndFunc
Currently the bot is failing at
GUISetBkColor(0xFFFFFF)
GUISetState ()
$MiDocView.Document = $miDoc <--------------HERE
$MiDocView.SetScale (1, 1)
_ScreenCapture_Capture($sTargetImage, 250, 250, 750, 600, $fCursor = False)
With this error
C:\XXXX\XXXXX\XXXXX\ (New).au3 (296) : ==> Variable must be of type "Object".:
$MiDocView.Document = $miDoc
$MiDocView^ ERROR
I am no expert at Autoit and i am just learning as i go but currently this problem has me stumped
Hope i provided enough info, if not i can provide more