Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 1 year has passed since last update.

日々のタスクファイルを作るマクロ

Posted at

その日の名前で新しいファイルを作りsakuraで開くだけ

Dim shell
Dim file

Dim workdir
Dim filename

Dim arr
arr = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")

Set shell = CreateObject("WScript.Shell")
Set file = CreateObject("Scripting.FilesystemObject")

' ~/work/yyyy_MM_dd_aaa.taskを作成
workdir = shell.ExpandEnvironmentStrings("%USERPROFILE%\work")
filename = Year(Now()) & "_"
filename = filename & Right("0" & Month(Now()) , 2) & "_"
filename = filename & Right("0" & Day(Now()) , 2) & "_"
filename = filename & arr(Weekday(Date()) - 1) & ".task"

Call file.CreateTextFile(workdir & filename)
Call shell.exec("sakura.exeのフルパス " & workdir & filename)

当日に2回実行すると、同名ファイルを削除して作り直してしまうので注意
shellでやるならこう

FILE_NAME=`date +%y_%m_%d_%a.task`

cd ~/work
touch $FILE_NAME

# sakuraの起動はwindowsバッチでやる、mingw64やcygwin、wslからの実行を想定
./バッチファイル $FILE_NAME
cd サクラエディタのあるパス
start sakura.exe %USERPROFILE%\work\%1
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?