照片自动脚本&印刷 - 方向/评论欢迎

时间:2015-11-11 11:33:47

标签: batch-file vbscript

这是我希望实现的目标,我不是专家,所以我在浪费时间吗?

  1. 照片从相机进入 - 使用wifi SD,立即创建副本到文件夹(使用.bat)

  2. 批处理文件运行,并定期检查文件, 一旦总共有4个文件,它会将文件移动到唯一的文件 文件夹,说文件夹1,2,3等。

  3. 3.Vb脚本然后通过Irfan运行该文件夹,创建一个 '全景'图片。

    4.然后使用.Bat文件

    自动打印全景图像

    1.这可能包含另一项行动

    1. 这可以包含在下面吗?

    2. 这是我正在使用的脚本,这运行得很好但是我必须手动将带有3个图像的文件夹拖到* .vbs上:

      dim shell, fso
      Dim f, folderlist, item, File(4), process, panout, Irfanview, Appcall
      Dim mask, test, dot, extn, count
      set fso = CreateObject("Scripting.FileSystemObject")
      set shell = createObject("WScript.shell")
      
      'Defaults
      Irfanview = "C:\Program files\Irfanview\i_view64.exe"  'location of irfanview application
      mask = "jpg,png,gif"                                   'files to process inside folder
      panextn = ".jpg"                                       'file type for panoramas
      
      If wscript.arguments.count = 0 then
       msgbox "No folder selected" : wscript.quit
      else
       process = wscript.arguments(0)
      end if
      
      Appcall = chr(34) & Irfanview & chr(34) & " "  
      panout= process & "\panoramas"
      if fso.FolderExists(panout) = false then fso.CreateFolder(panout)
      
      Set f = fso.GetFolder(process)
      Set folderlist = f.Files
      Count=1
      For Each item in folderlist
         test= item.name : dot=InstrRev(test,".")
         if dot >1 and len(test)-dot >1 then extn = mid(test,dot+1) else extn = "none"
         if instr(1,mask,extn,1) >0 then
            File(count) = test
            If count=3 then count=0 : pano File(1), File(2), File(3)
            count=count+1
         End If
      Next
      
      set shell=nothing
      set objFSO=nothing
      WScript.quit
      
      Sub pano (f1,f2,f3)
        concat = panout & "\" & head(f1) & "_" & head(f2) & "_" & head(f3) & panextn
        filestring = "1," & f1 & "," & f2 & "," & f3               ' horizontal=1 , vertical=2
        shell.Run Appcall & "/panorama=("& filestring & ") /convert=" & concat ,2 ,true
      ' wscript.echo concat
      End sub
      
      Function head(name)
       head=left(name, instr(name, ".")-1)
       name= process & "\" & name
      End function
      
    3. 这是我用来打印图片的* .bat文件。 效果很好。

      @echo off

      setlocal ENABLEEXTENSIONS
      
      rem ************
      rem * Settings *
      rem ************
      
      rem Path to Irfan view
      rem If IrfanView is installed in the common program files folder this part
      rem should be usable.
      rem If you have installed IrfanView elsewhere, i.e. in D:\Tools\IV then
      rem just delete these lines and uncomment and modify the set iview line.
      if /i "%PROCESSOR_ARCHITECTURE%" equ "AMD64" (
       if exist "C:\ProgramFiles\IrfanView\i_view64.exe" (
        rem Path to 64 Bit IrfanView on x64 Windows
        set iview="C:\ProgramFiles\IrfanView\i_view64.exe"
       ) else (
        rem Path to 32 Bit IrfanView on x64 Windows
        set iview="C:\ProgramFiles(x86)\IrfanView\i_view32.exe"
       )
      ) else (
       rem Path to 32 Bit IrfanView on x86 Windows
       set iview="C:\Program Files\IrfanView\i_view32.exe"
      )
      rem set iview="D:\tools\i_view32.exe"
      if not exist %iview% goto noIview
      
      rem Configure variables
      rem Delay in seconds
      set delay=10
      
      rem Directory to be scanned
      set scandir=D:\Photo
      
      rem Directory to move pictures after printing
      set printeddir=D:\Photo\Photo Printer
      
      rem File types (seperate with colon)
      set filetypes=.jpg:.jpeg
      
      rem Text file to keep file names of printed files
      set printed="%scandir%\PrintedWithIrfanView.txt"
      
      rem Use default printer
      set print=/print="HP"
      rem Or set a special printer, just replace the printer name and remove the "rem"
      rem set print=/print="My special printer"
      
      
      rem Additional tools
      set choice="%SystemRoot%\system32\choice.exe"
      if not exist %choice% goto nochoice
      set find="%SystemRoot%\system32\find.exe"
      if not exist %find% goto nofind
      
      rem Check if the directory containig the pictures exists
      if not exist "%scandir%" goto noscandir
      
      rem Check if a directory name for printed images is set and the directory exists 
      if "%printeddir%" neq "" (
       if not exist "%printeddir%" (
        mkdir "%printeddir%"
        if not exist "%printeddir%" goto noprinteddir
       )
      )
      
      rem Change to the input directory
      pushd "%scandir%"
      
      echo Scanning directory
      echo  %scandir%
      echo for new pictures and print them.
      echo.
      rem Do the loop
      :loop
      for /f "delims=" %%a in ('dir /b') do call :check "%%~fa" "%%~xa"
      
      rem Ask for exit or continue scanning
      %choice% /T %delay% /C XC /D C /M "X for exit, C for immediate checking."
      if errorlevel 2 goto loop
      
      rem After finishing go to the end
      popd
      goto end
      
      rem Check file
      :check
      echo %time% Checking...
      rem Check the file type
      echo %filetypes% | %find% /i "%~2" >nul
      if errorlevel 1 goto :eof
      rem File type ok
      
      if "%printeddir%" neq "" goto check2
      
      rem If the text file does not exist, print
      if not exist %printed% call :print %1
      
      rem Check if the file name is already in the text file
      type %printed% | %find% /i %1 >nul
      if errorlevel 1 call :print %1
      goto :eof
      
      rem The file have to be moved to the printed directory so there is no need for creating
      rem and checking the "printed" text file.
      :check2
      call :print %1
      move %1 "%printeddir%"
      goto :eof
      
      :print
      rem Print the picture
      echo Printing %1
      start "IrfanView" /wait %iview% %1 %print% /ini="%scandir%"
      
      if "%printeddir%" equ "" goto :eof
      rem Appending file name
      (echo %~1)>>%printed%
      goto :eof
      
      :noscandir
      echo %scandir% not found.
      goto end
      
      :noprinteddir
      echo %printeddir% not found and cannot be created.
      goto end
      
      rem IrfanView could not be found.
      :noiview
      echo IrfanView not found in the given path:
      echo   %iview%
      goto end
      
      rem choice could not be found.
      :nochoice
      echo choice.exe not found in the given path:
      echo   %choice%
      goto end
      
      rem find could not be found.
      :nofind
      echo find.exe not found in the given path:
      echo   %find%
      goto end
      
      rem End of the script
      :end
      endlocal
      

0 个答案:

没有答案