Skip to content

Instantly share code, notes, and snippets.

@Ishibasystems
Created September 5, 2015 16:18
Show Gist options
  • Save Ishibasystems/ce62a0e325468f670d65 to your computer and use it in GitHub Desktop.
Save Ishibasystems/ce62a0e325468f670d65 to your computer and use it in GitHub Desktop.
#define nodo 50
#module
#defcfunc nameup var name, int byte
hoge=peek(name,byte)
if hoge>'9' | hoge<'0' : return 1
if hoge='9' {
if byte<1 | nameup(name,byte-1) : return 1
hoge='0'-1
}
poke name,byte,hoge+1
return 0
#global
buffer 1
buffer 2
gsel 0
title"右側1ページ目を選択してください。"
dialog,16
if stat=0 : end
iname=refstr
oname=getpath(iname,1)+".bmp"
mask=getpath(iname,8)
flag=0
start=-1
repeat strlen(mask)
char=peek(mask,cnt)-'0'
if 0<=char&char<=9 {
if flag=0 : start=cnt
start+
logmes""+start
} else : flag=0
loop
if start<0 : dialog"ERROR: 数字が見つかりませんでした!",1 : end
start+=strlen(getpath(iname,32))
repeat
exist iname
if strsize<0 : break
gsel 1
picload iname
x1=ginfo(12)
y1=ginfo(13)
if nameup(iname,start-1) : break
exist iname
if strsize<0 : break
gsel 2
picload iname
x2=ginfo(12)
y2=ginfo(13)
x3=x1+x2+nodo
y3=y1 : if y2>y3 : y3=y2
buffer 3,x3,y3
pos 0,0
gcopy 2,0,0,x2,y2
pos x2+nodo,0
gcopy 1,0,0,x1,y1
bmpsave oname
if nameup(iname,start-1) : break
hogehoge=nameup(oname,start-1)
loop
;if y3<1200 : dialog"注意!\n縦が1200px未満です!",1
end
@Ishibasystems
Copy link
Author

ファイル名をAAA000bak.JPG~AAA999bak.JPGのように連番にしておくと自動で連結するスクリプト。スキャンした画像を右・左の順(右綴じの本)で連結して保存する。連番はファイル名(拡張子を除く)の最後にある数字列を検出しこれで判定、この数字は0埋めの桁揃えがされていて、連番以外のファイル名・拡張子は同じに名前がつけられていることが前提。 例えばCAT045_000bak.JPG~CAT045_999bak.JPGならファイル名後ろの000~999で検出し、CAT000_000bak.JPG~CAT999_999bak.JPGのようにファイル名後ろの000~999以外の部分が同じではない文字列を含む場合連結できません。

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