msgbox is too long for screen, anyway to view whats cut off the screen?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
autohotkeycool
Posts: 137
Joined: 24 May 2016, 08:23

msgbox is too long for screen, anyway to view whats cut off the screen?

Post by autohotkeycool » 13 Dec 2020, 15:17

Im using this script but the problem is that I cant view whats written at the bottom, its cuts off on my screen around two thirds the way through the box. I wonder if you can rotate the msgbox 90 degrees or something like that

Code: Select all

URL := "https://attheraces.com/racecard/Catterick/15-December-2020/1455/pacechart" 
    tooltip Downloading page
    page:=download(URL) ; Download page to memory
    tooltip

    document := ComObjCreate("HTMLFile") ; Create an HTML file in memory
    document.write(page)

    elements:=document.getElementsByClassName("card-entry") ; Get elements with class "card-entry"
    loop {
        try ele:=elements[A_Index-1] ; loop through each element
        catch ; Above line gives error when we run out of elements
            break ; Then we break out of loop
        msgbox % ele.innerText ; Display its innerText for example
    }

    return


    ;Ref: https://www.autohotkey.com/docs/commands/URLDownloadToFile.htm#WHR
    Download(url){
        whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
        whr.Open("GET", url, true)
        whr.Send()
        whr.WaitForResponse()
        return whr.ResponseText
    }

User avatar
mikeyww
Posts: 26937
Joined: 09 Sep 2014, 18:38

Re: msgbox is too long for screen, anyway to view whats cut off the screen?

Post by mikeyww » 13 Dec 2020, 15:33

When I ran the script, it showed an error at line 25.

Bottom line in any case: if you're trying to show a boatload of text, another approach (e.g., GUI) would be better.

Code: Select all

width := A_ScreenWidth - 350, height := A_ScreenHeight - 350
bunchOfText =
(
this
that
and
the
other
)
Gui, Font, s10
Gui, Add, Edit, w%width% h%height%, %bunchOfText%
Gui, Show,, Text
Send ^{Home}
Return

GuiEscape:
GuiClose:
ExitApp

User avatar
JoeWinograd
Posts: 2200
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: msgbox is too long for screen, anyway to view whats cut off the screen?

Post by JoeWinograd » 13 Dec 2020, 15:58

Numerous ways to handle this. mikey mentioned one...a GUI. Another way is to write the output to a file instead of using MsgBox to display it. For example, define a file at the top of the script, such as:

Code: Select all

OutputFile:=A_Temp . "\download.txt" ; name it whatever you want and put it wherever you want
FileDelete,%OutputFile% ; reset it for each run
Then change the MsgBox to:

Code: Select all

FileAppend,% ele.innerText "`n",%OutputFile% ; add it to output file
Before the script exits, you can add this command, if you want, to open the results file (in whatever program owns the TXT file type on your system):

Code: Select all

Run,%OutputFile% ; open output file
Regards, Joe

Post Reply

Return to “Ask for Help (v1)”