need a help for a UDC to Irfan view
-
calude
- Posts: 355
- Joined: 13 Aug 2008 10:16
- Location: Switzerland
- Contact:
need a help for a UDC to Irfan view
Hi
trying to send a command line to Irfanview so it creates a thumb from a jpg
here is the command set in Openwith in XY
"C:\Program Files\iview410\i_view32.exe" <curitem> /resize=(160,100) /resample /aspectratio /convert=<curitempath>\tn_$N.jpg
irfanview complains:
JPG Save error !
Can't open file for writing: "E:\G9\20080516\tn_img_1536.jpg "E_\G9\20080516\img_1536.JPG"
the path seem correct.
the example given by the IfV help is :
i_view32.exe c:\test.bmp /resize=(100,100) /resample /aspectratio /convert=d:\$N_thumb.jpg
Any Idea ??
Thanks
Calude
trying to send a command line to Irfanview so it creates a thumb from a jpg
here is the command set in Openwith in XY
"C:\Program Files\iview410\i_view32.exe" <curitem> /resize=(160,100) /resample /aspectratio /convert=<curitempath>\tn_$N.jpg
irfanview complains:
JPG Save error !
Can't open file for writing: "E:\G9\20080516\tn_img_1536.jpg "E_\G9\20080516\img_1536.JPG"
the path seem correct.
the example given by the IfV help is :
i_view32.exe c:\test.bmp /resize=(100,100) /resample /aspectratio /convert=d:\$N_thumb.jpg
Any Idea ??
Thanks
Calude
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: need a help for a UDC to Irfan view
Here's the correct code 
Code: Select all
OpenWith("""C:\Program Files\iview410\i_view32.exe"" <items> /resize=(160,100) /resample /aspectratio /convert=<curitempath>\tn_$N.jpg", "s");Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
calude
- Posts: 355
- Joined: 13 Aug 2008 10:16
- Location: Switzerland
- Contact:
Re: need a help for a UDC to Irfan view
Indeed it works
thanks Zer0
why did you choose to use a script instead of a command line from user/openWith wich I was investigating ??
Calude
thanks Zer0
why did you choose to use a script instead of a command line from user/openWith wich I was investigating ??
Calude
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: need a help for a UDC to Irfan view
Essentially, they both achieve the same outcome. Also, I like to rope in extra things so having a script offered the most flexibility, i.e. personal choice. Last but not least, I have no OpenWith UDCs, but I have scripts that do OpenWith, so it was a quick copy/paste with a little editingcalude wrote:why did you choose to use a script instead of a command line from user/openWith wich I was investigating??
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
little titty
- Posts: 81
- Joined: 15 Nov 2009 19:34
Re: need a help for a UDC to Irfan view
Zero thanks for the code, works fine. Is there a way of tweaking it so that if I select a group of photos in a folder it will make the same size thumbnails of them all? If I try that with the current script IView complains "cant read file header"
Why doesn't everybody have a great user name like mine?
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: need a help for a UDC to Irfan view
Yep, that's because the current script passes to a single instance of an application. Technically, it shouldn't even have "<items>" (it should be "<curitempath>"), because a single instance of IrfanView doesn't process multiple items in the way that XYplorer passes them. For multiple photo -> thumbnail processing, you have several options (some are better than others, you chooselittle titty wrote:Zero thanks for the code, works fine. Is there a way of tweaking it so that if I select a group of photos in a folder it will make the same size thumbnails of them all? If I try that with the current script IView complains "cant read file header"
a) Try using "m" switch in the current script, so each file should be passed to its own instance of IrfanView. Not quite efficient, but easy and quick.
b) If you're processing all files of one format (JPG/PNG/WhateverG) then you can use "PATH TO YOUR FILES\*.FILE_EXTENSION" i.e. "c:\*.jpg" instead of "<items>".
c) The best solution, it involves more work though, is to create a script that would loop through the List-selected items to create a text file with each file name on a new line. This file should then be passed to IrfanView like "/filelist=c:\files _to process.txt", so no need for "<items>". In this case, you can (maybe even should, but your call) use "run" instead of "OpenWith", because "run" has a "wait" switch, so you can have XY's script wait until IrfanView finishes processing files and then tidy things up: delete images from which thumbs were made, delete the created TXT file or what you wish
P.S. I'd post a script to do c) later (mind on other things, no time to test), but another scripts' writer is welcome to do that if it's urgent
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
little titty
- Posts: 81
- Joined: 15 Nov 2009 19:34
Re: need a help for a UDC to Irfan view
HI, thanks for the reply, I will try option B as option c is beyond me!
Yes I was meaning a script for one file type, .jpg
It would just be handy when having to make a few thumbnails for putting pictures on my website.
yes option B works fine. but it means i always have to put the files in a certain dir first
now I just need a script that would automatically put the files I select in a certain folder!
just curious but in option A, what is the m switch?
Yes I was meaning a script for one file type, .jpg
It would just be handy when having to make a few thumbnails for putting pictures on my website.
yes option B works fine. but it means i always have to put the files in a certain dir first
now I just need a script that would automatically put the files I select in a certain folder!
just curious but in option A, what is the m switch?
Why doesn't everybody have a great user name like mine?
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: need a help for a UDC to Irfan view
The script below will create a text file with a list of files that you have selected. Just pass that list to IrfanView and no need to create folders and move files to themlittle titty wrote:yes option B works fine. but it means i always have to put the files in a certain dir first
now I just need a script that would automatically put the files I select in a certain folder!
Code: Select all
$filelist = getinfo("SelectedItemsPathNames");
writefile("files.txt", "$filelist");
As per Help filelittle titty wrote:just curious but in option A, what is the m switch?
m: Multiple instance (pass each of the items to its own instance of the application).
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
little titty
- Posts: 81
- Joined: 15 Nov 2009 19:34
Re: need a help for a UDC to Irfan view
thanks that seems the best solution
I am curious though why using this script didnt produce the result expected
I wanted to resize the images currently in C:\thumbs and not have them moved but the result is the images are resized and also moved to C:\ why?
I am curious though why using this script didnt produce the result expected
I wanted to resize the images currently in C:\thumbs and not have them moved but the result is the images are resized and also moved to C:\ why?
Code: Select all
OpenWith("""D:\PROGRAM FILES\IrfanView\i_view32.exe"" c:\thumbs\*.jpg /resize=(160,100) /resample /aspectratio /convert=<curitempath>\tn_$N.jpg", "s");Why doesn't everybody have a great user name like mine?
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: need a help for a UDC to Irfan view
Probably because for <curitempath> in /convert switch to work it needs for an item to be selected and that never happens (in XY, that is; it's IrfanView that does the selecting). Hard-coding a path or using <curpath> would be the next best thing methinks.little titty wrote:I am curious though why using this script didnt produce the result expected
I wanted to resize the images currently in C:\thumbs and not have them moved but the result is the images are resized and also moved to C:\ why?Code: Select all
OpenWith("""D:\PROGRAM FILES\IrfanView\i_view32.exe"" c:\thumbs\*.jpg /resize=(160,100) /resample /aspectratio /convert=<curitempath>\tn_$N.jpg", "s");
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
little titty
- Posts: 81
- Joined: 15 Nov 2009 19:34
Re: need a help for a UDC to Irfan view
in the end i wrote a .bat file couldnt figure out how to send a list to irfanview - wasnt much in the help file on sending arguments to other progs. could do with more written for newbies to scripting, more examples etc.
anyway with my simple bat file I can just put a bunch of files in a folder and run the bat and it works for me.
anyway with my simple bat file I can just put a bunch of files in a folder and run the bat and it works for me.
Code: Select all
start /wait i_view32.exe C:\thumbs\*.jpg /resize=(500,300) /aspectratio /resample /convert=C:\thumbs\*.jpgWhy doesn't everybody have a great user name like mine?
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: need a help for a UDC to Irfan view
Well, I used the following script to create thumbs from a selection written to a text file (use your own paths, of courselittle titty wrote:in the end i wrote a .bat file couldnt figure out how to send a list to irfanview - wasnt much in the help file on sending arguments to other progs. could do with more written for newbies to scripting, more examples etc.
anyway with my simple bat file I can just put a bunch of files in a folder and run the bat and it works for me.Code: Select all
start /wait i_view32.exe C:\thumbs\*.jpg /resize=(500,300) /aspectratio /resample /convert=C:\thumbs\*.jpg
Code: Select all
run '"C:\Program Files\IrfanView\i_view32.exe" /filelist=C:\files.txt /resize=(160,100) /resample /aspectratio /convert=C:\thumbs\tn_$N.jpg';Regarding scripting for newbies, you should bear in mind that scripting is an advanced topic and it's a challenge to balance the documentation for both newbies and scripting/programming professionals. We try to make it easier by having multiple sources of information (Help file, forum, Wiki, main site) and the forum as means of asking questions about the matter.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
little titty
- Posts: 81
- Joined: 15 Nov 2009 19:34
Re: need a help for a UDC to Irfan view
Thanks very much for that, I now have some idea of the use of a file list, I searched the forum but couldnt find an example. I have used your example to make 2 versions of a script one to copy all files within a folder and resize them and the other to only resize selected files.
Thanks I learned something
Thanks I learned something
Why doesn't everybody have a great user name like mine?
XYplorer Beta Club