-
Notifications
You must be signed in to change notification settings - Fork 0
/
VBAC_Script.ps1
49 lines (36 loc) · 1.32 KB
/
VBAC_Script.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
echo "VBAソースコードを出力します。"
echo "VBAC in Ariawase v0.6.0"
cd $PSScriptRoot
#Sourceフォルダに内容物ある時、確認
if ( test-path .\Source\* ){
$title = "*** 実行確認 ***"
$message = "Sourceフォルダの内容を上書きします。実行してよろしいですか?"
$objYes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes","実行"
$objNo = New-Object System.Management.Automation.Host.ChoiceDescription "&No","実行終了"
$objOptions = [System.Management.Automation.Host.ChoiceDescription[]]($objYes, $objNo)
$resultVal = $host.ui.PromptForChoice($title, $message, $objOptions, 1)
if ($resultVal -ne 0) { exit } else {
remove-item .\Source\*
}
} elseif (test-path .\Source) {
echo " "
} else {
New-Item Source -ItemType Directory
}
#VBAC.wsfを持ってくる
Copy-Item C:\Users\Tatsuki\Documents\Program\vbacGUI\vbac.wsf $PSScriptRoot
#コードをエクスポートしたいexcelファイルをbinフォルダへコピー
New-Item bin -ItemType Directory
Copy-Item *.xlsm bin
cscript vbac.wsf decombine
$FolderName = get-childitem -Name src
echo $FolderName
$FolderPath = Join-Path .\src $FolderName
echo $FolderPath
Push-Location $FolderPath
move-Item *.bas ..\..\Source
#current directoryを$PSScriptRootへ戻す
Pop-Location
Remove-Item bin -Recurse
Remove-Item src -Recurse
remove-item vbac.wsf