2008-01-25 PowerPoint¤ËޤêÉÕ¤±¤Þ¤¯¤ëVBScript
½ù¡¹¤Ë¡¢¤Ã¤Æ¤¤¤¦¤«¡¢¤«¤Ê¤êËèÆüVBScript¤ò¤¤¤¸¤Ã¤Æ¡£
¥È¥ê¥¢¥¨¥º¡¢¶á¡¹¤Îºî¶È¤ÇɬÍפÊʪ¤Ïºî¤Ã¤¿¡£
¤¹¤´¤¤¤Í¡¢PowerPoint!²þ¤á¤Æ´¶Æ°¡£
¥Ñ¥ï¥Ý¾å¤Î¥ª¥Ö¥¸¥§¥¯¥È(¡©¥Æ¥¥¹¥È¥Ü¥Ã¥¯¥¹¤È¤«¡¢²èÁü¤È¤«¡¢Àþ¤È¤«¡Ë¤Ï¡¢Á´Éô¥×¥í¥°¥é¥à¤«¤éÀ©¸æ²Äǽ¡£
·Ò¤¬¤Ã¤Æ¤¤¤ë¡¢¥ª¥Ö¥¸¥§¥¯¥È¤òÄ´¤Ù¤ë¤È¤«¤â¤Ç¤¤ë¡£
¤¿¤À¡¢PowerPoint VBA¤È¤«VBScript¤Ë´Ø¤¹¤ë½ñʪ¤¬¾¯¤Ê¤¤¤Î¤Ç¡¢
MSDN¤Î¥Ú¡¼¥¸¤ÈGoogleÀèÀ¸¤Ç¤Ò¤¿¤¹¤éÄ´¤Ù¤Ê¤¬¤éºî¤ë¤È¤¤¤¦Èó¸úΨ¤µ¡¦¡¦¡¦
¤À¤ì¤«¡¢¤½¤Î¼ê¤ÎËܤò½ñ¤±¤ÐÎɤ¤¤Î¤Ë¡¦¡¦¡¦
OfficeÀ½ÉʤΥª¥Ö¥¸¥§¥¯¥È¤È¤«VBA¤È¤«¤ò²þ¤á¤ÆÊÙ¶¯¤·¤¿¤¯¤Ê¤Ã¤¿¡¢
¤±¤É¡¢¤½¤ó¤Ê²Ë¤Í¡¼
ºÙ¤«¤¤ÀâÌÀ¤Ï¤Þ¤¿º£ÅÙ¤·¤Þ¤¹¤¬¡¢¥½¡¼¥¹¤òÄ¥¤Ã¤Æ¤ª¤¤Þ¤¹¡£
¥¹¥Ñ¥²¥Ã¥Æ¥£¡¼¤È¤¤¤¦¤«¡¢¤¢¤Ã¤Á¥³¥Ã¥Á¤Î¥¹¥¯¥ê¥×¥È¤ò¤·¤ÆÅ½¤êÉÕ¤±¤Æ¡¢
ŽÅŽÝŽÄŽ¶Æ°¤¯¤È¤¤¤¦¥ì¥Ù¥ë¤Îʪ¤Ç¤¹¡£
¤¤Ã¤È¤³¤Ó¤È¤µ¤ó¤¬Ä¾¤·¤Æ¤¯¤ì¤ë¤Ï¤º¡¦¡¦¡¦¡¦
GetAllCapture.vbs
Option Explicit Private FSO Private SourcePath Private CapturePath,TempPath Private ThisFolder Private f Private WshShell Dim WSH,wExec '¢£É¬Íפʥѥé¥á¡¼¥¿¤Ï¢¤³¤³¤ÇÄ´À° SourcePath = "C:\test\testdir" '¤³¤³¤ËHTML¥½¡¼¥¹¤òÃÖ¤¯ CapturePath = "C:\test\capture" '¤³¤³¤ËJPEG¤¬½ÐÎϤµ¤ì¤ë¡£ TempPath = "C:\test\temp" '¤³¤³¤ËTEMP¥Õ¥¡¥¤¥ë¤¬½ÐÎϤµ¤ì¤ë¡£ '¢£½ÐÎϥǥ£¥ì¥¯¥È¥ê¤¬¹ç¤Ã¤¿¤é¥¨¥é¡¼¤Ç½ªÎ»¡£Ìµ¤¤¤È¤¤Ïºî¤ë¡£ '¡¡¤Ê¤¼¤Ê¤é¡¢¤½¤Î¸å¤Î½èÍý¤ÇÃæ¿È¤òÁ´Éô¾Ã¤·¤Æ¤·¤Þ¤¦¤«¤é¡£ Set FSO = CreateObject("Scripting.FileSystemObject") if FSO.FolderExists(CapturePath) then MsgBox CapturePath & "¥Õ¥©¥ë¥À¤¬Â¸ºß¤¹¤ë¤¿¤á½èÍý¤ò½ªÎ»¤·¤Þ¤¹¡£" WScript.Quit 1 ELSE FSO.CreateFolder CapturePath End if '¢£¥Õ¥©¥ë¥À¥³¥Ô¡¼ Set ThisFolder = FSO.GetFolder(SourcePath) ThisFolder.Copy CapturePath & "\", True Set FSO = Nothing Set ThisFolder = Nothing '¢£HTML¤Î¥Õ¥¡¥¤¥ë¥ê¥¹¥È¤ò¼èÆÀ Set WSH = CreateObject("WScript.Shell") Set wExec = WSH.Exec("%ComSpec% /c ""dir " & SourcePath & "\*.htm* /b/a-d/s > " & TempPath & "\HtmList.txt""") Set wExec = Nothing Set WSH = Nothing '¢£°¤¤¤±¤É¥Ç¥£¥ì¥¯¥È¥ê¤ÎÃæ¿È¤Ï¾Ã¤¨¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£ '¥¥ã¥×¥Á¥ã¡¼½ÐÎÏ¥Õ¥¡¥¤¥ë¤Î¼Â¹ÔͽÄê°ìÍ÷¼èÆÀ Set WSH = CreateObject("WScript.Shell") Set wExec = WSH.Exec("%ComSpec% /c ""dir " & CapturePath & "\*.htm* /b/a-d/s > " & TempPath & "\CapList.txt""") Set wExec = Nothing Set WSH = Nothing '¥¥ã¥×¥Á¥ã¡¼¥Ç¥£¥ì¥¯¥È¥ê¤ÎÃæ¿È¤Îºï½üÂоݥꥹ¥È¼èÆÀ Set WSH = CreateObject("WScript.Shell") Set wExec = WSH.Exec("%ComSpec% /c ""dir " & CapturePath & "\* /b/a-d/s > " & TempPath & "\DelList.txt""") Set wExec = Nothing Set WSH = Nothing MsgBox CapturePath & "¥Ç¥£¥ì¥¯¥È¥ê¥ê¥¹¥È¤ò¼èÆÀ¤·¤Þ¤·¤¿¡£" '¤³¤³¤ÇWait¤òÆþ¤ì¤Ê¤¤¤È¡¢DelList¤¬¤Ç¤¤¢¤¬¤é¤Ê¤¤¤¦¤Á¤Ë¼¡¤Î½èÍý¤¬Áö¤ë¤È¥¨¥é¡¼¤Ë¤Ê¤ë¡£ '¥ë¡¼¥×¤·¤Æ¥Õ¥¡¥¤¥ëºï½ü '¡ú¡¡¥Õ¥¡¥¤¥ë¤Î¸ºß¤È½ñ¤¹þ¤ß¤Ç¤¤ë¤«³Îǧ¤òÆþ¤ì¤ë¡£ Private FileName Private i Set FSO = CreateObject("Scripting.FileSystemObject") With FSO.OpenTextFile(TempPath & "\DelList.txt") While Not .AtEndOfStream i = i + 1 'WScript.Echo i & .ReadLine FSO.DeleteFile .ReadLine Wend .Close End With Set FSO = Nothing '¢£¤½¤Î¥Õ¥¡¥¤¥ë¤´¤È¤Ë½ÐÎϤò³Ý¤±¤ë¥ë¡¼¥× '¼èÆÀ¸µ¥Õ¥¡¥¤¥ë̾¤ò¼è¤ê½Ð¤¹ Private SourceFile(99999) i = 0 Set FSO = CreateObject("Scripting.FileSystemObject") With FSO.OpenTextFile(TempPath & "\HtmList.txt") While Not .AtEndOfStream i = i + 1 SourceFile(i) = .ReadLine Wend .Close End With Set FSO = Nothing 'ÊݸÀè¥Õ¥¡¥¤¥ë̾¤ò¼è¤ê½Ð¤¹ Private CaptureFile(99999) i = 0 Set FSO = CreateObject("Scripting.FileSystemObject") With FSO.OpenTextFile(TempPath & "\CapList.txt") While Not .AtEndOfStream i = i + 1 CaptureFile(i) = .ReadLine Wend .Close End With Set FSO = Nothing '¥Ð¥Ã¥Á¥Õ¥¡¥¤¥ë¤Ç¤â½ÐÎϤ¹¤ë¤«¡© Private j Set FSO = CreateObject("Scripting.FileSystemObject") With FSO.CreateTextFile(TempPath & "\AllCap.bat",True,False) For J = 1 to i '¡ú°ì±þÃæ¿È³Îǧ¤·¤è¤¦¤«¡¢¥É¥Ã¥Á¤«¤¬¤¬¶õ¤À¤Ã¤¿¤é¥¨¥é¡¼¤Ë¤·¤è¤¦ .WriteLine "c:\crena\CrenaHtml2jpg.exe -o"""& CaptureFile(j) &".jpg"" -fjpeg -w240x1200 -s240x1200 -q80 -t25 -u""" & SourceFile(j) Next .Close End With Set FSO = Nothing '¥Ð¥Ã¥Á¥Õ¥¡¥¤¥ë¤ò᤯¡£ Set WshShell = CreateObject("WScript.Shell") WshShell.Run TempPath & "\AllCap.bat ",1,true Set WshShell = Nothing '½ª¤ï¤ê
AllAttachPPT.vbs
Option Explicit Private FSO Private SourcePath,CapturePath,TempPath Private f,i '¢£É¬Íפʥѥé¥á¡¼¥¿¤Ï¢¤³¤³¤ÇÄ´À° SourcePath = "C:\test\testdir" '¤³¤³¤ËHTML¥½¡¼¥¹¤òÃÖ¤¯ CapturePath = "C:\test\capture" '¤³¤³¤ËJPEG¤¬½ÐÎϤµ¤ì¤ë¡£ TempPath = "C:\test\temp" '¤³¤³¤ËTEMP¥Õ¥¡¥¤¥ë¤¬½ÐÎϤµ¤ì¤ë¡£ 'ÊݸÀè¥Õ¥¡¥¤¥ë̾¤ò¼è¤ê½Ð¤¹ Private CaptureFile(99999) i = 0 Set FSO = CreateObject("Scripting.FileSystemObject") With FSO.OpenTextFile(TempPath & "\CapList.txt") While Not .AtEndOfStream i = i + 1 CaptureFile(i) = .ReadLine Wend .Close End With Set FSO = Nothing '¼èÆÀ¸µ¥Õ¥¡¥¤¥ë̾¤ò¼è¤ê½Ð¤¹ Private SourceFile(99999) i = 0 Set FSO = CreateObject("Scripting.FileSystemObject") With FSO.OpenTextFile(TempPath & "\HtmList.txt") While Not .AtEndOfStream i = i + 1 SourceFile(i) = .ReadLine Wend .Close End With Set FSO = Nothing Dim myPpt Dim ppAp Dim myPP, mySd Dim myH, myW Dim h, y, Flg Dim PPTextBox Private j Private FileName , Buffer , Buffer_text , Buffer_title 'PPT¥ª¥Ö¥¸¥§¥¯¥ÈÄêµÁ Set ppAp = CreateObject("PowerPoint.Application") ppAp.WindowState = 1 Set myPP = ppAp.Presentations.Add With myPP.SlideMaster myH = 420 myW = 173 End With For J = 1 to i Set FSO = CreateObject("Scripting.FileSystemObject") FileName = SourceFile(J) With FSO.OpenTextFile(FileName) Buffer = .ReadAll .Close End With 'ÆÉ¤ß¹þ¤ó¤À¥Õ¥¡¥¤¥ë(=Buffer)¤«¤é¥¿¥°¤ò¼è¤ê½ü¤¯ With New RegExp .Global = True .Pattern = "(<[^>]+>)" Buffer_text = .Replace(Buffer, "") ' ¶õ¹Ô¤òµÍ¤á¤¿¤¤¤¬¡¢¤Ê¤ó¤«¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤Ã¤¹¡£ .Pattern = "\r\n\r\n" Buffer_text = .Replace(Buffer_text, Chr(13)) End With 'ÆÉ¤ß¹þ¤ó¤À¥Õ¥¡¥¤¥ë(=Buffer)¤«¤é¥¿¥¤¥È¥ë¤òÃê½Ð ' With New RegExp ' .Global = True ' .Pattern = "(<[^>]+>)" ' Buffer_text = .Replace(Buffer, "") ' ¶õ¹Ô¤òµÍ¤á¤¿¤¤¤¬¡¢¤Ê¤ó¤«¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤Ã¤¹¡£ ' .Pattern = "^\n$" ' Buffer_text = .Replace(Buffer_text, "") ' End With '²èÁü¤òÄɲà Set mySd = myPP.Slides.Add(J, 1) myPP.Slides.Range(J).Shapes.AddPicture CaptureFile(J) & ".jpg", False, True, 10, 40, myW, myH '¥Æ¥¥¹¥È¤òÄɲà Set PPTextBox = myPP.Slides.Range(J).Shapes.AddTextbox(1, 200.0, 40.0, 233.0, 28.0) PPTextBox.TextFrame.WordWrap = True With PPTextBox.TextFrame.TextRange .Text = Buffer_text With .Font .NameFarEast = "£Í£Ó ÌÀÄ«" .Size = 12 End With End With ' '¥¿¥¤¥È¥ë¤òÄɲá¡¥¿¥¤¥È¥ë¤Ë½ÐÍè¤Ê¤¤¤¬¡¢¥Æ¥¥¹¥È¥Ü¥Ã¥¯¥¹¤ÇÄɲà ºîÀ®Ãæ ' Set PPTextBox = myPP.Slides.Range(J).Shapes.AddTextbox(1, 200.0, 40.0, 233.0, 28.0) ' PPTextBox.TextFrame.WordWrap = True ' With PPTextBox.TextFrame.TextRange ' .Text = Buffer_title ' With .Font ' .NameFarEast = "£Í£Ó ÌÀÄ«" ' .Size = 12 ' End With ' End With Next Set myPP = Nothing Set fso = Nothing
¢£»È¤¤Êý
¡¦¾åµ¤Î¥½¡¼¥¹¤òc:\test\¤Ë¤½¤ì¤¾¤ìÊݸ
¡¦c:\crena¤Ë¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥¹¥¯¥ê¥×¥È¤òÇÛÃÖ¡£
¡¦c:\test\testdir¡¡¤ËHTML¥Õ¥¡¥¤¥ë¤òÃÖ¤
GetAllCapture.vbs¤ò¼Â¹Ô¤¹¤ë¤È¡¢
c:\captureÇÛ²¼¤Ë¡¢testdir¤ÈƱ¤¸¥Ç¥£¥ì¥¯¥È¥ê¹½Â¤¤Ç¡¢
¡ö.html.jpg¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤òÅǤ¤Þ¤¯¤ë¡£
¾åµ¤Î¥¹¥¯¥ê¥×¥È¤ò¼Â¹Ô¸å¡¢PPT¤ò³«¤¤¤Æ
AllAttachPPT.vbs¤ò¼Â¹Ô
c:\capture°Ê²¼¤Îjpeg¤òޤêÉÕ¤±¤Æ¡¢
¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Î¥¿¥°°Ê³°¤ÎÉôʬ¤òޤêÉÕ¤±¤Þ¤¹¡£
¤³¤ì¤Ç¡¢·ÈÂÓ¤ÎÁ«°Ü¿Þ¤Ã¤Æ¤¤¤¦¤«¡¢»ÅÍͽñ¤ò½ñ¤¯¤Î¤Ë
¥¹¥²¡¼³Ú¤Ë¤Ê¤ë¤Ï¤º¡£
CrenaHtml2jpg £×£Å£Â¥Ú¡¼¥¸¤ò¥µ¥à¥Í¥¤¥ë²èÁü¤Ë¤¹¤ëexe
http://dip.picolix.jp/disp5.html
¹ØÆþ: 9¿Í ¥¯¥ê¥Ã¥¯: 124²ó








Vector¤¢¤¿¤ê¤ËÆþ¤ì¤¿¤¤¤Ê¡¦¡¦¡¦¤³¤ì¤ÇMacBookÇ㤨¤Ê¤¤¤«¤Ê¡©
¥½¡¼¥¹¤¬¸«¤ä¤¹¤¯¤Ê¤Ã¤¿¡£