AutoHotkey Community

It is currently May 27th, 2012, 11:34 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: October 28th, 2009, 12:16 am 
Offline

Joined: August 9th, 2009, 9:27 am
Posts: 35
Can anyone help me create a script that "Watches" a folder...when a new image is added to the folder, then it is instantly and automatically resized and saved in a subfolder called "thumbnails"?

Not sure if we have to integrate irfanview here or not? I really appreciate the help!
Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 12:49 am 
Offline

Joined: May 13th, 2009, 5:51 pm
Posts: 30
I dont know the answer off the top of my head but am also interested. I could be wrong, but it doesnt look like irfanview will let you resize your thumbnail via command line. This looks like a simple alternative here, using ImageMagick
following this template:
Code:
convert -resize 200 image.png "thumb_image.png

have AHK fill in the appropriate names... of course this is only half the battle, not sure on the best way to "watch" the folder.
Good luck!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 12:57 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
take a look here, it doesn't do the image conversion
folder monitor
http://www.autohotkey.com/forum/viewtop ... tch+folder


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 12:57 am 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
For the watch part you could use a nested FilePattern loop that looks for a new image file. You would have to manually set the folder though.

You could also use WatchDirectory() function. It monitors continuously and returns the name of a file created.

hth

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 1:00 am 
Offline

Joined: August 9th, 2009, 9:27 am
Posts: 35
Thanks guys, getting closer. I have been banging my head trying to figure this out...so a solution would be great if anyone can help. Irfanview does accept command line operations, but not sure if that's even the way to go.

Any help greatly appreciated!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 9:44 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
while I usually advocate writing things yourself, sometimes it's nice when someone else has already done it.

http://lifehacker.com/5383780/dropresiz ... zes-photos

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 7:15 pm 
Offline

Joined: August 9th, 2009, 9:27 am
Posts: 35
Pretty good find Dropresize, but it overwrites the original file :( Need something that just keeps the original in tact, then resizes and puts them in a new folder. There's some program called febooti, but it's not free and overkill for the simple task.

Hopefully we can find a solution!
Thanks for helping :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 8:09 pm 
go with the irfanview way

either way, not like we are going to create a resize funtion, we need to call some dll anyways, so why not from the irfanview. there is nothing wrong with using a good function


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 8:36 pm 
Offline

Joined: August 9th, 2009, 9:27 am
Posts: 35
I'm all for irfanview, but how do we "monitor" a folder so that it calls a function to irfanview when a new file comes in?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 15th, 2009, 1:35 pm 
Offline

Joined: February 1st, 2006, 4:37 pm
Posts: 365
I have try IrfanView but.....

The command line isn't work with Autohotkey, as I hoped for.
(From IrfanView manual: i_view32.exe c:\*.jpg /resize=(500,300) /convert=d:\temp\*.png)

If I write the command to IrfanView in a "dos box",
the command works without problems.

as an example:
i_view32.exe c:\temp\pic\*.jpg /resize=(640,480) /convert=c:\temp\pic\result\*.png

or if I make an batch file (convert.bat) and run this file

or if I run the batch file like this:
Code:
RunWait Convert.bat


it works!


But if I want to run the same command with Autohotkey it doesn´t work.
Code:
RunWait c:\program\IrfanView\I_View32.exe C:\Temp\Pic\*.jpg /resize=(640,480) /convert=C:\Temp\Pic\Result\*.png


I have also tried

Code:
RunWait %comspec% /c c:\program\IrfanView\I_View32.exe C:\Temp\Pic\*.jpg /resize=(640,480) /convert=C:\Temp\Pic\Result\*.png


Why?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 15th, 2009, 3:23 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
did you try:?
Code:
RunWait %comspec% /c c:\program\IrfanView\I_View32.exe "C:\Temp\Pic\*.jpg" "/resize=(640,480)" "/convert=C:\Temp\Pic\Result\*.png"


The comma within resize= perhaps has to be escaped...:
Code:
RunWait %comspec% /c c:\program\IrfanView\I_View32.exe "C:\Temp\Pic\*.jpg" "/resize=(640`,480)" "/convert=C:\Temp\Pic\Result\*.png"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 4:29 pm 
Offline

Joined: February 1st, 2006, 4:37 pm
Posts: 365
aaffe wrote:
did you try:?

The comma within resize= perhaps has to be escaped...:
Code:
`,


This was the point!

Now It works, Thank´s!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group