BusyWait

引数に指定したInternetExplorerオブジェクトの読み込みが完了するのを待ちます。

構文
BusyWait( IE )
引数
IE
IEオブジェクト
戻値

プログラム

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND

解説

  1. 2行目
    	SLEEP(0.500)
    
    読み込み始める前にループを抜けるの防ぐための待機。
  2. 3行目
    	DIM t = GETTIME()
    
    タイマー計測用の変数tを宣言。現在の時刻を代入。
  3. 5-10行目
    		REPEAT
    			DIM tm = GETTIME() - t
    			FUKIDASI("BusyWait:" + tm)
    			SLEEP(0.010)
    			IF tm >= 60 THEN BREAK
    		UNTIL !IE.Busy AND IE.readyState = 4
    
    変数tからの経過時間を変数tmに代入し、吹き出しに表示。ページの読み込みが完了もしくは60秒以上経過でループを抜ける。エラー発生時は12行目>>>
  4. 12-14行目
    		IE = getIEObj(-1)
    		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
    		BusyWait(IE)
    
    一番最後に開いたInternetExplorerオブジェクトを取得し、BusyWaitを再帰呼び出し。
  5. 16行目
    	FUKIDASI()
    
    吹き出しを消す。

読み込みが完了しない場合

  • 閲覧履歴やキャッシュを削除する。
  • 必要のないアドオンを無効にする。

特定のページの読み込みが遅い場合画像広告等の読み込みに時間が掛かっている場合があるので、広告ブロックのアドオン(AdBlockとか)を入れるのも効果があるかもしれません。

プログラム実行例

xmlのバージョンを取得する

DIM IE = IEBoot()
IE.Navigate("http://uwsc.s1007.xrea.com/sitemap.xml")
BusyWait(IE)

PRINT IE.document.xmlVersion

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND

//////////////////////////////////////////////////
// 【引数】
//   InPrivate : InPrivateブラウズ・モードを有効にするときはTRUEを指定(デフォルトはFALSE) 
// 【戻値】
//   InternetExplorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION IEBoot(InPrivate = FALSE)
	DIM IE
	SELECT InPrivate
		CASE TRUE
			DOSCMD("start iexplore -private")
			GETID("InPrivate - Internet Explorer - [InPrivate]", "IEFrame", -1)
			IE = GETACTIVEOLEOBJ("InternetExplorer.Application","InPrivate - Internet Explorer - [InPrivate]")
		CASE FALSE
			TRY
				IE = CREATEOLEOBJ("InternetExplorer.Application")
				IE.Visible = TRUE
			EXCEPT
				EXEC("C:\Program Files\Internet Explorer\iexplore.exe")
				GETID("Internet Explorer", "IEFrame", -1)
				TRY
					IE = GETACTIVEOLEOBJ("InternetExplorer.Application")	
				EXCEPT
					IE = getIEObj(-1)
				ENDTRY
			ENDTRY
	SELEND
	RESULT = IE
FEND
  1. udf.IEBoot(1)
  2. udf.BusyWait(3)
  3. DOM.Document.xmlVersion(5)
結果
1.0

[ファイルを開く]ウィンドウを表示

CONST OLECMDID_OPEN = 1
CONST OLECMDEXECOPT_DODEFAULT = 0

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.GoHome()
BusyWait(IE)

IE.ExecWB(OLECMDID_OPEN, OLECMDEXECOPT_DODEFAULT)

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND
  1. script.function.CREATEOLEOBJ(4)
  2. com.IE.Visible(5)
  3. com.IE.GoHome(6)
  4. udf.BusyWait(7)
  5. com.IE.ExecWB(9)
結果
ファイルを開く

[Webページの保存]ウィンドウを表示

CONST OLECMDID_SAVEAS = 4
CONST OLECMDEXECOPT_DODEFAULT = 0

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.GoHome()
BusyWait(IE)

IE.ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_DODEFAULT)

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND
  1. script.function.CREATEOLEOBJ(4)
  2. com.IE.Visible(5)
  3. com.IE.GoHome(6)
  4. udf.BusyWait(7)
  5. com.IE.ExecWB(9)
結果
Webページの保存

[印刷]ウィンドウを表示

CONST OLECMDID_PRINT = 6
CONST OLECMDEXECOPT_DODEFAULT = 0

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.GoHome()
BusyWait(IE)

IE.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT)

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND
  1. script.function.CREATEOLEOBJ(4)
  2. com.IE.Visible(5)
  3. com.IE.GoHome(6)
  4. udf.BusyWait(7)
  5. com.IE.ExecWB(9)
結果
印刷

[印刷プレビュー]ウィンドウを表示

CONST OLECMDID_PRINTPREVIEW = 7
CONST OLECMDEXECOPT_DODEFAULT = 0

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.GoHome()
BusyWait(IE)

IE.ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT)

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND
  1. script.function.CREATEOLEOBJ(4)
  2. com.IE.Visible(5)
  3. com.IE.GoHome(6)
  4. udf.BusyWait(7)
  5. com.IE.ExecWB(9)
結果
印刷プレビュー

[ページ設定]ウィンドウを表示

CONST OLECMDID_PAGESETUP = 8
CONST OLECMDEXECOPT_DODEFAULT = 0

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.GoHome()
BusyWait(IE)

IE.ExecWB(OLECMDID_PAGESETUP, OLECMDEXECOPT_DODEFAULT)

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND
  1. script.function.CREATEOLEOBJ(4)
  2. com.IE.Visible(5)
  3. com.IE.GoHome(6)
  4. udf.BusyWait(7)
  5. com.IE.ExecWB(9)
結果
ページ設定

[プロパティ]ウィンドウを表示

CONST OLECMDID_PROPERTIES = 10
CONST OLECMDEXECOPT_DODEFAULT = 0

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.GoHome()
BusyWait(IE)

IE.ExecWB(OLECMDID_PROPERTIES, OLECMDEXECOPT_DODEFAULT)

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND
  1. script.function.CREATEOLEOBJ(4)
  2. com.IE.Visible(5)
  3. com.IE.GoHome(6)
  4. udf.BusyWait(7)
  5. com.IE.ExecWB(9)
結果
プロパティ

GoBackとGoForwardを使った例

DIM IE = IEBoot()
IE.Navigate("http://www.google.com")
BusyWait(IE)

IE.Navigate("https://www.yahoo.co.jp")
BisyWait(IE)

IE.GoBack          // 前のページ(Google)を開く
BusyWait(IE)
SLEEP(5.000)

IE.GoForward       // 次のページ(Yahoo!)を開く
BusyWait(IE)
SLEEP(5.000)

IE.Quit

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND

//////////////////////////////////////////////////
// 【引数】
//   InPrivate : InPrivateブラウズ・モードを有効にするときはTRUEを指定(デフォルトはFALSE) 
// 【戻値】
//   InternetExplorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION IEBoot(InPrivate = FALSE)
	DIM IE
	SELECT InPrivate
		CASE TRUE
			DOSCMD("start iexplore -private")
			GETID("InPrivate - Internet Explorer - [InPrivate]", "IEFrame", -1)
			IE = GETACTIVEOLEOBJ("InternetExplorer.Application","InPrivate - Internet Explorer - [InPrivate]")
		CASE FALSE
			TRY
				IE = CREATEOLEOBJ("InternetExplorer.Application")
				IE.Visible = TRUE
			EXCEPT
				EXEC("C:\Program Files\Internet Explorer\iexplore.exe")
				GETID("Internet Explorer", "IEFrame", -1)
				TRY
					IE = GETACTIVEOLEOBJ("InternetExplorer.Application")	
				EXCEPT
					IE = getIEObj(-1)
				ENDTRY
			ENDTRY
	SELEND
	RESULT = IE
FEND
  1. udf.IEBoot(1)
  2. com.IE.Navigate(2,5)
  3. udf.BusyWait(3,6,9,13)
  4. script.function.SLEEP(10,14)
  5. com.IE.GoBack(8)
  6. com.IE.GoForward(12)

Yahoo! JAPANトップページのメニューを取得

IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.Navigate("http://yahoo.co.jp")
BusyWait(IE)

DIM element = IE.document.getElementById("ToolList")
DIM elements = element.getElementsByTagName("li")

FOR element IN elements
	PRINT element.textContent
NEXT

IE.Quit

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   interval : 時間単位(yyyy︰年、m︰月、d︰日) 
//   date1 : 日時1 
//   date2 : 日時2 
// 【戻値】
//   date2からdate1を引いた日数を求めます。 
//////////////////////////////////////////////////
FUNCTION dateDiff(interval, date1, date2)
	DIM y1, y2, m1, m2, d1, d2, d
	SELECT interval
		CASE "yyyy"
			GETTIME(0, date1)
			y1 = G_TIME_YY
			GETTIME(0, date2)
			y2 = G_TIME_YY
			d = y2 - y1
		CASE "m"
			GETTIME(0, date1)
			y1 = G_TIME_YY
			m1 = G_TIME_MM
			GETTIME(0, date2)
			y2 = G_TIME_YY
			m2 = G_TIME_MM
			d = (y2 - y1) * 12 + m2 - m1
		CASE "d"
			d1 = GETTIME(0, date1)
			d2 = GETTIME(0, date2)
			d = (d2 - d1) / 86400
	SELEND
	RESULT = d
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND

//////////////////////////////////////////////////
// 【引数】
//   数値 : GETTIMEで取得した曜日の番号(G_TIME_WW=0:日曜….6:土曜) 
//   フォーマット : 以下のアルファベットは数値で指定した対応する曜日に置き換えられます。(aaa : 日〜土、aaaa : 日曜日〜土曜日、ddd : Sun〜Sat、dddd : Sunday〜Saturday) 
// 【戻値】
//   数値をフォーマットした文字列を返します。 
//////////////////////////////////////////////////
FUNCTION getWeekdayName(num, format = "aaa")
	DIM re = CREATEOLEOBJ("VBScript.RegExp")
	DIM aaa[] = "日", "月", "火", "水", "木", "金", "土";
	DIM aaaa[] = "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日";
	DIM ddd[] = "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat";
	DIM dddd[] = "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday";
	match = reExecute(format, "(a|d)+")
	type = match.Item(0).Value
	RESULT = reReplace(format, EVAL(type + "[" + num + "]"), type)
FEND

//////////////////////////////////////////////////
// 【引数】
//   シリアル値 : 時間を表すシリアル値を指定 
// 【戻値】
//   例)0…00、0.5…12、1.0…24 
//////////////////////////////////////////////////
FUNCTION Hour(serial)
	RESULT = REPLACE(FORMAT(INT(serial * 24), 2), " ", "0")
FEND

//////////////////////////////////////////////////
// 【引数】
//   expr : 評価する式 
//   truepart : 評価した式がTrueのときに返す値 
//   falsepart : 評価した式がFalseのときに返す値 
// 【戻値】
//   truepart : 評価した式がTrueのとき、falsepart : 評価した式がFalseのとき 
//////////////////////////////////////////////////
FUNCTION IIF(expr, truepart, falsepart)
	IFB EVAL(expr) THEN
		RESULT = truepart
	ELSE
		RESULT = falsepart
	ENDIF
FEND

//////////////////////////////////////////////////
// 【引数】
//   str : 正規表現による検索の対象となる文字列 
//   Pattern : 正規表現で使用するパターンを設定 
//   IgnoreCase : 大文字・小文字を区別しない場合はTrue、区別する場合はFalse 
//   Global : 文字列全体を検索する場合はTrue、しない場合はFalse 
// 【戻値】
//   正規表現で検索した結果をMatchesコレクションとして返します。 
//////////////////////////////////////////////////
FUNCTION reExecute(str, Pattern, IgnoreCase = TRUE, Global = TRUE)
	DIM re = CREATEOLEOBJ("VBScript.RegExp")
	re.Pattern = Pattern
	re.IgnoreCase = IgnoreCase
	re.Global = Global
	RESULT = re.Execute(str)
FEND

//////////////////////////////////////////////////
// 【引数】
//   str1 : 置換される文字列 
//   str2 : 置換後の文字列 
//   Pattern : 置換する文字列のパターン 
//   IgnoreCase : 大文字・小文字を区別しない場合はTrue、区別する場合はFalse 
//   Global : 文字列全体を検索する場合はTrue、しない場合はFalse 
// 【戻値】
//   正規表現置換後の文字列 
//////////////////////////////////////////////////
FUNCTION reReplace(str1, str2, Pattern, IgnoreCase = TRUE, Global = TRUE)
	DIM re = CREATEOLEOBJ("VBScript.RegExp")
	re.Pattern = Pattern
	re.IgnoreCase = IgnoreCase
	re.Global = Global
	RESULT = re.Replace(str1, str2)
FEND

//////////////////////////////////////////////////
// 【引数】
//   str : 正規表現による検索の対象となる文字列 
//   Pattern : 正規表現で使用するパターンを設定 
//   IgnoreCase : 大文字・小文字を区別しない場合はTrue、区別する場合はFalse 
//   Global : 文字列全体を検索する場合はTrue、しない場合はFalse 
// 【戻値】
//   正規表現にマッチするかどうか 
//////////////////////////////////////////////////
FUNCTION reTest(str, Pattern, IgnoreCase = TRUE, Global = TRUE)
	DIM re = CREATEOLEOBJ("VBScript.RegExp")
	re.Pattern = Pattern
	re.IgnoreCase = IgnoreCase
	re.Global = Global
	RESULT = re.Test(str)
FEND

//////////////////////////////////////////////////
// 【引数】
//   inputs : 繰り返す文字列 
//   multiplier : inputsを繰り返す回数 
// 【戻値】
//   inputsをmultiplier回を繰り返した文字列を返します 
//////////////////////////////////////////////////
FUNCTION strRepeat(inputs, multiplier)
	DIM res = ""
	FOR n = 1 TO multiplier
		res = res + inputs
	NEXT
	RESULT = res
FEND

//////////////////////////////////////////////////
// 【引数】
//   serial : シリアル値 
//   format : フォーマット 
// 【戻値】
//   数値を表示書式に基づいて変換した文字列 
//////////////////////////////////////////////////
FUNCTION text(serial, format, hour12 = FALSE)
	HASHTBL startDate
	startDate["明治"] = "1868/01/25"
	startDate["大正"] = "1912/07/30"
	startDate["昭和"] = "1926/12/25"
	startDate["平成"] = "1989/01/08"
	startDate["令和"] = "2019/05/01"
	
	DIM baseDate = "1899/12/30"
	
	SELECT TRUE
		CASE reTest(format, "\[h+\]")
			Matches = reExecute(format, "\[(h+)\]")
			DIM hour = iif(hour12, Hour(serial) MOD 12, Hour(serial))
			RESULT = text(hour, strRepeat("0", LENGTH(Matches.Item(0).SubMatches(0))))
		CASE reTest(format, "^h+$")
			Matches = reExecute(format, "^(h+)$")
			hour = iif(hour12, Hour(serial) MOD 12, Hour(serial))
			RESULT = text(hour MOD 24, strRepeat("0", LENGTH(Matches.Item(0).SubMatches(0))))
		CASE reTest(format, "\[m+\]")
			Matches = reExecute(format, "\[(m+)\]")
			RESULT = text(serial * 1440, strRepeat("0", LENGTH(Matches.Item(0).SubMatches(0))))
		CASE format = "m"
			GETTIME(serial, baseDate)
			RESULT = text(G_TIME_MM, "0")
		CASE format = "mm"
			GETTIME(serial, baseDate)
			RESULT = G_TIME_MM2
		CASE format = "n"
			GETTIME(serial, baseDate)
			RESULT = G_TIME_NN
		CASE format = "nn"
			GETTIME(serial, baseDate)
			RESULT = G_TIME_NN2
		CASE format = "s"
			GETTIME(serial, baseDate)
			RESULT = text(G_TIME_SS, "0")
		CASE format = "ss"
			GETTIME(serial, baseDate)
			RESULT = G_TIME_SS2
		CASE format = "yyyy"
			GETTIME(serial, baseDate)
			RESULT = G_TIME_YY4
		CASE format = "yy"
			GETTIME(serial, baseDate)
			RESULT = COPY(G_TIME_YY4, 3, 2)
		CASE format = "e"
			SELECT TRUE
				CASE dateDiff("d", startDate["令和"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(serial, "yyyy") - 2018
				CASE dateDiff("d", startDate["平成"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(serial, "yyyy") - 1988
				CASE dateDiff("d", startDate["昭和"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(serial, "yyyy") - 1925
				CASE dateDiff("d", startDate["大正"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(serial, "yyyy") - 1911
				CASE dateDiff("d", startDate["明治"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(serial, "yyyy") - 1867
			SELEND
		CASE format = "ee"
			SELECT TRUE
				CASE dateDiff("d", startDate["令和"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(text(serial, "yyyy") - 2018, "00")
				CASE dateDiff("d", startDate["平成"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(text(serial, "yyyy") - 1988, "00")
				CASE dateDiff("d", startDate["昭和"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(text(serial, "yyyy") - 1925, "00")
				CASE dateDiff("d", startDate["大正"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(text(serial, "yyyy") - 1911, "00")
				CASE dateDiff("d", startDate["明治"], text(serial, "yyyy/mm/dd")) >= 0
					RESULT = text(text(serial, "yyyy") - 1867, "00")
			SELEND
		CASE format = "g"
			SELECT TRUE
				CASE dateDiff("d", startDate["令和"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "R"
				CASE dateDiff("d", startDate["平成"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "H"
				CASE dateDiff("d", startDate["昭和"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "S"
				CASE dateDiff("d", startDate["大正"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "T"
				CASE dateDiff("d", startDate["明治"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "M"
			SELEND
		CASE format = "gg"
			RESULT = COPY(text(serial, "ggg"), 1, 1)
		CASE format = "ggg"
			SELECT TRUE
				CASE dateDiff("d", startDate["令和"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "令和"
				CASE dateDiff("d", startDate["平成"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "平成"
				CASE dateDiff("d", startDate["昭和"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "昭和"
				CASE dateDiff("d", startDate["大正"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "大正"
				CASE dateDiff("d", startDate["明治"], text(serial, "yyyy/mm/dd")) >= 0;		RESULT = "明治"
			SELEND
		CASE format = "mmmmm"
			RESULT = COPY(text(serial, "mmmm"), 1, 1)
		CASE format = "mmmm"
			DIM month[] = "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
			RESULT = month[text(serial, "m") - 1]
		CASE format = "mmm"
			RESULT = COPY(text(serial, "mmmm"), 1, 3)
		CASE format = "dd"
			GETTIME(serial, baseDate)
			RESULT = text(G_TIME_DD2, "00")
		CASE format = "d"
			GETTIME(serial, baseDate)
			RESULT = text(G_TIME_DD, "0")
		CASE reTest(format, "^[ad]{3,4}$")
			Matches = reExecute(format, "([ad]{3,4})")
			GETTIME(serial, baseDate)
			RESULT = getWeekdayName(G_TIME_WW, Matches.Item(0).SubMatches(0))
		CASE reTest(format, "(0+\.?0+)?%")
			Matches = reExecute(format, "(0+\.?0+)?%")
			RESULT = text(serial * 100, Matches.Item(0).SubMatches(0)) + "%"
		CASE reTest(format, "^\[DBNum\d{1,4}\](.*?)$")
			Matches = reExecute(format, "^\[DBNum(\d{1,4})\](.*?)$")
			DIM value = VAL(Matches.Item(0).SubMatches(0))
			DIM sss = text(serial, Matches.Item(0).SubMatches(1))
			Matches = reExecute(sss, "(\D+)?(\d+)(\D+)?")
			DIM res = ""
			FOR m = 0 TO Matches.Count - 1
				serial = Matches.Item(m).SubMatches(1)
				SELECT value
					CASE 1, 2
						DIM n[][9] = "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九", + _
										"", "壱", "弐", "参", "四", "伍", "六", "七", "八", "九"
						DIM a[][3] = "", "十", "百", "千", + _
										"", "拾", "百", "阡"
						DIM b[][3] = "", "万", "億", "兆", + _
										"", "萬", "億", "兆"
						DIM r = ""
						DIM j = 0
						type = value - 1
						REPEAT
							DIM str = ""
							DIM n4 = serial MOD 10000
							FOR i = LENGTH(n4) TO 1 STEP -1
								s = COPY(n4, i, 1)
								IFB s = 1 AND a[type][LENGTH(n4)-i] <> "" THEN
									str = IIF(s, a[type][LENGTH(n4)-i], "") + str
								ELSE	
									str = n[type][s] + IIF(s, a[type][LENGTH(n4)-i], "") + str
								ENDIF
							NEXT
							IF str <> "" THEN r = str + b[type][j] + r
							j = j + 1
							serial = INT(serial / 10000)
						UNTIL serial = 0
						res = res + Matches.Item(m).SubMatches(0) + r + Matches.Item(m).SubMatches(2)
					CASE 3
						res = res + Matches.Item(m).SubMatches(0) + STRCONV(serial, SC_FULLWIDTH) + Matches.Item(m).SubMatches(2)
					CASE 4
						res = res + Matches.Item(m).SubMatches(0) + STRCONV(serial, SC_HALFWIDTH) + Matches.Item(m).SubMatches(2)
				SELEND
			NEXT
			RESULT = res
		CASE reTest(format, "^(.*?)(AM\/PM|am\/pm|A\/P|a\/p)(.*?)$")
			Matches = reExecute(format, "^(.*?)(AM\/PM|am\/pm|A\/P|a\/p)(.*?)$")
			DIM array = SPLIT(Matches.Item(0).SubMatches(1), "/")
			ampm = array[IIF(serial - INT(serial) >= 0.5, 1, 0)]
			hour12 = TRUE
			res = ""
			WITH Matches.Item(0)
				res = text(serial, .SubMatches(0), hour12) + ampm + text(serial, .SubMatches(2), hour12)
			ENDWITH
			RESULT = res
		CASE reTest(format, "([^ymdagehns]{0,})?(([ymdagehns])\3{0,})([^ymdagehns]+)?")
			Matches = reExecute(format, "([^ymdagehns]{0,})?(([ymdagehns])\3{0,})([^ymdagehns]+)?")
			FOR n = 0 TO Matches.Count - 1
				IF n = 0 THEN res = Matches.Item(n).SubMatches(0)
			NEXT
			FOR n = 0 TO Matches.Count - 1
				WITH Matches.Item(n)
					res = res + text(serial, .SubMatches(1), hour12) + .SubMatches(3)
				ENDWITH
			NEXT
			RESULT = res
		CASE reTest(format, "(0+)\.?(0+)?") AND UBound(SPLIT(format, ".")) <= 1 
			Matches = reExecute(format, "(0+)\.?(0+)?")
			len1 = LENGTH(Matches.Item(0).SubMatches(0))
			len2 = LENGTH(Matches.Item(0).SubMatches(1))
			DIM arr[] = LENGTH(INT(serial)), len1
			IFB POS(".", format) THEN
				RESULT = REPLACE(FORMAT(serial, CALCARRAY(arr, CALC_MAX) + len2 + 1, len2), " ", "0")
			ELSE
				RESULT = REPLACE(FORMAT(serial, CALCARRAY(arr, CALC_MAX)), " ", "0")
			ENDIF
	SELEND
FEND

//////////////////////////////////////////////////
// 【引数】
//   配列 : 上限値を求める配列 
// 【戻値】
//   配列の上限値 
//////////////////////////////////////////////////
FUNCTION UBound(array[])
	RESULT = RESIZE(array)
FEND
<div id="ToolList">
	<ul>
		<li>ショッピング</li>
		<li>PayPayモール</li>
		<li>ヤフオク!</li>
		<li>PayPayフリマ</li>
		<li>ZOZOTOWN</li>
		<li>LOHACO</li>
		<li>トラベル</li>
		<li>一休.com</li>
		<li>一休.comレストラン</li>
		<li>ニュース</li>
		<li>天気・災害</li>
		<li>スポーツナビ</li>
		<li>ファイナンス</li>
		<li>テレビ</li>
		<li>映画</li>
		<li>GYAO!</li>
		<li>ゲーム</li>
		<li>Yahoo!モバゲー</li>
		<li>ebookjapan</li>
		<li>占い</li>
		<li>地図</li>
		<li>路線情報</li>
		<li>Retty</li>
		<li>クラシル</li>
		<li>不動産</li>
		<li>自動車</li>
		<li>TRILL
		<li>パートナー</li>
	</ul>
</div>
  1. script.function.CREATEOLEOBJ(1)
  2. com.IE.Visible(2)
  3. com.IE.Navigate(3)
  4. udf.BusyWait(4)
  5. com.IE.Document(Δ,7])
  6. dom.Document.getElementById(6)
  7. dom.Document.getElementsByTagName(7)
結果
ショッピング
PayPayモール
ヤフオク!
PayPayフリマ
ZOZOTOWN
LOHACO
トラベル
一休.com
一休.comレストラン
ニュース
天気・災害
スポーツナビ
ファイナンス
テレビ
映画
GYAO!
ゲーム
Yahoo!モバゲー
ebookjapan
占い
地図
路線情報
Retty
クラシル
不動産
自動車
TRILL
パートナー

気象庁のホームページから一月分の気温を取得しExcelでグラフを作成

CONST xlUp = -4162
CONST xlLineMarkers = 65

DIM year = 2020
DIM month = 8

DIM IE = IEBoot()
IE.Navigate("https://www.data.jma.go.jp/obd/stats/etrn/view/daily_s1.php?prec_no=14&block_no=47412&year=" + year + "&month=" + month + "&day=&view=p1")
BusyWait(IE)

DIM array[-1][-1]
DIM element = IE.document.getElementById("tablefix1")
getTableData(element, array)

IE.Quit

DIM Excel = XLOPEN()
DIM SheetName = Excel.ActiveSheet.Name

XLSETDATA(Excel, array, "A1")

DIM row = Excel.Cells(Excel.Rows.Count, 1).End(xlUp).Row
DIM Charts = Excel.Charts.Add

WITH Charts
	.ChartType = xlLineMarkers
	.SeriesCollection.NewSeries
	.HasTitle = TRUE
	.ChartTitle.Text = "札幌 " + year + "年" + month + "月気温"

	WITH .FullSeriesCollection(1)
		.XValues = "=Sheet1!$A$5:$A$35"
		.Name = "=<#DBL>最高気温<#DBL>"
		.Values = "=Sheet1!$H$5:$H$35"
		WITH .Format
			.Fill.ForeColor.RGB = 255
			.Line.ForeColor.RGB = 255
		ENDWITH
	ENDWITH

	WITH .FullSeriesCollection(2)
		.XValues = "=Sheet1!$A$5:$A$35"
		.Name = "=<#DBL>最高気温<#DBL>"
		.Values = "=Sheet1!$I$5:$I$35"
		WITH .Format
			.Fill.ForeColor.RGB = 16711680
			.Line.ForeColor.RGB = 16711680
		ENDWITH
	ENDWITH
ENDWITH

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND

//////////////////////////////////////////////////
// 【引数】
//   table : tableエレメント 
//   arr : 取得したデータを格納する配列(参照引数) 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE getTableData(table, Var arr[][])
	rowMax = table.rows.length - 1
	colMax = 0
	FOR row = 0 TO table.rows.length - 1
		IFB table.rows(row).cells.length - 1 > colMax THEN
			colMax = table.rows(row).cells.length - 1
		ENDIF
	NEXT
	DIM arr[rowMax][colMax]
	FOR row = 0 TO table.rows.length - 1
		FOR col = 0 TO table.rows(row).cells.length - 1
			n = 0
			WHILE arr[row][col + n] <> ""
				n = n + 1
			WEND
			arr[row][col + n] = table.rows(row).cells(col).innerText
			// rowSpan(行結合)とcolSpan(列結合)の両方があれば
			IFB table.rows(row).cells(col).rowSpan > 1 AND table.rows(row).cells(col).colSpan > 1 THEN
				rmax = table.rows(row).cells(col).rowSpan - 1
				cmax = table.rows(row).cells(col).colSpan - 1
				FOR r = 1 TO rmax
					FOR c = 1 TO cmax
						arr[row + r][col + c] = "←"
					NEXT
				NEXT
			ENDIF
			// rowSpan(行結合)があれば結合セルに「↑」を代入
			IFB table.rows(row).cells(col).rowSpan > 1 THEN
				n = table.rows(row).cells(col).rowSpan - 1
				WHILE n
					arr[row + n][col] = "↑"
					n = n - 1
				WEND
			ENDIF
			// colSpan(列結合)があれば結合セルに「←」を代入
			IFB table.rows(row).cells(col).colSpan > 1 THEN
				n = table.rows(row).cells(col).colSpan - 1
				WHILE n
					arr[row][col + n] = "←"
					n = n - 1
				WEND
			ENDIF
		NEXT
	NEXT
FEND

//////////////////////////////////////////////////
// 【引数】
//   InPrivate : InPrivateブラウズ・モードを有効にするときはTRUEを指定(デフォルトはFALSE) 
// 【戻値】
//   InternetExplorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION IEBoot(InPrivate = FALSE)
	DIM IE
	SELECT InPrivate
		CASE TRUE
			DOSCMD("start iexplore -private")
			GETID("InPrivate - Internet Explorer - [InPrivate]", "IEFrame", -1)
			IE = GETACTIVEOLEOBJ("InternetExplorer.Application","InPrivate - Internet Explorer - [InPrivate]")
		CASE FALSE
			TRY
				IE = CREATEOLEOBJ("InternetExplorer.Application")
				IE.Visible = TRUE
			EXCEPT
				EXEC("C:\Program Files\Internet Explorer\iexplore.exe")
				GETID("Internet Explorer", "IEFrame", -1)
				TRY
					IE = GETACTIVEOLEOBJ("InternetExplorer.Application")	
				EXCEPT
					IE = getIEObj(-1)
				ENDTRY
			ENDTRY
	SELEND
	RESULT = IE
FEND
  1. udf.IEBoot(7)
  2. com.IE.Navigate(8)
  3. udf.BusyWait(9)
  4. dom.document.getElementById(12)
  5. udf.getTableData(13)
  6. script.function.XLOPEN(17)
  7. com.Excel.Application.ActiveSheet(18)
  8. com.Excel.WorkSheet.Name(18)
  9. script.function.XLSETDATA(20)
  10. com.Excel.Application.Cells(22)
  11. com.Excel.Range.End(22)
  12. com.Excel.Range.Row(22)
  13. com.Excel.Application.Charts(23)
  14. com.Excel.Sheets.Add(23)
  15. com.Excel.Charts(25)
  16. com.Excel.Chart.ChartType(26)
  17. com.Excel.Chart.SeriesCollection(27)
  18. com.Excel.Series(27)
  19. com.Excel.Chart.HasTitle(28)
  20. com.Excel.Chart.ChartTitle(29)
  21. com.Excel.FullSeriesCollection(31,41)
  22. com.Excel.FullSeriesCollection.Item(31,41)
  23. com.Excel.Series.XValues(32,42)
  24. com.Excel.Series.Name(33,43)
  25. com.Excel.Series.Values(34,44)
  26. com.Excel.Series.Format(35,45)
  27. com.Excel.FillFormat.ForeColor(36,46)
結果

歌ネットから歌詞を取得してテキストファイルに保存

CONST ssfDesktop = 0

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.Navigate("https://www.uta-net.com/song/280568/")
BusyWait(IE)

DIM element, elements, name, lyrics

element = IE.document.getElementById("view_kashi")
elements = element.getElementsByClassName("title")
name = TRIM(elements.Item(0).innerText)

element = IE.document.getElementById("kashi_area")
lyrics = element.innerText

IE.Quit

DIM Shell = CREATEOLEOBJ("Shell.Application")
DIM Folder = Shell.NameSpace(ssfDesktop)
DIM path = Folder.Self.Path
DIM FSO = CREATEOLEOBJ("Scripting.FileSystemObject")
path = uniqueFilename(FSO.BuildPath(path, name + ".txt"))

DIM FID = FOPEN(path, F_READ OR F_WRITE)
FPUT(FID, lyrics)
FCLOSE(FID)

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND

//////////////////////////////////////////////////
// 【引数】
//   path : ファイルのパス 
// 【戻値】
//   重複しないファイル名 
//////////////////////////////////////////////////
FUNCTION uniqueFilename(path)
	DIM FSO = CREATEOLEOBJ("Scripting.FileSystemObject")
	IFB FSO.FileExists(path) THEN
		DIM fol = FSO.GetParentFolderName(path)
		DIM filename = FSO.GetBaseName(path)
		DIM extension = FSO.GetExtensionName(path)
		DIM i = 2
		WHILE FSO.FileExists(FSO.BuildPath(fol, filename + " (" + i + ")." + extension))
			i = i + 1
		WEND
		RESULT = FSO.BuildPath(fol, filename + " (" + i + ")." + extension)
	ELSE
		RESULT = path
	ENDIF
FEND
  1. script.function.CREATEOLEOBJ(Α,19,22])
  2. com.IE.Visible(4)
  3. com.IE.Navigate(5)
  4. udf.BusyWait(6)
  5. com.IE.Document(⎖,14])
  6. dom.Document.getElementById(10)
  7. dom.Document.getElementsByClassName(11)
  8. com.Shell.NameSpace(20)
  9. udf.uniqueFilename(23)
  10. script.function.FOPEN(25)
  11. script.function.FPUT(26)
  12. script.function.FCLOSE(27)

環境センサーから位置情報を取得し、Googleマップで表示

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
DIM latitude = SENSOR(SNSR_Location_Latitude)
DIM longitude = SENSOR(SNSR_Location_Longitude)
IE.Navigate("https://www.google.co.jp/maps/@" + latitude + "," + longitude + ",15z?hl=ja")
BusyWait(IE)

// 終了する
// IE.Quit

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND
  1. script.function.CREATEOLEOBJ(1)
  2. com.IE.Visible(2)
  3. script.function.SENSOR(Α,4])
  4. com.IE.Navigate(5)
  5. udf.BusyWait(6)

楽天銀行定期預金の金利をExcelに保存

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.Navigate("https://rbweb.rakuten-bank.co.jp/REF/main/fis/BasicTimeDepositInterestRate.html?PageID=BasicTimeDepositInterestRatePresentationLogicBean")
BusyWait(IE)

DIM elements = IE.document.getElementsByTagName("table")
DIM element = elements.Item(0)
DIM arr[-1][-1]

getTableData(element, arr)

IE.Quit

DIM Excel = XLOPEN()
XLSETDATA(Excel, arr, "A1")

DIM FSO = CREATEOLEOBJ("Scripting.FileSystemObject")
DIM path = uniqueFilename(FSO.BuildPath(GET_CUR_DIR, "楽天銀行定期預金金利.xlsx"))
XLCLOSE(Excel, path)

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND

//////////////////////////////////////////////////
// 【引数】
//   table : tableエレメント 
//   arr : 取得したデータを格納する配列(参照引数) 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE getTableData(table, Var arr[][])
	rowMax = table.rows.length - 1
	colMax = 0
	FOR row = 0 TO table.rows.length - 1
		IFB table.rows(row).cells.length - 1 > colMax THEN
			colMax = table.rows(row).cells.length - 1
		ENDIF
	NEXT
	DIM arr[rowMax][colMax]
	FOR row = 0 TO table.rows.length - 1
		FOR col = 0 TO table.rows(row).cells.length - 1
			n = 0
			WHILE arr[row][col + n] <> ""
				n = n + 1
			WEND
			arr[row][col + n] = table.rows(row).cells(col).innerText
			// rowSpan(行結合)とcolSpan(列結合)の両方があれば
			IFB table.rows(row).cells(col).rowSpan > 1 AND table.rows(row).cells(col).colSpan > 1 THEN
				rmax = table.rows(row).cells(col).rowSpan - 1
				cmax = table.rows(row).cells(col).colSpan - 1
				FOR r = 1 TO rmax
					FOR c = 1 TO cmax
						arr[row + r][col + c] = "←"
					NEXT
				NEXT
			ENDIF
			// rowSpan(行結合)があれば結合セルに「↑」を代入
			IFB table.rows(row).cells(col).rowSpan > 1 THEN
				n = table.rows(row).cells(col).rowSpan - 1
				WHILE n
					arr[row + n][col] = "↑"
					n = n - 1
				WEND
			ENDIF
			// colSpan(列結合)があれば結合セルに「←」を代入
			IFB table.rows(row).cells(col).colSpan > 1 THEN
				n = table.rows(row).cells(col).colSpan - 1
				WHILE n
					arr[row][col + n] = "←"
					n = n - 1
				WEND
			ENDIF
		NEXT
	NEXT
FEND

//////////////////////////////////////////////////
// 【引数】
//   path : ファイルのパス 
// 【戻値】
//   重複しないファイル名 
//////////////////////////////////////////////////
FUNCTION uniqueFilename(path)
	DIM FSO = CREATEOLEOBJ("Scripting.FileSystemObject")
	IFB FSO.FileExists(path) THEN
		DIM fol = FSO.GetParentFolderName(path)
		DIM filename = FSO.GetBaseName(path)
		DIM extension = FSO.GetExtensionName(path)
		DIM i = 2
		WHILE FSO.FileExists(FSO.BuildPath(fol, filename + " (" + i + ")." + extension))
			i = i + 1
		WEND
		RESULT = FSO.BuildPath(fol, filename + " (" + i + ")." + extension)
	ELSE
		RESULT = path
	ENDIF
FEND
  1. script.function.CREATEOLEOBJ(Ώ,17])
  2. com.IE.Visible(2)
  3. com.IE.Navigate(3)
  4. udf.BusyWait(4)
  5. com.IE.Document(6)
  6. udf.getTableData(10)
  7. script.function.XLOPEN(14)
  8. script.function.XLSETDATA(15)
  9. udf.uniqueFilename(18)
  10. com.FSO.BuildPath(18)
  11. script.function.XLCLOSE(19)

楽天PointClubでランクと保有ポイント数を取得する

DIM IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.Visible = TRUE
IE.Navigate("https://point.rakuten.co.jp/")
BusyWait(IE)

DIM elements

// ログインする
elements = IE.document.getElementsByClassName("name")

IFB elements.length = 0 THEN
	IELINK(IE, "ログイン")
	BusyWait(IE)
	IESETDATA(IE, READINI("楽天", "ID", "楽天.INI"), "u")		// ユーザID
	IESETDATA(IE, READINI("楽天", "PASS", "楽天.INI"), "p")		// パスワード
	IESETDATA(IE, TRUE, "submit")								// ログイン
	BusyWait(IE)
ENDIF

// ランク
elements = IE.document.getElementsByClassName("rank")
elements = elements.Item(0).getElementsByTagName("em")
PRINT elements.Item(0).innerText

// ポイント
elements = IE.document.getElementsByClassName("point-total")
elements = elements.Item(0).getElementsByTagName("dd")
PRINT elements.Item(0).innerText

IE.Quit

//////////////////////////////////////////////////
// 【引数】
//   IE : IEオブジェクト 
// 【戻値】
// 
//////////////////////////////////////////////////
PROCEDURE BusyWait(Var IE)
	SLEEP(0.500)
	DIM t = GETTIME()
	TRY
		REPEAT
			DIM tm = GETTIME() - t
			FUKIDASI("BusyWait:" + tm)
			SLEEP(0.010)
			IF tm >= 60 THEN BREAK
		UNTIL !IE.Busy AND IE.readyState = 4
	EXCEPT
		IE = getIEObj(-1)
		PRINT IE.document.URL + " のIEオブジェクトを取得しました。"
		BusyWait(IE)
	ENDTRY
	FUKIDASI()
FEND

//////////////////////////////////////////////////
// 【引数】
//   文字列 or 数値 : 取得したいIEオブジェクトのタイトル・URLもしくは数値を指定 
//   完全一致フラグ : (TRUE : 文字列が完全一致したものを取得、FALSE : 文字列の一部を含むものを取得) 
// 【戻値】
//   Internet Explorerオブジェクト 
//////////////////////////////////////////////////
FUNCTION getIEObj(str, flg = FALSE)
	DIM Shell = CREATEOLEOBJ("Shell.Application")
	SELECT CHKNUM(str)
		CASE TRUE
			DIM cnt = 0
			SELECT TRUE
				CASE str > 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB str = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str < 0
					FOR n = Shell.Windows.Count - 1 TO 0 STEP -1
						TRY
							IFB Shell.Windows.Item(n).Name = "Internet Explorer" THEN
								cnt = cnt + 1
								IFB ABS(str) = cnt THEN
									RESULT = Shell.Windows.Item(n)
									EXIT
								ENDIF
							ENDIF
						EXCEPT
						ENDTRY
					NEXT
				CASE str = 0
					FOR n = 0 TO Shell.Windows.Count - 1
						TRY
							IF Shell.Windows.Item(n).Name = "Internet Explorer" THEN cnt = cnt + 1
						EXCEPT
						ENDTRY
					NEXT
					RESULT = cnt
					EXIT
			SELEND
		CASE FALSE
			DIM t = GETTIME()
			REPEAT
				FOR n = 0 TO Shell.Windows.Count - 1
					TRY
						DIM targetObj = Shell.Windows.Item(n)
						IFB targetObj.Name = "Internet Explorer" THEN
							SELECT flg
								CASE TRUE
									IFB targetObj.document.title = str OR targetObj.LocationURL = str THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
								CASE FALSE
									IFB POS(str, targetObj.document.title) OR POS(str, targetObj.LocationURL) THEN
										RESULT = Shell.Windows.Item(n)
										EXIT
									ENDIF
							SELEND
						ENDIF
					EXCEPT
					ENDTRY
				NEXT
			UNTIL GETTIME() - t >= 5
	SELEND
	RESULT = ERR_VALUE
FEND
<div class="rank">
	あなたは
	<em>ゴールド会員</em>
	です
</div>

<dl class="point-total">
	<dt>総保有ポイント</dt>
	<dd>559</dd>
</dl>
[楽天]
ID=info@example.com
PASS=***
  1. script.function.CREATEOLEOBJ(1)
  2. com.IE.Visible(2)
  3. com.IE.Navigate(3)
  4. udf.BusyWait(4,13,17)
  5. com.IE.Document(9)
  6. dom.document.getElementsByClassName(9,21,26)
  7. dom.htmlcollection.length(11)
  8. script.function.IELINK(12)
  9. script.function.IESETDATA(14,15,16)
  10. dom.document.getElementsByTagName(22,27)
  11. script.syntax.control.print(23,27)
結果
ゴールド会員
559