Last active
August 29, 2015 14:07
-
-
Save stknohg/d06451c6d9beb13d48bd to your computer and use it in GitHub Desktop.
プロ生ちゃん #カレンダープログラミング プチコンテスト用カレンダー VBScript版
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' | |
' プロ生ちゃん #カレンダープログラミング プチコンテスト用カレンダー 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