Jump to content

Detect selected file


Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

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