wakillon Posted September 6, 2010 Share Posted September 6, 2010 For compatibility problem add this $_Search = 31 If @OSVersion = 'WIN_XP' Then $_Search = 30 $array = StringSplit(_GetExtProperty($filename,$_Search), ' x ', 1) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
BrewManNH Posted September 6, 2010 Share Posted September 6, 2010 After changing the "$array = StringSplit(_GetExtProperty($filename,31), ' x ', 1)" to this "$array = StringSplit(_GetExtProperty($filename,26), ' x ', 1)" to work in Windows XP, this script didn't have any errors or mistakes as far as I can see. What are the errors you're getting when you run it now that you've spell checked it? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
wakillon Posted September 6, 2010 Share Posted September 6, 2010 (edited) After changing the "$array = StringSplit(_GetExtProperty($filename,31), ' x ', 1)" to this "$array = StringSplit(_GetExtProperty($filename,26), ' x ', 1)" to work in Windows XP, this script didn't have any errors or mistakes as far as I can see. What are the errors you're getting when you run it now that you've spell checked it? If i set to 26 i get papercut.au3 (7) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $iheight = $array[2] $iheight = ^ ERROR ->18:41:19 AutoIT3.exe ended.rc:1 +>18:41:20 AutoIt3Wrapper Finished >Exit code: 1 Time: 1.526 with 30 it works When i test all properties i get : 0 : minhkoi.net-813-06.jpg 1 - ExtProperty : 334 KB 2 - ExtProperty : Image JPEG 3 - ExtProperty : 15/03/2007 13:24 4 - ExtProperty : 23/06/2010 20:32 5 - ExtProperty : 15/07/2010 22:47 6 - ExtProperty : A 7 - ExtProperty : Connecté 8 - ExtProperty : 334 KB 9 - ExtProperty : 0 10 - ExtProperty : 0 11 - ExtProperty : 0 12 - ExtProperty : S-1-5-21-725345543-362288127-1177238915-500 13 - ExtProperty : 0 14 - ExtProperty : 0 15 - ExtProperty : 0 16 - ExtProperty : 0 17 - ExtProperty : 1 18 - ExtProperty : 0 19 - ExtProperty : 0 20 - ExtProperty : 0 21 - ExtProperty : 0 22 - ExtProperty : 0 23 - ExtProperty : 0 24 - ExtProperty : 0 25 - ExtProperty : 0 26 - ExtProperty : 0 27 - ExtProperty : 0 28 - ExtProperty : 0 29 - ExtProperty : 0 30 - ExtProperty : 1680 x 1050 31 - ExtProperty : 1680 pixels 32 - ExtProperty : 1050 pixels 33 - ExtProperty : 0 34 - ExtProperty : 0 35 - ExtProperty : 2007:03:15 13:24:41 Edited September 6, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
bovanshi Posted September 6, 2010 Author Share Posted September 6, 2010 To me it seems like my number for the width is not converted correctly it should be 1969 but when run with number($array[1]) it returns 0. I checked $iwidth with a msgbox and got "1969". Link to comment Share on other sites More sharing options...
BrewManNH Posted September 6, 2010 Share Posted September 6, 2010 On my version of Windows XP (Professional SP3) the results I get from _GetExtProperty for the jpg files I have on my computer the results are as follows [0]|5448_117156661581_501531581_2808000_1974499_n.jpg [1]|16 KB [2]|JPEG Image [3]|5/22/2010 12:03 AM [4]|5/22/2010 12:03 AM [5]|9/6/2010 12:54 PM [6]|A [7]|Online [8]|S-1-5-21-729355473-1286879909-800860556-118049 [9]| [10]| [11]| [12]| [13]|1 [14]| [15]| [16]| [17]| [18]| [19]| [20]| [21]| [22]| [23]| [24]| [25]| [26]|173 x 242 [27]|173 pixels [28]|242 pixels [29]| [30]| [31]| [32]| [33]| [34]| As you can see above, on this version of XP I had to set it to 26 as 30 and 31 are both empty. Which may be bovanshi's problem, different versions of Windows, even in the same family, are not giving the same values in the same places in the array. A quick and dirty search through the returned array for the pattern "## x ##" using a regex may solve the problem for all versions of windows it needs to run on. Unfortunately, I'm clueless when it comes to RegEx so I'll leave that to others. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
bovanshi Posted September 6, 2010 Author Share Posted September 6, 2010 Finally, got it to work! Seems like there were something wrong with the string. Converted back and fourth from binary to try to recreate the string: $filename = FileOpenDialog("PaperCut - Open file", @DesktopDir, "All (*.*)") $array = StringSplit(_GetExtProperty($filename, 31), ' x ', 1) $iwidth = number(StringTrimLeft(BinaryToString(StringToBinary($array[1])),1)) $iheight = $array[2] $align = InputBox("Landscape or portrait..", "Should the A4 be in Landscape or Portrait mode? 1 = Portrait, 2 = Landscape") $type = InputBox("Type of cuts?", "1 = Dpi, 2 = Height in cm, 3 = width in cm") $message = "" Link to comment Share on other sites More sharing options...
wakillon Posted September 6, 2010 Share Posted September 6, 2010 are you sure ? when i try i get |680<<>>1050 instead of |1680<<>>1050 that is the real size... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
bovanshi Posted September 6, 2010 Author Share Posted September 6, 2010 (edited) think I got some anomaly, I get |?1969<<>>1050 and removing that question mark makes it work. On my machine only though it seems :-/ Thank you for all your help and you only getting somewhat tired on me not giving you all the information and doing everything right from the start I wouldn't have thought of most of the stuff you helped me with Here is the final version. For those the automatic resolution recognition doesn't work for there is the usual input box option added.PaperCut v1.0.au3 Edited September 6, 2010 by bovanshi Link to comment Share on other sites More sharing options...
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