0

So I have some code setup in vbscript and need to set the location of a msgbox

Dim max,min,ypos
max=13000
min=0
Randomize
ypos = Int((max-min+1)*Rnd+min)

Dim max1,min1,xpos
max1=23250
min1=0
Randomize
xpos = Int((max-min+1)*Rnd+min)

box=msgbox ("Subtext" ,0, "Text")

I'd like to use xpos for the X, and ypos for the Y Also I use notepad, don't judge me.

  • What's wrong with Notepad? Used it for years. – user692942 Nov 02 '21 at 10:44
  • 1
    If you look at [the official documentation](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/t0aew7h6(v=vs.84)) you'll see there is no option for adjusting the position of the [`MsgBox()` function](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/sfw6660x(v=vs.84)). You're only option would be using a custom popup through an HTA. See [Adding a GUI to VBScript](https://stackoverflow.com/q/16052534) – user692942 Nov 02 '21 at 10:47
  • 1
    Does this answer your question? [Adding a GUI to VBScript](https://stackoverflow.com/questions/16052534/adding-a-gui-to-vbscript) – user692942 Nov 02 '21 at 10:48
  • Here's another custom MsgBox using HTA. Replace the code that centers the dialog with your random position code: https://stackoverflow.com/questions/69486975/am-i-able-to-embed-hta-code-into-vbscript/69490793#69490793 – LesFerch Nov 02 '21 at 12:08
  • @LesFerch difference is that dup target is from 8 years ago your link answer is from last month. – user692942 Nov 02 '21 at 18:39

0 Answers0