{"id":55543,"date":"2008-05-17T01:43:00","date_gmt":"2008-05-17T01:43:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2008\/05\/17\/hey-scripting-guy-how-can-i-search-a-folder-for-all-the-image-files-that-are-not-a-specified-height-and-width\/"},"modified":"2008-05-17T01:43:00","modified_gmt":"2008-05-17T01:43:00","slug":"hey-scripting-guy-how-can-i-search-a-folder-for-all-the-image-files-that-are-not-a-specified-height-and-width","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/hey-scripting-guy-how-can-i-search-a-folder-for-all-the-image-files-that-are-not-a-specified-height-and-width\/","title":{"rendered":"Hey, Scripting Guy! How Can I Search a Folder For All the Image Files That Are Not a Specified Height and Width?"},"content":{"rendered":"<p><img decoding=\"async\" class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" height=\"34\" alt=\"Hey, Scripting Guy! Question\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\" \/> <\/p>\n<p>Hey, Scripting Guy! I have a folder on a server that contains employee photos, photos that will be used on our organization chart. New photos are taken daily for new staff members, and all the .JPG files are put into this folder. Because the photos are often different sizes, I would like to write a script that checks the folder for photos that are not the specified size, then runs a third-party application to resize the images. How can I search this folder for image files that are not 100 pixels by 121 pixels?<br \/>&#8212; BJ<\/p>\n<p><img decoding=\"async\" height=\"5\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" border=\"0\" \/><img decoding=\"async\" class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" height=\"34\" alt=\"Hey, Scripting Guy! Answer\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\" \/><a href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><img decoding=\"async\" class=\"farGraphic\" title=\"Script Center\" height=\"288\" alt=\"Script Center\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" align=\"right\" border=\"0\" \/><\/a> <\/p>\n<p>Hey, BJ. You know, this is very pivotal day for the Scripting Guy who writes this column. His car is just about out of gas, which means he has to do one of two things: 1) drive the car until it runs out of gas, and then abandon it in the middle of the road; or, 2) fill it up with gas.<\/p>\n<p>Back in the good old days that wouldn\u2019t have been much of a decision: if his car was out of gas then he\u2019d just buy more gas. In our new and improved modern era, however, this is a much tougher choice; after all, it might very well be cheaper to just buy a new car than to have to fill the old one up with gas.<\/p>\n<p>Admittedly, the price of gas has been a \u2026 bit \u2026 high for quite some time now. However, in just the past few days that price has crossed a line that never should have been crossed: in the Redmond area it now costs more than $4 to buy a single gallon of premium unleaded. Just a couple weeks ago the Scripting Guy who writes this column said, \u201cThere\u2019s no way I\u2019ll ever pay $4 a gallon for gas. No way.\u201d Well, now it\u2019s time for him to put those principles to the test.<\/p>\n<table class=\"dataTable\" id=\"E3C\" cellSpacing=\"0\" cellPadding=\"0\">\n<thead><\/thead>\n<tbody>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\"><b>Note<\/b>. Wasn\u2019t it just a year or so ago that the Scripting Guy who writes this column said, \u201cThere\u2019s no way I\u2019ll ever pay $2 a gallon for gas. No way.\u201d? Well, to tell you the truth, we don\u2019t remember. Still, that <i>was<\/i> a rash and foolhardy remark. Which, all things considered, <i>does<\/i> sound like the sort of thing he\u2019d say, doesn\u2019t it?<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"dataTableBottomMargin\"><\/div>\n<p>Truth be told, the Scripting Guy who writes this column will probably cave in and buy the gas; he really doesn\u2019t have much choice. (If you\u2019ve ever tried taking the bus from his house in Kirkland to Microsoft \u2013 a 9-mile trip that by bus takes well over an hour to complete \u2013 you\u2019d know <i>why<\/i> he really doesn\u2019t have much choice.) However, he <i>is<\/i> toying with the idea of buying the cheaper, medium-grade gas. Granted, that\u2019s not recommended for his car (although it won\u2019t hurt anything), but the \u201cplus\u201d grade <i>does<\/i> sell for less than $4 a gallon.<\/p>\n<p>Oops. Never mind; turns out that the medium-grade of gas has also skyrocketed past the $4-a-gallon barrier. So much for Plan B.<\/p>\n<p>You know, now that you mention it, the Scripting Guy who writes this column probably <i>should<\/i> stop buying all those expensive Italian sports cars that require the highest-grade gas. But hey, he <i>does<\/i> have a reputation to maintain.<\/p>\n<p>Well, OK. He actually <i>does<\/i> have a reputation, but it isn\u2019t one he\u2019s particularly interested in maintaining.<\/p>\n<table class=\"dataTable\" id=\"EGE\" cellSpacing=\"0\" cellPadding=\"0\">\n<thead><\/thead>\n<tbody>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\"><b>Note<\/b>. In case you\u2019re wondering, the Scripting Guy who writes this column doesn\u2019t begrudge the oil companies for continuing to raise the price of gas on an hourly basis, even while they report record profits each and every quarter. After all, the people who run the oil companies probably own a <i>lot<\/i> of cars; can you imagine how much <i>they<\/i> must spend on gas each month?<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"dataTableBottomMargin\"><\/div>\n<p>What this all means, of course, is that the Scripting Guy who writes this column can\u2019t afford to get fired right now, which means he should really stop complaining and start working. Although, now that he thinks about, not having to drive in to work every day <i>would<\/i> save an awful lot of money \u2026.<\/p>\n<p>You know what? While the Scripting Guy who writes this column ponders this dilemma, why don\u2019t the rest of you take a moment to look over the following script, a script that reports back all the image files in a folder that haven\u2019t been sized to 100 pixels wide by 121 pixels high:<\/p>\n<pre class=\"codeSample\">Set objShell = CreateObject (\"Shell.Application\")\nSet objFolder = objShell.Namespace (\"C:\\Images\")\n\nFor Each strFileName in objFolder.Items\n    intHorizontalSize = objFolder.GetDetailsOf(strFileName, 27) \n    intHorizontalSize = Replace(intHorizontalSize, \" pixels\", \"\")\n\n    intVerticalSize = objFolder.GetDetailsOf(strFileName, 28) \n    intVerticalSize = Replace(intVerticalSize, \" pixels\", \"\")\n\n    If intHorizontalSize &lt;&gt; 100 OR intVerticalSize &lt;&gt; 121 Then\n        Wscript.Echo strFileName.Path\n    End If\nNext\n<\/pre>\n<p>OK, let\u2019s see what we have here. This script kicks off by creating an instance of the <b>Shell.Application<\/b> object, an object that lets us get at file properties (such as the vertical and horizontal size of an image file) that WMI and the FileSystemObject <i>can\u2019t<\/i> get to. (The one drawback to the Shell.Application object: it\u2019s designed for use on the local computer only.) After we create an instance of the Shell object we use the oddly-named <b>Namespace<\/b> method to bind to the folder C:\\Images, the folder where we\u2019ve stashed all our employee pictures:<\/p>\n<pre class=\"codeSample\">Set objFolder = objShell.Namespace (\"C:\\Images\")\n<\/pre>\n<p>Once we\u2019re connected to the Images folder we can retrieve a collection of all the files in that folder simply by referencing the folder\u2019s <b>Items<\/b> property. That also means we can use the following line of code to set up a For Each loop that enables us to loop through each and every file in that collection:<\/p>\n<pre class=\"codeSample\">For Each strFileName in objFolder.Items\n<\/pre>\n<p>As it turns out, the Shell object (or, more correctly, the <b>Folder<\/b> object, the object we create when we call the Namespace method) includes a method named <b>GetDetailsOf<\/b>; as the name implies, this method can be used to retrieve detailed information (i.e., property values) for a given file. To use the GetDetailsOf method you need to pass it a file name and one of the following integer values, depending on the property you\u2019re interested in:<\/p>\n<table class=\"dataTable\" id=\"EYF\" cellSpacing=\"0\" cellPadding=\"0\">\n<thead><\/thead>\n<tbody>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\"><b>Integer Value<\/b><\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\"><b>Property<\/b><\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">0<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Name<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">1<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Size<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">2<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Type<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">3<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Date Modified<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">4<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Date Created<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">5<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Date Accessed<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">6<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Attributes<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">7<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Status<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">8<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Owner<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">10<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Title<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">11<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Subject<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">12<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Category<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">13<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Pages<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">14<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Comment<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">15<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Copyright<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">16<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Artist<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">17<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Album Title<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">18<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Year<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">19<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Track Number<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">20<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Genre<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">21<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Duration<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">22<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Bit Rate<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">23<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Protected<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">24<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Camera Model<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">25<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Date Picture Taken<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">26<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Dimensions<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">27<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Horizontal Image Size<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">28<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Vertical Image Size<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">29<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Episode Name<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">30<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Program Description<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">32<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Audio Sample Size<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">33<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Audio Sample Rate<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">34<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Channels<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">35<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Company<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">36<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Description<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">37<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">File Version<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">38<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Product Name<\/p>\n<\/td>\n<\/tr>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">39<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Product Version<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">40<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Keywords<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"dataTableBottomMargin\"><\/div>\n<p>If you look closely, you\u2019ll see two properties (and integer values) that are of particular interest to us:<\/p>\n<table class=\"dataTable\" id=\"ENEAC\" cellSpacing=\"0\" cellPadding=\"0\">\n<thead><\/thead>\n<tbody>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">27<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Horizontal Image Size<\/p>\n<\/td>\n<\/tr>\n<tr class=\"evenRecord\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\">28<\/p>\n<\/td>\n<td class=\"\">\n<p class=\"lastInCell\">Vertical Image Size<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"dataTableBottomMargin\"><\/div>\n<p>Are we going to be able to use these two properties to solve BJ\u2019s problem? We\u2019re about to find out.<\/p>\n<p>Inside the loop, the first thing we do is use this line of code to retrieve the horizontal image size (integer value 27) and store that information in a variable named intHorizontalSize:<\/p>\n<pre class=\"codeSample\">intHorizontalSize = objFolder.GetDetailsOf(strFileName, 27)\n<\/pre>\n<p>That\u2019s the good news. The bad news (although the news isn\u2019t all <i>that<\/i> bad) is that we don\u2019t get back a number; instead, we get back a string value similar to this:<\/p>\n<pre class=\"codeSample\">132 pixels\n<\/pre>\n<p>Like we said, that\u2019s bad news, but not <i>that<\/i> bad; after all, we can extract the image size (i.e., the value 132) by using this line of code:<\/p>\n<pre class=\"codeSample\">intHorizontalSize = Replace(intHorizontalSize, \" pixels\", \"\")\n<\/pre>\n<p>What are we doing here? To tell you the truth, not all that much: we\u2019re simply using VBScript\u2019s <b>Replace<\/b> function to remove the string value <i>pixels<\/i> (including the blank space that comes before the word) from intHorizontalSize. And what will that do for us? Why, that will set the value of intHorizontalSize to this:<\/p>\n<pre class=\"codeSample\">132\n<\/pre>\n<p>Which is more like it.<\/p>\n<p>After determining the horizontal size of the image we then use these two lines of code (and a very similar process) to determine the vertical size of the image:<\/p>\n<pre class=\"codeSample\">intVerticalSize = objFolder.GetDetailsOf(strFileName, 28) \nintVerticalSize = Replace(intVerticalSize, \" pixels\", \"\")\n<\/pre>\n<p>All we have to do now is determine whether the picture has a horizontal size of 100 pixels and a vertical size of 121 pixels. That\u2019s something we can check using this line of code:<\/p>\n<pre class=\"codeSample\">If intHorizontalSize &lt;&gt; 100 OR intVerticalSize &lt;&gt; 121 Then\n<\/pre>\n<p>If the horizontal size is not equal to 100 or the vertical size is not equal to 121 we then echo back the file <b>Path<\/b> (in your case, BJ, you\u2019d probably send this information to your third-party application in order to resize the picture):<\/p>\n<pre class=\"codeSample\">Wscript.Echo strFileName.Path\n<\/pre>\n<p>And what if the horizontal size <i>is<\/i> equal to 100 and the vertical size <i>is<\/i> equal to 121? That\u2019s great; that means this picture is already correctly sized, and we don\u2019t have to do anything at all. Either way, we then go back to the top of the loop and repeat the process with the next file in the collection.<\/p>\n<p>By the time we\u2019re done we should see an onscreen report listing the image files that are not correctly size:<\/p>\n<pre class=\"codeSample\">C:\\Images\\JonathanHaas.jpg\nC:\\Images\\KenMyer.jpg\nC:\\Images\\PilarAckerman.jpg\n<\/pre>\n<p>Which is pretty much the report we were hoping to get.<\/p>\n<p>At any rate, it\u2019s now time to head off to the gas station. And yes, that means that the Scripting Guy who writes this column has decided to bite the bullet and refill the gas tank. Why? Let\u2019s put it this way: if it was a question of getting <i>to<\/i> work things might be different. But seeing as how he needs the gas to get away <i>from<\/i> work, well \u2026.<\/p>\n<p>See you all Monday.<\/p>\n<table class=\"dataTable\" id=\"EVGAC\" cellSpacing=\"0\" cellPadding=\"0\">\n<thead><\/thead>\n<tbody>\n<tr class=\"record\" vAlign=\"top\">\n<td class=\"\">\n<p class=\"lastInCell\"><b>Note<\/b>. Well, depending on how much the price of gas goes up over the weekend. Maybe he should just have his direct deposit switched from the bank to his local Shell station \u2026.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"dataTableBottomMargin\"><\/div>\n<p>P.S. Yes, that\u2019s right, we need to add a postscript to this article. Why? Because after we got all done with it, we discovered that this doesn\u2019t work on Windows Vista. Apparently that table we showed you with all the values in it no longer applies. But the good news is that Windows Vista has all <i>new<\/i> values. Here\u2019s a script, using the new values, that will answer BJ\u2019s question on computers running Windows Vista: <\/p>\n<pre class=\"codeSample\">On Error Resume Next\n\nSet objShell = CreateObject (\"Shell.Application\")\nSet objFolder = objShell.Namespace (\"C:\\Test\")\n\nFor Each strFileName in objFolder.Items\n&nbsp;&nbsp;&nbsp; intSize = objFolder.GetDetailsOf (strFileName, 31) \n&nbsp;&nbsp;&nbsp; arrSize = Split(intSize, \" x \")\n\n&nbsp;&nbsp;&nbsp; intLength = Len(arrSize(0))\n&nbsp;&nbsp;&nbsp; intHorizontalSize = Right(arrSize(0), intLength -1)\n\n&nbsp;&nbsp;&nbsp; intLength = Len(arrSize(1))\n&nbsp;&nbsp;&nbsp; intVerticalSize = Left(arrSize(1), intLength - 1)\n\n&nbsp;&nbsp;&nbsp; If intHorizontalSize &lt;&gt; 100 OR intVerticalSize &lt;&gt; 121 Then\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo strFileName.Path\n&nbsp;&nbsp;&nbsp; End If\nNext\n<\/pre>\n<p>As it turns out, the GetDetailsOf method works just fine on Windows Vista; in some ways, it actually works <i>better<\/i>, because a lot more file properties are now exposed to the method. (We\u2019ll post a complete list of these properties in the Script Center next week; stay tuned.) However, many of the property values have been renumbered; on Windows Vista retrieving items 27 and 28 won\u2019t do you much good.<\/p>\n<p>Instead, we ended up retrieving item 31, which gave us the total dimensions of the picture, using an output format similar to this:<\/p>\n<pre class=\"codeSample\">?150 x 354?\n<\/pre>\n<p>In case you\u2019re wondering, the question marks aren\u2019t really questions marks; instead, they appear to be some sort on non-printable character. That\u2019s why we ended up going through all sorts of gyrations: splitting the value into an array, then using the <b>Right<\/b> function to grab all but the first character from the first array item and the <b>Left<\/b> function to grab everything except the <i>last<\/i> character in the second array item. It\u2019s a bit crazy but, in the end, we came up with a script that works on Vista.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! I have a folder on a server that contains employee photos, photos that will be used on our organization chart. New photos are taken daily for new staff members, and all the .JPG files are put into this folder. Because the photos are often different sizes, I would like to write a [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[122,123,3,5],"class_list":["post-55543","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-graphics","tag-multimedia","tag-scripting-guy","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! I have a folder on a server that contains employee photos, photos that will be used on our organization chart. New photos are taken daily for new staff members, and all the .JPG files are put into this folder. Because the photos are often different sizes, I would like to write a [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/55543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=55543"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/55543\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=55543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=55543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=55543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}