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の作法 その94

Posted at

概要

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

練習問題

位置情報CSVをIE11で表示せよ。

写真

image.png

サンプルコード


Class ohicompo2
	Private objIE
	Private Sub Class_Initialize
		Set objIE = CreateObject("InternetExplorer.Application")
		objIE.Visible = true
		objIE.Top = 100
		objIE.Left = 100
		objIE.Width = 500
		objIE.Height = 600
		objIE.Navigate("about:blank")
		objIE.StatusBar = False
		objIE.ToolBar = 0
		objIE.Document.Write "<html><head><title>ohicompo2</title>"
		objIE.Document.Write "<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.3/leaflet.min.css' />"
		objIE.Document.Write "<script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.3/leaflet.js'></script></head><body>"
		objIE.Document.Write "<div id='map' style='width:100%; height:70vh'></div>"
		objIE.Document.Write "<input id='btn' type='submit' value='run' onclick='run()'><br>"
		objIE.Document.Write "<textarea id='src'rows='4' cols='30'></textarea>"
		objIE.Document.Write "<script type='text/javascript'>"
		objIE.Document.Write "var map = L.map('map').setView([38.0748331, 139.4574997], 9);"
		objIE.Document.Write "L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {"
		objIE.Document.Write "    attribution: '&copy; <a href=""http://osm.org/copyright"">OpenStreetMap</a> contributors'"
		objIE.Document.Write "}).addTo(map);"
		objIE.Document.Write "function run() {var line = src.value.split('\n');for (var i = 0; i < line.length; i++){"
		objIE.Document.Write "var item = line[i].split(',');var marker = new L.Marker([item[1], item[2]], {"
		objIE.Document.Write "title: item[0]}); marker.addTo(map);};}"
		objIE.Document.Write "</script></body></html>"
	End Sub
	Private Sub Class_Terminate
	End Sub
	Public Sub text(str)
		objIE.Document.getElementById("src").InnerText = str
	End Sub
	Public Sub run()
		objIE.Document.getElementById("btn").Click()
	End Sub
	Public Sub owari()
		objIE.Quit
	End Sub
End Class

Dim str
str = ""
str = str + "P1, 38.077908, 139.542229" + vbcrlf
str = str + "P2, 38.075618, 139.642032" + vbcrlf
str = str + "P3, 38.0738618, 139.441726" + vbcrlf
Dim w1
Set w1 = new ohicompo2
WScript.Sleep 1000
w1.text str
w1.run







以上

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?