Get File Properties - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: Get File Properties (/showthread.php?tid=89253) Get File Properties by wincy on 02-18-2009 at 02:38 PM
Hello! RE: Get File Properties by matty on 02-18-2009 at 03:27 PM I think you need to use SHGetFileInfoW. RE: Get File Properties by Spunky on 02-18-2009 at 03:44 PM
Also, CreateObject and GetObject are not valid JScript functions IIRC. I think they're WScript RE: Get File Properties by wincy on 02-18-2009 at 03:54 PM
quote: Thanks! Unfortunatly i'm not sure about i should use that funcion... maybe with Interop.Call("kernel32"... ecc?? Help I made a function which lists current active processes using GetObject and works correctly even without calling "new ActiveXObject". RE: Get File Properties by matty on 02-18-2009 at 04:16 PM
quote:Using WMI you need to use it with GetObject. quote:I don't have the time right now to do further research on it. I am at work. RE: Get File Properties by wincy on 02-18-2009 at 04:30 PM
Made this: RE: Get File Properties by andrewdodd13 on 02-18-2009 at 05:19 PM You're passing in a null pointer (the 0) to the API call. What you need to do is create a databloc which you can put SHFILEINFO into. Unfortunately, it's been a while since I scripted, so you'll need to read the documentation on this. RE: Get File Properties by matty on 02-18-2009 at 05:35 PM
Also every \ in JScript has to be escaped so instead of C:\antivir.exe you need to put C:\\antivir.exe RE: Get File Properties by wincy on 02-18-2009 at 05:57 PM
var FILE_ATTRIBUTE_NORMAL = "&H80"; RE: Get File Properties by matty on 02-18-2009 at 06:13 PM
Ok you need to review a bit about memory allocations. js code: And obviously I have no way of testing the above it is just a guideline... but do research a bit more. RE: RE: Get File Properties by wincy on 02-18-2009 at 06:21 PM
quote: (You wrote "Debut.Trace") It is failing for some reason, it is not specified why... (error code: 2147352567 on "Debug.Trace" line) It gives error also using this only: Interop.Call('shell32', 'ShGetFileInfoW', 'C:\\antivir.exe', 0x80, SHFILEINFO.DataPtr, 0x800); RE: Get File Properties by matty on 02-18-2009 at 06:47 PM I fixed it, I was missing the Size parameter. RE: RE: Get File Properties by wincy on 02-18-2009 at 06:58 PM
quote:Do I have to put file size in there (either manually or with a function)? I really thank you for you patience, Matty. It still gives the same error (in Interrop.Call), even using this: var szDisplayName = Interop.Allocate(512); var szTypeName= Interop.Allocate(162); var SHFILEINFO = Interop.Allocate(18); with(SHFILEINFO){ WriteDWORD(10, szDisplayName.DataPtr); WriteDWORD(14, szTypeName.DataPtr); Interop.Call('shell32', 'ShGetFileInfoW', 'C:\antivir.exe', 0x80, SHFILEINFO.DataPtr, Size, 0x800); } Try the attachment (just change file path) RE: Get File Properties by matty on 02-18-2009 at 07:03 PM You cannot use a single \ in JScript. I told you that earlier... RE: Get File Properties by wincy on 02-18-2009 at 07:19 PM
Sorry, it was just a try, but the error wasn't that. Did you tested it? RE: Get File Properties by matty on 02-18-2009 at 07:32 PM No I didn't I will have to try when I get home. RE: Get File Properties by wincy on 02-18-2009 at 07:42 PM
I'm sure that file path is correct. |