Loop,%0% Loop,% %A_Index% { path:=A_LoopFileLongPath ext:=A_LoopFileExt pathNoExt:=SubStr(path,1,-StrLen(ext)-1) newPdfPath=%pathNoExt%.pdf IfExist,%newPdfPath% Loop { newPdfPath=%pathNoExt%(%A_Index%).pdf IfNotExist,%newPdfPath% Break } avd:=ComObjCreate("AcroExch.AVDoc") result:=avd.Open(path,"") If result=-1 { avd.GetPDDoc().Save(1,newPdfPath) avd.Close(1) } }
Loop,%1%
{
path:=A_LoopFileLongPath
ext:=A_LoopFileExt
pathNoExt:=SubStr(path,1,-StrLen(ext)-1)
newPdfPath=%pathNoExt%.pdf
IfExist,%newPdfPath%
Loop
{
newPdfPath=%pathNoExt%(%A_Index%).pdf
IfNotExist,%newPdfPath%
Break
}
pdd0:=ComObjCreate("AcroExch.PDDoc")
pdd0.Create()
Loop,%0%
Loop,% %A_Index%
{
path:=A_LoopFileLongPath
avd1:=ComObjCreate("AcroExch.AVDoc")
result:=avd1.Open(path,"a")
If result=-1
{
pdd1:=avd1.GetPDDoc()
pdd0.InsertPages(-2,pdd1,0,1,0)
avd1.Close(1)
}
}
pdd0.Save(1,newPdfPath)
pdd0.Close()
}
プロフィール
最近の記事