タグ
  Active Directory (51)
  ANSI (1)
  bash (1)
  BAT (14)
  bind (1)
  CentOS (3)
  C言語 (4)
  DNS (3)
  Excel (1)
  Fedora (4)
  FreeBSD (3)
  iSCSI (1)
  Java (11)
  JavaScript (6)
  Link (4)
  Linux (15)
  Mail (1)
  Microsoft (4)
  NIS (1)
  OpenLDAP (2)
  OpenSolaris (4)
  PHP (2)
  PostgreSQL (2)
  PowerShell (31)
  RFC (3)
  Solaris (10)
  SQL Server (1)
  Ubuntu (3)
  VBScript (65)
  Visual Basic (1)
  VMware (2)
  Windows (14)
  WMI (16)
  WSF (5)
  WSH (10)
  作成中 (5)
  慣用句 (1)
  正規表現 (6)
時間がきたら自動的に閉じるポップアップのサンプル

「はい」を選択したら C:\temp\yes.txt が作成され、時刻が追記されます。
「いいえ」を選択したら C:\temp\no.txt が作成され、時刻が追記されます。
何も操作しなかったら C:\temp\timeout.txt が作成され、時刻が追記されます。

Option Explicit
Const TEXT_DIR = "C:\temp\"
Dim FSO, WshShell
Dim touchFile
Dim ret
Set WshShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
ret = WshShell.Popup ("当社はあなたを解雇しようとしています。" & vbNewLine & _
		"転職しますか?10秒以内に回答がない場合、解雇されます。", _
             10, "解雇予告", vbYesNo + vbQuestion)
If Not FSO.FolderExists(TEXT_DIR) Then FSO.CreateFolder(TEXT_DIR)
If ret = vbYes Then
  Set touchFile = FSO.OpenTextFile(TEXT_DIR & "yes.txt", 8, True)
ElseIf ret = vbNo Then
  Set touchFile = FSO.OpenTextFile(TEXT_DIR & "no.txt", 8, True)
Else
  Set touchFile = FSO.OpenTextFile(TEXT_DIR & "timeout.txt", 8, True)
End If
touchFile.WriteLine Now
touchFile.Close

参考
CreateFolder メソッド | FolderExists メソッド | OpenTextFile メソッド | Popup メソッド | WriteLine メソッド

タグ: WSH VBScript
[リロード] [記事修正] [新規作成] [使用方法]
©2004-2010 UPKEN