Skip to content

Instantly share code, notes, and snippets.

@yumetodo
Last active February 23, 2016 13:41
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 yumetodo/1bc47ce42b6128e1950c to your computer and use it in GitHub Desktop.
Save yumetodo/1bc47ce42b6128e1950c to your computer and use it in GitHub Desktop.
'Boost Software License 1.0 (BSL1.0)
'copyright (c) 2015-2016 yumetodo
Dim WshShell
Dim WshFS
Dim url
Dim html
Dim cmd1
Dim path
Set WshShell = CreateObject("WScript.Shell")
Set WshFS = CreateObject("Scripting.FileSystemObject")
'check Env
If (Not WshFS.FileExists("curl.exe")) Then
WScript.Echo("Unable to find curl.exe")
WScript.Quit
End If
'Input Install Folder
path = InputBox("インストール先フォルダをフルパスで入力してください", "DoNotPushGameDownloader")
If (Not WshFS.FolderExists(path)) Then
WScript.Echo("Not kown such a directory.")
WScript.Quit
End If
'Change Current Directory to Install Folder
WshFS.CopyFile "curl.exe", WshFS.BuildPath(path, "curl.exe")
WshShell.CurrentDirectory = path
' for SSL
If (Not WshFS.FileExists("curl-ca-bundle.crt")) Then
WScript.Echo("missing curl-ca-bundle.crt")
WScript.Quit
End IF
If (Not WshFS.FileExists("DigiCertHighAssuranceEVRootCA.crt")) Then
url = "https://www.digicert.com/testroot/DigiCertHighAssuranceEVRootCA.crt"
cmd1 = """" & WshShell.CurrentDirectory & "\curl.exe" & """" &" "& url & "" & " -o DigiCertHighAssuranceEVRootCA.crt"
WScript.Echo(cmd1)
Call WshShell.Run(cmd1, 1, True)
End IF
'Fetch GitHub DL page
url = "https://github.com/TakeObara/DoNotPushGame/releases/latest"
cmd1 = """" & WshShell.CurrentDirectory & "\curl.exe" & """" & " -sL " &" "& url & "" & " -o latest.html"
WScript.Echo(cmd1)
Call WshShell.Run(cmd1, 1, True)
'Extract Link
Set myregex = New RegExp
myregex.IgnoreCase = True
myregex.Global = True
myregex.Pattern = "(/releases/download/.*/DoNotPushGame.+.zip)"
'WScript.Echo(myregex.Pattern)
html= WshFS.OpenTextFile("latest.html").ReadAll
Set rMatches = myregex.Execute(html)
url = rMatches.Item(0).Submatches(0)
'Download
'WScript.Echo(url)
cmd1 = """" & WshShell.CurrentDirectory & "\curl.exe" & """" & " -s -L --insecure " &" " & "" & "https://github.com/TakeObara/DoNotPushGame" & "" & url & "" & " -o DoNotPushGame-latest.zip"
'WScript.Echo(cmd1)
Call WshShell.Run(cmd1, 1, True)
'Unzip
Set appShell = CreateObject("Shell.Application")
appShell.NameSpace(WshFS.GetAbsolutePathName(WshShell.CurrentDirectory)).CopyHere appShell.NameSpace(WshFS.GetAbsolutePathName("DoNotPushGame-latest.zip")).Items
Set appShell = Nothing
'Wait unzip
WScript.Sleep(1000)
WScript.Echo("finish.")
@yumetodo
Copy link
Author

https://github.com/TakeObara/DoNotPushGame
のダウンローダーです。

依存関係

動作環境

Windows Vista 以降

インストール方法(自動版)

  1. SSLに対応したcurl.exeをvbsと同じパスにおきます
  2. インストール先のフォルダを作ります
  3. 作成したフォルダのフルパスをコピーします
  4. download.vbsを実行します
  5. コピーしたパスを貼り付けます
  6. ちょっと待ちます。真っ黒なconsoleがしばらく居座りますが、気にしてはいけません
  7. finish.とでれば多分終わっています
  8. 手順2で作成したフォルダ内にDoNotPushGameというフォルダがあれば成功です

連絡先

Twitter: @yumetodo
GitHub : @yumetodo
e-mail : yume-wikijp@live.jp

License

vbsのライセンスです

Boost Software License 1.0 (BSL1.0)
copyright (c) 2015 yumetodo

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment