y2kcmoore Posted February 21, 2006 Posted February 21, 2006 I have been given a task of finding away to have a user right click on a directory and from a pull down it will give them an option to resize all photos. This I can add in the registry. My problem is how do I use AuotIt to read the current directory and then decrease the color depth and then copy all changed files into a new sub directory. I was going to use Irfanview software to do the color depth changes since it can use command line scripting. Thanks for any input and I will post mine if I figure it out before I have a reply. -Chris
flyingboz Posted February 21, 2006 Posted February 21, 2006 have a user right click on a directory and from a pull down it will give them an optionSearch for explorer integration add context menu item or the like.. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.
y2kcmoore Posted February 21, 2006 Author Posted February 21, 2006 Search for explorer integration add context menu item or the like..Thanks for pointing me in a nice direction. I feel a better sense of accomplishment if somone doesn't just give me the solution.Thanks again.-Chris
y2kcmoore Posted February 22, 2006 Author Posted February 22, 2006 Ok. I making some progress, but I have run into a snag. I want to copy my images to a new Sub folder called reduced_images which is a sub folder in my working directory. The folder gets creaated but none of the files are copied. Can someone please show me where I screwed up. Thanks -Chris ;Make New Sub Reduced Dir DirCreate(@WorkingDir & "\reduced_images") ;copy files to new Sub Directory FileCopy(@WorkingDir & "*.*", @WorkingDir & "\reduced_images\*.*")
flyingboz Posted February 22, 2006 Posted February 22, 2006 (edited) Ok. I making some progress, but I have run into a snag.FileCopy(@WorkingDir & "*.*", @WorkingDir & "\reduced_images\*.*") @WorkingDir & "\*.*" Edited February 22, 2006 by flyingboz Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.
flyingboz Posted February 22, 2006 Posted February 22, 2006 FileCopy(@WorkingDir & "*.*", @WorkingDir & "\reduced_images\*.*") @WorkingDir & "\*.*" I'll be interested to see your contextmenu code / process when you've got that working. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.
y2kcmoore Posted February 22, 2006 Author Posted February 22, 2006 I didn't see your post and I just figured out Dircopy. Much easier than trying to create a new folder and then copy everything into it. I will post the whol thing once finished. Dircopy(@workingdir, @workingdir & "\reduced_images")
seandisanti Posted February 22, 2006 Posted February 22, 2006 I'll be interested to see your contextmenu code / process when you've got that working.in scripts and scraps, i have something i wrote that lets you add/remove/editcontext menu actions for any file type. if you check my topics by clicking on my name, it should be pretty easy to spot.
flyingboz Posted February 22, 2006 Posted February 22, 2006 in scripts and scraps, i have something i wrote that lets you add/remove/editcontext menu actions for any file type. if you check my topics by clicking on my name, it should be pretty easy to spot.The script camerons contextmenuworks by file extension, correct? He needs one that operates on the Folder, I believe. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.
seandisanti Posted February 22, 2006 Posted February 22, 2006 The script camerons contextmenuworks by file extension, correct? He needs one that operates on the Folder, I believe.ah... one sec i'll find where it's at in the registry...
seandisanti Posted February 22, 2006 Posted February 22, 2006 ah... one sec i'll find where it's at in the registry...just add keys to: HKEY_CLASSES_ROOT\Folder\shell\CommandNameYouWant\Command\ the default key is the one that will contain the command. for example: RegWrite("HKEY_CLASSES_ROOT\Folder\shell\Resizeinator\Command\","","REG_EXPAND_SZ",'"c:\resizer\resizer.exe" %1')
y2kcmoore Posted February 22, 2006 Author Posted February 22, 2006 (edited) Its almost working. I made the registry changes for my script but it's not working on the directory I am clicking on. It seems to default to the home directory of the sub directory I am clicking on. Does that make any sense? :bashingHead: --------------------------------------------------------------------------- Here is my Registry Change [HKEY_CLASSES_ROOT\Folder\shell\Image Reducer] @="Image Reducer" [HKEY_CLASSES_ROOT\Folder\shell\Image Reducer\command] @="c:\\windows\\system32\\reduce_image.exe" "%1" ----------------------------------------------------------------------------- Here is my AU3 script ;Make New Sub Reduced Dir Dircopy(@workingdir, @workingdir & "\reduced_images") ;Change working directory FileChangeDir(@workingdir & "\reduced_images") ;Runs IV RunWait(@ComSpec & " /c " & "i_view32.exe *.jpg /resize=(640,480) /bpp=4 /convert=*.jpg") Edited February 22, 2006 by y2kcmoore
seandisanti Posted February 22, 2006 Posted February 22, 2006 --------------------------------------------------------------------------- Here is my Registry Change [HKEY_CLASSES_ROOT\Folder\shell\Image Reducer] @="Image Reducer" [HKEY_CLASSES_ROOT\Folder\shell\Image Reducer\command] @="c:\\windows\\system32\\reduce_image.exe" this will just run the executable. it won't pass the name of the folder you selected.... if you're manually adding it to the registry, try using: "c:\\windows\\system32\\reduce_image.exe" %1 (with the quotes) if you're doing it programmatically, use the same thing, except surround it in single quotes, so that the double quotes are passed.
masvil Posted February 22, 2006 Posted February 22, 2006 Good if someone could use that dll: http://www.crazybeavers.se/products_imagerresizer.asp
y2kcmoore Posted February 22, 2006 Author Posted February 22, 2006 Thanks and I will give it a try in the morning when I return to my office.
y2kcmoore Posted February 24, 2006 Author Posted February 24, 2006 Thanks to everyone that gave me guidance. The program is working but not at 100%, but everyone loves it. The script will only work on directories called "Pictures" and it is written only for JPG files. For the script to work you must install Irfanview software which is free and easily scriptable and make sure it's installed in your %systemroot%\system32 directory. http://www.irfanview.com/Here are the instructions I gave my users.You must name the directory where your pictures are stored pictures (without the quotes) for this program to work. Copy your JPG files to the "Pictures" Directory and "Right Click" on the "Pictures" Directory and in the pull down select "Image Reducer". It will create a sub-directory inside the pictures folder called reduced_pictures and it will copy your JPG files and reduce them to a more manageable size.:Now for the script for image_reducer.exe; ----------------------------------------------------------------------------;; AutoIt Version: 3.1.0; Author: C.Moore;; Script Function:; Reduce JPG Images to 640x480; ----------------------------------------------------------------------------; Script Start - Add your code below hereFileChangeDir(@workingdir & "\pictures");Make New Sub Reduced DirDircopy(@workingdir, @workingdir & "\reduced_pictures");Change working directoryFileChangeDir(@workingdir & "\reduced_pictures");Runs IVRunWait(@ComSpec & " /c " & "i_view32.exe *.jpg /resize=(640,480) /bpp=4 /convert=*.jpg");End of Script--------------------------------------------------------------------------------------To Intergrate for a right click pull down functionWin2K Registry Settings--------------------------------------------------------Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\Folder\shell\Image_Reducer]@="Image Reducer"[HKEY_CLASSES_ROOT\Folder\shell\Image_Reducer\command]@="\"c:\\winnt\\system32\\reduce_image.exe\" \"%1\""-------------------------------------------------------------WinXP Registry Settings-------------------------------------------------------------Windows Registry Editor Version 5.00[-HKEY_CLASSES_ROOT\Folder\shell\Resize for PONTIS][HKEY_CLASSES_ROOT\Folder\shell\Image_Reducer]@="Image Reducer"[HKEY_CLASSES_ROOT\Folder\shell\Image_Reducer\command]@="\"c:\\windows\\system32\\reduce_image.exe\" \"%1\""--------------------------------------------------------------------Thanks again for eveyone's guidance-Chris
seandisanti Posted February 24, 2006 Posted February 24, 2006 Thanks to everyone that gave me guidance. The program is working but not at 100%, but everyone loves it. The script will only work on directories called "Pictures" FileChangeDir(@workingdir & "\pictures")that line is where your issue is. that's why the directory has to be named pictures. now if you've added the %1 after the command in your context menu addition, then the folder name being right clicked on is actually being passed to the script, and you can use that to go to the right directory as so: If $CmdLine[0] Then FileChangeDir($CmdLine[1]) Else FileChangeDir(@workingdir & "\pictures") EndIf the first line checks to see if any parameters were passed to the script, if yes, that would be the directory right clicked on. if not, then it will still default to the path you had previously.
y2kcmoore Posted February 27, 2006 Author Posted February 27, 2006 cameronsdad... You are the man. I suck a$$ at all types of programing. Thanks for your help.
jefhal Posted February 27, 2006 Posted February 27, 2006 resize all photos.If you are using WinXP and don't really need the color reduction, you could use the Windows XP PowerToy called ResizePhotos... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
seandisanti Posted February 27, 2006 Posted February 27, 2006 cameronsdad... You are the man. I suck a$$ at all types of programing. Thanks for your help.always glad to help. don't get down on yourself man, everyone starts at the same place, and this looks to be a functional script that you've thought of and created. good job man.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now