Skip to content

Instantly share code, notes, and snippets.

@stknohg
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stknohg/d06451c6d9beb13d48bd to your computer and use it in GitHub Desktop.
Save stknohg/d06451c6d9beb13d48bd to your computer and use it in GitHub Desktop.
プロ生ちゃん #カレンダープログラミング プチコンテスト用カレンダー VBScript版
'
' プロ生ちゃん #カレンダープログラミング プチコンテスト用カレンダー VBScript版
' 日曜日始まりの当月のカレンダーを表示します。
' このスクリプトはCScript.exeから実行してください。
'
Option Explicit
If InStr(LCase(WScript.FullName), "wscript.exe") > 0 Then
MsgBox "このスクリプトはCScript.exeから実行してください。", vbOKOnly + vbCritical, "プロ生ちゃんカレンダー": Wscript.Quit
End If
Dim i,c,s,n,l,m: c = 2: s = 1: n = Now: m = ""
l = Day(DateSerial(Year(n), Month(n) + 1, 1) - 1)
m = m & Space((c * 7 + s * 6) / 2 - 3) & Year(n) & "/" & Month(n) & vbCrLf
m = m & Space((c + s) * (Weekday(DateSerial(Year(n), Month(n), 1)) - 1))
For i = 1 To l
m = m & Space(c - Len(i)) & i
If Weekday(DateSerial(Year(n), Month(n), i)) = vbSaturday And Not i = l Then
m = m & vbCrLf
Else
m = m & Space(s)
End If
Next
WScript.Echo(m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment