Skip to content

Instantly share code, notes, and snippets.

@corrupt952
Last active March 1, 2020 02:57
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 corrupt952/ce5d540917130e725fd30247bd3d24b2 to your computer and use it in GitHub Desktop.
Save corrupt952/ce5d540917130e725fd30247bd3d24b2 to your computer and use it in GitHub Desktop.
指定したディレクトリを作成後、GIMPのテンプレート用ファイルをディレクトリ内へコピーするスクリプト

new_thumbnail.ps1

指定したディレクトリを作成後、GIMPのテンプレート用ファイルをディレクトリ内へコピーするスクリプト.

  1. template.xcfを作成(テンプレート用のGIMPファイル)
  2. template.xcfと同じ階層にnew_thumbnail.ps1を配置する
  3. new_thumbnail.ps1を右クリックでメニューで開きPowerShell で実行を押す
  4. 立ち上がったプロンプトにディレクトリ名を入力する(filenameと出てくるけどディレクトリ名でもありファイル名でもある)
  5. 作成が終わると自動でフォルダが開かれる
Set-PSDebug -strict
$TEMPLATE_PATH="template.xcf"
$TEMPLATE_EXT=(Get-Item $TEMPLATE_PATH).Extension
$fname = Read-Host "Enter filename"
if (Test-Path "$fname") {
Write-Output "$fname is already exists!"
$isContinue = Read-Host "Continue?(y/n)"
if (! ($isContinue -eq "y")) {
Write-Output "Aborted!"
Read-Host "Press any key to conitnue..."
exit 1
}
}
New-Item -Force $fname -itemType Directory | Out-Null
Copy-Item -Force -Path $TEMPLATE_PATH -Destination $fname/$fname$TEMPLATE_EXT
Invoke-Item $fname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment