0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

vbsの作法 その92

Posted at

概要

vbsの作法、調べてみた。
練習問題やってみた。

練習問題

zundokoをIE11で表示せよ。

写真

image.png

サンプルコード

Class ohicompo0
	Private objIE
	Private Sub Class_Initialize
		Set objIE = CreateObject("InternetExplorer.Application")
		objIE.Visible = true
		objIE.Top = 50
		objIE.Left = 100
		objIE.Width = 500
		objIE.Height = 400
		objIE.Navigate("about:blank")
		objIE.StatusBar = False
		objIE.ToolBar = 0
		objIE.Document.Write("<html><head><title>ohicompo0</title></head>")
		objIE.Document.Write("<body bgcolor='pink'>")
		objIE.Document.Write("<div id='div-id-1'></div><br>")
		objIE.Document.Write("<textarea id='out' rows='13' cols='40'></textarea>")
		objIE.Document.Write("</body></html>")
	End Sub
	Private Sub Class_Terminate
		'MsgBox "ウインドウオブジェクト 解放", vbOKOnly + vbInformation, "ウインドウオブジェクト インスタンス "
	End Sub
	Public Sub text(str)
		objIE.Document.getElementById("out").InnerText = str
	End Sub
	Public Sub owari()
		objIE.Quit
	End Sub
End Class

Dim str
str = ""
Dim zudo(1)
zudo(0) = "ズン" & vbcrlf
zudo(1) = "ドコ" & vbcrlf
Dim count
count = 0
Randomize
Do
	Dim i
	i = Int(Rnd * 2)
	str = str & zudo(i)
	If i = 0 Then
		If count <= 4 then
			count = count + 1
		End if
	Else
		If count >= 4 Then
			Exit Do
		Else
			count = 0
		End If
	End If
Loop
str = str & " キ・ヨ・シ!"

Dim w1
Set w1 = new ohicompo0
w1.text str







以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?