0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VBSを覚えるための覚書。

Last updated at Posted at 2020-06-30

※RPAを覚えるための覚書(ややこしい)。メモなので順次追加します。
※7/14アップデートしました。

ウェブサイトと記事

ぶろぐち https://www.bloguchi.info/1282
VSCodeのextension「Code Runner」の設定方法詳細。だいぶわかりやすい。

[REONTOSANTA https://knowledge.reontosanta.com/archives/838] (https://knowledge.reontosanta.com/archives/838)
VBSからExcelのファイル操作する。

Takashi Kanamaru's Web Page - VBScriptの演算子
まあ、プログラムやってる人ならだいたいわかると思うんだけども、それでも言語によって方言があったりするので。このウェブサイトも個人の覚書っぽい。

VBScript関数リファレンス - https://www.kanaya440.com/contents/script/
VBSで取得した日付を好きにフォーマットしたくて調べた際に行き着いた。
たくさん載ってます。
特に日付処理のページ↓はうれしい。
https://www.kanaya440.com/contents/script/vbs/function/date/
https://www.kanaya440.com/contents/script/vbs/function/data/cdate.html

バヤシタ - yyyymmdd 形式の文字列で現在日付を取得する方法
上と同じく日付の操作で行き着いた。なんていうか、今まで使っていた言語にはさくっとフォーマットするコマンドがあったんだけど、VBSにはそういうのないのかな?

ソース

※なにぶん初心者、コレおかしくね?ってところ見つけたらご指摘ください。

任意のディレクトリの最新ファイルを取得する。
これもどこかから探して持ってきたやつなんだけど、参照元が分からなくなっちゃった。

GetLatestFileName
' //引数
' [path] 目的のディレクトリまでのパス 
' [dir] ディレクトリ名
' [ext] ファイル形式

Function GetLatestFileName(path, dir, ext)
    Dim wshShell, exec, line

    Set wshShell = CreateObject("WScript.Shell")

    Set exec = WshShell.Exec("cmd /c dir /a-d /b /o-d """ & path & dir & "\*." & ext & """")
    exec.StdIn.Close()

    Do While Not exec.Stdout.atEndOfStream
        line = Trim(exec.StdOut.ReadLine())
        Exit Do
    Loop 

    Set dir = Nothing
    Set exec = Nothing
    Set wshShell = Nothing

    GetLatestFileName = line

End Function

MICHIRU RPA

GUI味の強いRPA。安価。非エンジニア向なので、私はコレ。

MICHIRU RPAユーザーフォーラム
https://michiru.co.jp/community/main-forum/

0
3
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
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?