Skip to content

Instantly share code, notes, and snippets.

@toagit
toagit / xlsFileMarge.vbs
Last active August 29, 2022 09:54
複数のExcelファイルを1ファイルにまとめるVBScript
Option Explicit
Const msoFileDialogFolderPicker = 4
Const EXTENSION = ".xlsx"
Call MargeSheet
'Excelファイルマージ
Sub MargeSheet()
Dim scriptPath
@toagit
toagit / xlsUnlock.vbs
Created July 14, 2015 00:58
エクセルパスワード解除vbスクリプト
Option Explicit
Dim max
Dim min
'===============================================================================
':: 最大(max)・最小(min)のパスワード長を設定してください
max = 10
min = 3
'===============================================================================
':: ここから下はいぢらないでください
@toagit
toagit / ActivateA1.vbs
Last active December 22, 2020 20:01
指定したファイルの全てのシートについてA1セルをActiveにするスクリプト
Option Explicit
'/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
'指定したエクセルファイルの全てのシートのセルをA1セルへ移動するスクリプト
'エクセルの指定はダイアログ、D&Dをサポート
'/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Call ActivateA1
Private Sub ActivateA1()
@toagit
toagit / AbstractMainTester.java
Last active April 3, 2017 09:35
mainメソッドのJUnitサンプル。System.Exitのコードの確認。標準出力(System.out、System.Err)の取得。
/**
* mainメソッド実装クラスをテストする基底クラス。
*/
public abstract class AbstractMainTester {
private static final String ARGS_DELIMITER = " ";
protected static final String LINE_SEPARATOR = System.getProperty("line.separator");
private static final PrintStream stdOut = System.out;
private static final PrintStream stdErr = System.err;
private static final SecurityManager securityManager = System.getSecurityManager();
@toagit
toagit / PutInClipboard.vbs
Created February 14, 2017 07:04
クリップボードに値を設定する。サンプルはアクティブブックのフルパスを設定
Public Sub CopyActiveBookPath()
Dim path As String
path = ActiveWorkbook.FullName
With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
.SetText path
.PutInClipboard
End With
End Sub
@toagit
toagit / deleteNonListFolder.bat
Created February 9, 2017 11:38
リストファイルに存在しないフォルダを削除する
@echo off
pushd %0\..
setlocal enabledelayedexpansion
set "TARGET_FOLDER=D:\xxxx"
for /f "tokens=*" %%a in ('dir %TARGET_FOLDER% /b /a:d') do (
set SHOULD_DEL=true
for /f "tokens=1* skip=1" %%i in (include.list) do (
if "%%a"=="%%j" (
echo [DEBUG] -- バックアップ対象:%%j
@toagit
toagit / shutdown.bat
Last active January 16, 2017 05:09
指定時刻にシャットダウンするWindowsBatch ATやタスクスケジューラーが使えない環境用
@echo off
rem 指定時刻にシャットダウンするバッチ
rem 秒は許容誤差とし、算出しない
rem 18:00にシャットダウン
set HOUR=18
set /a H=%HOUR%-1-%TIME:~0,2%
set /a M=60-%TIME:~3,2%
echo %HOUR%時まで%H%時間%M%分
@toagit
toagit / Singletone_final.java
Created April 23, 2015 01:48
シングルトンパターン
// シングルトン パターンの例
private static final MySample INSTANCE = new MySample();
private final ExampleProperties prop;
// シングルトンのコンストラクタで初期化させる
private MySample() {
// 初期化
prop = initProperties();
}
// propの読み込み
@toagit
toagit / ConverArray-List.java
Created April 24, 2015 09:55
配列<=>List変換
// Array => List
// 一次元次配列
List<String> listA = Arrays.asList(new String[] {"ichika","kaito","kanna","tetsurou","mio","remmon"});
ArrayList<String> aListA = new ArrayList<String>(list);
for (String str : aList) {
System.print.out(str);
}
// 多次元配列
@toagit
toagit / build.xml
Last active October 4, 2016 12:24
ant build sample. contain javac, javadoc, zip.
<?xml version="1.0" encoding="Windows-31J"?>
<project name="builSample" default="main" basedir=".">
<property name="path.lib" location="./lib"/>
<property name="path.out" location="./dest"/>
<property name="path.bin" location="${path.out}/bin"/>
<property name="path.src" location="./src"/>
<property name="path.test" location="./srctest"/>
<property name="path.doc" location="${path.out}/javadoc"/>
<property name="compiler" value="JAVA_HOME\bin\javac"/>