Jump to content

Recommended Posts

Posted

Is possible detect a selected file in desktop? I mean selected (when you only click but not open)

image.png.afa7b1684fcea9a4deb8f46948900217.png

If yes, someone could give me a example?

Posted (edited)

@Bilgus thank you for the link, I've tested all scripts there and here:

But still don't managed to make it work, what im trying is get the name or path of selected file on desktop.

P.S Using win7x64

Edited by memerim
Posted

Here one way to do it :

if not @AutoItX64 and @OSArch = "X64" then Exit MsgBox (0,"Error","This script only works when run in 64bits")

MsgBox (0,"","Select Desktop Icons")

Local $sSel = ControlListView ("[CLASS:Progman]", "", 1, "GetSelected", 1)
Local $aSel = StringSplit ($sSel,"|")

Local $sList = ""
For $i = 1 to $aSel[0]
  $sList &= ControlListView ("[CLASS:Progman]", "", 1, "GetText", $aSel[$i]) & @CRLF
Next
MsgBox (0,$aSel[0] & " items",$sList)

It is also possible to use _GUICtrlListView_* to do the same thing if you need more versatility...

Posted (edited)

This is what pop up when i have something selected and run the script:

image.png.e952632711840147f715a9c1576cdd12.png

Edit: I compiled it as x64 then it displayed correct item selected.

How can i compare the value from $sList ?

If $sList = "XVI32.exe" Then
;
Endif

I have tried this but seens not getting the right value from $sList.

Edited by memerim
Posted

$sList contains @CRLF, so use $sSel instead, it will work as long as you have only one item selected.  My script allows multiple items selection.  If you want to change that behavior look help file : ControlListView   option parameter. 

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...