Jump to content

Recommended Posts

Posted (edited)

How can i run the properties window of some file/folder?

I don't mean like information of files/folders (like here), i mean the window that opened when you right click on the file, and choose “Properties” item - how can i run this window for file/folder?

Thanx!

Edit: See the solution on last post of this thread.

Edited by MsCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  Quote

but I don't think that's working at the moment

I am (and not just me) to :)

The topic was closen, but i steel don't understand, why the func ShellExecute() need the verb “properties” :whistle: - If i have to think by logic, then its like that: if verb “open” will actualy open the file, and the verb “edit” will actualy open the file in the default application (to edit this file), so i expect that the verb “properties” will run the properties of the file, i don't see anything else for that option (verb).

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • Moderators
Posted

I'm afraid I'm a bit confused on what "properties" you want.

Could you give a list of them?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

  • Moderators
Posted

Hmmm... I searched for different alternatives ... something that kept popping up was the dsofile.dll.

Weird that MS kept saying it was for office docs only, but I was seeing some examples for other files.... Anyway I decided to download it:

http://www.microsoft.com/downloads/details...en#Instructions

Installed and ran the .exe

Created the directory :\DsoFile

Registered the dll (which wasn't done by the install like I had read it would be)

And came up with this func for (Just some of the many) possible returns:

Func _GetFilePropDSO($hFile)
    If FileExists($hFile) = 0 Then Return SetError(1, 0, 0)
    Local $objPropertyReader = ObjCreate('DSOleFile.PropertyReader')
    If IsObj($objPropertyReader) = 0 Then Return SetError(2, 0, 0)
    Local $objDocument = $objPropertyReader.GetDocumentProperties($hFile)
    If IsObj($objDocument) = 0 Then Return SetError(3, 0, 0)
    Local $oADocInfo[10] = [9]
    $oADocInfo[1] = $objdocument.AppName
    $oADocInfo[2] = $objdocument.Author
    $oADocInfo[3] = $objdocument.ByteCount
    $oADocInfo[4] = $objdocument.Category
    $oADocInfo[5] = $objdocument.CharacterCount
    $oADocInfo[6] = $objdocument.CharacterCountWithSpaces
    $oADocInfo[7] = $objdocument.CLSID
    $oADocInfo[8] = $objdocument.Comments
    $oADocInfo[9] = $objdocument.Company
    Return $oADocInfo
EndFunc

Unfortunately, no matter what file I ran through it (Office file or not), the object was never created (at error 2).

Now I may have done something completely wrong, I was assuming that the dll just had to be in the x:\dsofile directory, but I also placed in the sytem32 directory after it failed on a prayer. Still nothing.

Anyway... if you can figure a way to get that info corrected in my code (which may be totally wrong), and it works for you ... great. It is limited to 2000/XP/ME though.

Sorry I couldn't be more help... GL

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted (edited)

Thats not what he is looking for... he is trying to display the property window of a file .... :whistle:

so far what i have seen ... this is the closest example

http://www.autoitscript.com/forum/index.ph...=ShellExecuteEx

Looking over example codes in other languages all in this example seem to be correct (except the return type is long)....

I have tested a bit with his code and myself have been unable to get the dll call working properly but hopefully this might help...

there is no string... which could be half the issue cause i do not belive a char array will work correctly....

Edited by Sykeo
  • Moderators
Posted

  Sykeo said:

Thats not what he is looking for... he is trying to display the property window of a file .... :whistle:

so far what i have seen ... this is the closest example

http://www.autoitscript.com/forum/index.ph...=ShellExecuteEx

Looking over example codes in other languages all in this example seem to be correct (except the return type is long)....

I have tested a bit with his code and myself have been unable to get the dll call working properly but hopefully this might help...

there is no string... which could be half the issue cause i do not belive a char array will work correctly....

Guess you are reading it or understand it better than I...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Hi,

I guess he just want to open the window which appears when you right click on a file and then hit properties.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Posted (edited)

SmOke_N

Thank you for trying to help, but like Sykeo and th.meger has figuret out, i need to run a window just like in the screenshot of Sykeo's last post (i was don't show the screenshot couse its all on russian :whistle: ).

I have trying the functions, but also with no luck so far :)

Here is a cmdline utilite that do that, but i am would like to know how to do this using autoit.

In the atrchive there is a source code, i think it on C or C++, maby someone can translate it plz to AutoIt functionality? :">

Edited by MsCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • 6 months later...
Posted

Maybe someone can now tell me please how to execute such dialog? :">

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • Moderators
Posted
  MsCreatoR said:

Maybe someone can now tell me please how to execute such dialog? :">

Does ShellExecute() + the "properties" verb not work for you?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

  Quote

Does ShellExecute() + the "properties" verb not work for you?

No, it works for you? it shows me this:

  Quote

This file does not have a program associated with it for performing this action. Create an association in the Folder Options control panel.

As you trsanslate it for me :)

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • Moderators
Posted

  MsCreatoR said:

No, it works for you? it shows me this:

As you trsanslate it for me :)

Hmm, I get the same error! You might check bug reports to see if it is already reported, if not, post a pre-bug report on it here in the support forum for someone else that might know the answer.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted
  Quote

You might check bug reports to see if it is already reported

I has reported about it already (the link from my post to yours translation :P - don't you remember? :)), and jpm says that this is not a bug, only docs update :).

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  SmOke_N said:

Does ShellExecute() + the "properties" verb not work for you?

I don't know if this is old news or not, but I think you might need to use the "ShellExecuteEx" call.

If you go to this page http://www.codeproject.com/system/newbiesp...asp?msg=2194548

and scroll down to the entry Q. I want to show the File or Folder properties window for a file or a folder.

there's some vb code for use.

Unfortunately, I'm crap at using DllStructCreate() which is what I think is needed to setup the "SHELLEXECUTEINFO" refered to?

Anyway, though it might help if you hadn't seen it before.

Posted

  ResNullius said:

I don't know if this is old news or not, but I think you might need to use the "ShellExecuteEx" call.

Unfortunately, ShellExecuteEx isn't an AutoIt function :)

Posted

  doonyakka said:

Unfortunately, ShellExecuteEx isn't an AutoIt function :)

I know that! :)

What is needed is to do a DllCall to Shell32.dll (I think) to make this work.

And if anybody can do it, these guys can, I,m sure.

  • 2 months later...
Posted

Ok, here is the solution (by amel27):

HotKeySet("{Esc}", "OnExit")

$sFile = @ScriptName

_ShellExecuteEx($sFile, "", @ScriptDir, "properties") ;This is the magic function ;)

$sWinText = StringTrimRight($sFile, 4)
WinWait("[CLASS:#32770]", $sWinText)
WinWaitClose("[CLASS:#32770]", $sWinText)

Func _ShellExecuteEx($sCmd, $Args = "", $sFolder = "", $Verb = "", $rState = @SW_SHOWNORMAL, $hWnd = 0)
    Local $struINFO = DllStructCreate("long;long;long;ptr;ptr;ptr;ptr;long;long;long;ptr;long;long;long;long")
    Local $struVerb = DllStructCreate("char[15];char")
    Local $struPath = DllStructCreate("char[255];char")
    Local $struArgs = DllStructCreate("char[255];char")
    Local $struWDir = DllStructCreate("char[255];char")
    
    DllStructSetData($struVerb, 1, $Verb)
    If StringRight($sCmd, 3) = "lnk" Then
        Local $aShortcutInfo = FileGetShortcut($sCmd)
        If IsArray($aShortcutInfo) Then
             DllStructSetData($struPath, 1, $aShortcutInfo[0])
            DllStructSetData($struWDir, 1, $aShortcutInfo[1])
            DllStructSetData($struArgs, 1, $aShortcutInfo[2])
            $rState = $aShortcutInfo[6]
        Else
            Return 0
        Endif
    Else
        DllStructSetData($struPath, 1, $sCmd)
        DllStructSetData($struWDir, 1, $sFolder)
        DllStructSetData($struArgs, 1, $Args)
    EndIf
    
    DllStructSetData($struINFO, 1, DllStructGetSize($struINFO))
    DllStructSetData($struINFO, 2, BitOR(0xC, 0x40, 0x400))
    DllStructSetData($struINFO, 3, $hWnd)
    DllStructSetData($struINFO, 4, DllStructGetPtr($struVerb))
    DllStructSetData($struINFO, 5, DllStructGetPtr($struPath))
    DllStructSetData($struINFO, 6, DllStructGetPtr($struArgs))
    DllStructSetData($struINFO, 7, DllStructGetPtr($struWDir))
    DllStructSetData($struINFO, 8, $rState)

    Local $ret = DllCall("shell32.dll", "int", "ShellExecuteEx", "ptr", DllStructGetPtr($struINFO))
    Return $ret[0]
EndFunc

Func OnExit()
    Exit
EndFunc

Only problem is, that the properties window can exists only while the script exists :P

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...