[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 549
  • Last Modified:

Looping & Shell (Urgent)

I need to get this done yesterday, and am at my wits end.

I'm fairly new to VB, so be gentle.

I'm not sure the most efficient way of doing this task, but what I want to do is use commandline switches for a program (irfanview) across a bunch of files.

The commandline syntax that works when placed in the run window:

"C:\Program Files\IrfanView\i_view32.exe" /multitif=(c:\sample\mtout\000001.tif,c:\sample\mt\000001.tif,C:\FAQ\FAQ.tif)

What this does is add a second page (FAQ.tif) to the multipage tif (C:\sample\mt\000001.tif) and place the combined file in another folder (C:\sample\mtout\000001.tif)

I need to somehow loop through 10,000+ files whose filename increases incrementally. For example:

"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000001.tif,c:\sample\mt\000001.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000002.tif,c:\sample\mt\000002.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000003.tif,c:\sample\mt\000003.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000004.tif,c:\sample\mt\000004.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000005.tif,c:\sample\mt\000005.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000006.tif,c:\sample\mt\000006.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000007.tif,c:\sample\mt\000007.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000008.tif,c:\sample\mt\000008.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000009.tif,c:\sample\mt\000009.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000010.tif,c:\sample\mt\000010.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000011.tif,c:\sample\mt\000011.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000012.tif,c:\sample\mt\000012.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000013.tif,c:\sample\mt\000013.tif,C:\FAQ\FAQ.tif)"
"C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000014.tif,c:\sample\mt\000014.tif,C:\FAQ\FAQ.tif)"

I tried just doing a shell command like this:
shell (explorer.exe "C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000001.tif,c:\sample\mt\000001.tif,C:\FAQ\FAQ.tif)")

and this:
shell ("C:\Program Files\IrfanView\i_view32.exe /multitif=(c:\sample\mtout\000001.tif,c:\sample\mt\000001.tif,C:\FAQ\FAQ.tif)")

Both with syntax errors, and "expected :)" warnings.

I tried doing this in a batch file as well with no luck (probably attributed to ignorance as well).

Can anyone help!
0
csho
Asked:
csho
  • 2
1 Solution
 
vinnyd79Commented:
Try this:

Shell (Chr$(34) & "C:\Program Files\IrfanView\i_view32.exe" & Chr$(34) & " /multitif=(c:\sample\mtout\000001.tif,c:\sample\mt\000001.tif,C:\FAQ\FAQ.tif)")
0
 
cshoAuthor Commented:
Thank you, thank you, thank you.

I'll probably have a couple more questions along the way, I'll post the links here if you want to pick up some more points. You've saved my day.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now