问题
In VBS script, I have created a simple message box application. It currently stays in front of all windows until the user responds and uses very simple coding
X=MsgBox("Test Text" ,1+4069, "Test Title")
But it always appears in the same place. Is there any way of making it appear in a random place on the screen? Please help!
回答1:
There is one type of box which allows you to position it on the screen: InputBox
Title = "Hello"
DefaultValueText = "Hello Stackoverflow !"
message = "Type something here"
XPos = 0
YPos = 0
Text = InputBox(message,Title,DefaultValueText,XPos,YPos)
XPos = 3000
YPos = 800
Text = InputBox(message,Title,DefaultValueText,XPos,YPos)
回答2:
@Hackoo was almost there, I used his and here is what I made out of it.
dim r
randomize
r = int(rnd*500) + 1
r2 = int(rnd*1500) + 1
Title = "Hello"
DefaultValueText = "Hello!"
message = "Type something here!"
XPos = r
YPos = r2
Text = InputBox(message,Title,DefaultValueText,XPos,YPos)
来源:https://stackoverflow.com/questions/37111397/how-can-i-make-a-vbs-message-box-appear-in-a-random-place