HEXA BLOG
ヘキサブログ
日記
HEXA BLOG日記2018.1.10
リネームツール
//MELで書いてます!
//何に使っても構いません。
//再配布もOKです。
//ただ何が起きても責任は負いかねます。
//--------------------------------------------------
//ウィンドウパネルの作成
//--------------------------------------------------
window -title "ReNameTool ver 1.2" ;
columnLayout ;
text -label "置換前の文字。" ;
textField -tx "" targetMoji;
text -label "置換後の文字(未記入で削除できます)。" ;
textField -tx "" changedMoji;
separator -h 10 -w 300 ;
separator -h 10 -w 300 ;
text -label "接頭辞を追加します。" ;
textField -tx "" prefix ;
text -label "接尾辞を追加します。" ;
textField -tx "" suffix ;
separator -h 10 -w 300 ;
separator -h 10 -w 300 ;
text -label "チェックボックスオンで連番追加します。以下桁数。" ;
checkBox -label "連番追加" renbanCheck ;
intField -value 4 ketaNumber;
text -label "チェックボックスオンで、名前一括変更します。" ;
text -label "連番追加しなければ変更できません。" ;
checkBox -label "名前全変換" baseNameChangeCheck ;
textField -tx "" baseName ;
separator -h 10 -w 300 ;
separator -h 10 -w 300 ;
setParent ..;
rowLayout -numberOfColumns 2 -columnWidth2 60 20 ;
button -label "変換実行" -c exchangeMoji ;
button -label "名前書き出し" -c exportText ;
setParent ..;
showWindow ;
//--------------------------------------------------
//リネームの処理
//--------------------------------------------------
global proc exchangeMoji()
{
string $moto = `textField -q -tx targetMoji`;
string $ato = `textField -q -tx changedMoji`;
string $mae = `textField -q -tx prefix` ;
string $usiro = `textField -q -tx suffix` ;
string $temp ;
string $number ;
int $c = `checkBox -q -v renbanCheck` ;
int $cc = `checkBox -q -v baseNameChangeCheck` ;
string $sentaku[] = `ls -sl -tr` ;
int $kazu = ` size ( $sentaku ) ` ;
int $x ;
if(0==$cc) //全名前変更の時はオフにしています
{
for ($x=0 ; $x < $kazu ; $x++){
string $temp = substitute ( $moto ,$sentaku[$x] , $ato );
rename $sentaku[$x] ($mae + $temp + $usiro + $number) ;
};
};
if(1==$c)
{
for ($x=0 ; $x < $kazu ; $x++)
{
string $temp = $sentaku[$x] ;
string $r = $x ;
$number = 0 ;
int $i;
int $keta = `intField -q -v ketaNumber`- 1 ;
for($i=size($r); $i < $keta ; $i++)
{
$number = "0" + $number ;
};
if(1==$cc)
{
$temp = `textField -q -tx baseName` ;
};
rename $sentaku[$x] ( $temp + "_" + $number + $x);
};
};
};
//--------------------------------------------------
//名前書き出しの処理
//--------------------------------------------------
global proc exportText()
{
string $sentaku[] = `ls -sl -tr` ;
int $kazu = `size($sentaku)`;
int $x ;
string $exampleFileName = "D:/NameList.txt" ;
$fileId = `fopen $exampleFileName "w"`;
for ($x=0 ; $x < $kazu ; $x++)
{
fwriteAllLines($exampleFileName,$sentaku) ;
print ($sentaku[$x] + "\n");
} ;
fclose $fileId ;
};
こちらから門を叩いてね!
https://hexadrive.jp/recruit/joblist/
CATEGORY
- about ヘキサ (166)
- 部活動 (6)
- CG (18)
- プロジェクトマネジメント (1)
- 研修 (5)
- 美学 (1)
- いいモノづくり道 (227)
- 採用 -お役立ち情報も- (149)
- プログラム (189)
- デザイン (99)
- ゲーム (273)
- 日記 (1,104)
- 書籍紹介 (113)
- その他 (889)
- 就活アドバイス (20)
- ラーメン (3)
- ライフハック (25)
- イベント紹介 (10)
- 料理 (23)
- TIPS (7)
- 怖い話 (3)
- サウンド (6)
- 子育て (1)
- 筋トレ (1)
- NicO (3)
- MakeS (9)
- 商品紹介 (21)
- アプリ紹介 (31)
- ソフトウェア紹介 (33)
- ガジェット紹介 (12)
- サイト紹介 (10)
- 研究・開発 (35)
- 回路図 (4)
- アナログゲーム (40)
- 交流会 (21)
- 報告会 (3)
- インフラ (25)
- グリとブラン (6)
- カメラ (9)
- クラフト (27)
- 部活 (14)
- 画伯 (15)
- カレー (6)
- 音楽(洋楽) (6)
- 映画・舞台鑑賞 (43)
- 飼育 (5)
- いぬ (8)
- ねこ (19)
ARCHIVE
- 2025年
- 2024年
- 2023年
- 2022年
- 2021年
- 2020年
- 2019年
- 2018年
- 2017年
- 2016年
- 2015年
- 2014年
- 2013年
- 2012年
- 2011年
- 2010年
- 2009年
- 2008年
- 2007年














