Jump to content
Sign in to follow this  
mattw112

How to open a properties window completely hidden

Recommended Posts

mattw112

I would like to open the properties of a file, but completely hidden.

How can I do this?

The code I've been trying is shown below, with this I can get the properties dialog to open and then hide it, but then you still can see it for half a second. I want to never be able to see it.

Thanks,

Terry

Opt("WinWaitDelay", 5)

; Path to any shortcut
$PATH = "C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2003.lnk"

; Get various parts of the file I want
$MINUSPATH = StringInStr($PATH, "\", 0, -1)
$LINK = StringTrimLeft($PATH, $MINUSPATH)
$LEN = StringLen($LINK)
$MINUSDOT = StringInStr($LINK, ".", 0, -1)
$NAME = StringTrimRight($LINK, $LEN - $MINUSDOT + 1)
$LEN = StringLen($PATH)
$NEWPATH = StringTrimRight($PATH, $LEN - $MINUSPATH + 1)

; Create the objects and invoke the verb
$objShell = ObjCreate("Shell.Application")
$objFolder = $objShell.Namespace($NEWPATH)
$objFolderItem = $objFolder.ParseName($LINK)
$objFolderItem.InvokeVerb("P&roperties")

;Wait for the properties window and set transparent
WinWait($NAME & " Properties")
WinSetTrans($NAME& " Properties", "", 0)

$details = FileGetShortcut($PATH)
$TITLE = ControlGetText($NAME& " Properties", "", 102)
$TARGETLOC = ControlGetText($NAME& " Properties", "", 13065)
$TARGET = ControlGetText($NAME& " Properties", "", 13058)

Sleep(5000)

WinClose($NAME& " Properties")

I'm hoping there's an easier way.

By the way, I do know about FileGetShortcut($PATH) however this does not give me all the info I want, which so far I've only been able to find through the properties dialog.

Thanks,

Terry

Share this post


Link to post
Share on other sites
Gif

you can use FileGetShortcut() to get some details about the file but if you want the properties opened try:

$FilePath = FileGetShortcut(@ProgramsCommonDir&'\Microsoft Office\Microsoft Office Excel 2003.lnk')
ShellExecute($FilePath[0], '', '', 'properties', @SW_HIDE)
Edited by Gif

Share this post


Link to post
Share on other sites
mattw112

I should mention I've tried several other methods to get this info (see http://www.autoitscript.com/forum/index.ph...st&p=395921 ), including the shellexecute with the properties verb... with no luck.

But I took the code you suggested and aded a bit to it:

$NAME = "Microsoft Office Excel 2003"
$FilePath = FileGetShortcut(@ProgramsCommonDir&'\Microsoft Office\Microsoft Office Excel 2003.lnk')
ShellExecute($FilePath[0], '', '', 'properties', @SW_HIDE)

WinWait($NAME & " Properties")
$TITLE = ControlGetText($NAME& " Properties", "", 102)
$TARGETLOC = ControlGetText($NAME& " Properties", "", 13065)
$TARGET = ControlGetText($NAME& " Properties", "", 13058)
Sleep(1000)

MsgBox(0, "test", $TITLE & @CRLF & $TARGETLOC & @CRLF & $TARGET)

WinClose($NAME & " Properties")

Tried this and get two errors... see attached.

My guess is I get these because it is an advertised shortcut?

Thanks,

Terry

post-3866-1189012968_thumb.jpg

post-3866-1189012973_thumb.jpg

Edited by mattw112

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.