Batch file 照片的自动脚本&;印刷-欢迎提供指导/意见

Batch file 照片的自动脚本&;印刷-欢迎提供指导/意见,batch-file,vbscript,Batch File,Vbscript,这就是我希望达到的目标,我不是专家,所以我是在浪费时间吗 照片来自摄像头-使用wifi SD,立即创建到文件夹的副本(使用.bat) 批处理文件运行,并定期检查文件, 一旦总共有4个文件,它会将这些文件移动到一个唯一的位置 文件夹,比如文件夹1、2、3等 3.Vb脚本然后通过Irfan运行文件夹,以创建 “全景”图像 4.然后使用.Bat文件自动打印全景图像 1.这可能包括另一个操作 这可以包括在下面吗 这是我正在使用的脚本,运行良好,但我必须手动将包含3个图像的文件夹拖到*.vbs上: di

这就是我希望达到的目标,我不是专家,所以我是在浪费时间吗

  • 照片来自摄像头-使用wifi SD,立即创建到文件夹的副本(使用.bat)

  • 批处理文件运行,并定期检查文件, 一旦总共有4个文件,它会将这些文件移动到一个唯一的位置 文件夹,比如文件夹1、2、3等

  • 3.Vb脚本然后通过Irfan运行文件夹,以创建 “全景”图像

    4.然后使用.Bat文件自动打印全景图像


    1.这可能包括另一个操作

  • 这可以包括在下面吗

  • 这是我正在使用的脚本,运行良好,但我必须手动将包含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
    
  • 这是一个*.bat文件,我正在使用它来打印图像。。 效果非常好

    @回音

    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
    

  • 这里有很多代码。有几个地方说它正在发挥作用。哪个部件不工作或缺失?我发现很难相信它能正常工作,除非你已经从“Program Files”和“Program Files(x86)”目录名中删除了空格字符。如果你想让cmd脚本(.bat文件)连续监视一个目录中的四(4)个文件,那就不是VB.NET代码,它将需要一个程序实例在您的Windows程序栏上,只要它是看。这真的是你想要的吗?