Jump to content

get the selected file name in a variable


Guest imanuelga
 Share

Recommended Posts

Guest imanuelga

hello all !!

in a file list, i use send("{end}") to selecte a file but i don't know the name of it.

i would like to get this name in a varible.

Something like :

$nameof = selectedfilegettext...

is it possible ?

thanks by advance

Link to comment
Share on other sites

hello all !!

in a file list, i use send("{end}") to selecte a file but i don't know the name of it.

i would like to get this name in a varible.

Something like :

$nameof = selectedfilegettext...

is it possible ?

thanks by advance

<{POST_SNAPBACK}>

Not sure what you mean. Can you describe more? Are you saying that you want to send the cursor to the end of a list in a file and then want to copy the last word (which is the file name that you won't know) into a variable?
Link to comment
Share on other sites

Guest imanuelga

Hello J.gilbert,Hello freekill,

here my script :

---------------------------------------------------------------------------

dim $selectedfilename

;open a directory (with files)

run ("C:\WINDOWS\explorer.exe C:\Documents and Settings\Propriétaire\Mes documents\downloaded")

WinWaitActive("downloaded")

;select the last file

Send("{end}")

;I wish to get the name of this file

$selectedfilename = ???????

-----------------------------------------------------------------------------

i hope you understand my prbm.

Sorry for my poor english...

bye

Link to comment
Share on other sites

Hello,

Is it what you're looking for ?

dim $selectedfilename

;open a directory (with files)
run ("C:\WINDOWS\explorer.exe C:\Documents and Settings\ludo\Mes documents\")
WinWaitActive("Mes documents")


;select the last file
Send("{end}")

$index=ControlListView ( "Mes documents", "", 1, "GetSelected")
MsgBox(0,"debug",ControlListView ( "Mes documents", "", 1, "GetText",$index))
Link to comment
Share on other sites

Guest imanuelga

Hello,

Is it what you're looking for ?

dim $selectedfilename

;open a directory (with files)
run ("C:\WINDOWS\explorer.exe C:\Documents and Settings\ludo\Mes documents\")
WinWaitActive("Mes documents")
;select the last file
Send("{end}")

$index=ControlListView ( "Mes documents", "", 1, "GetSelected")
MsgBox(0,"debug",ControlListView ( "Mes documents", "", 1, "GetText",$index))

<{POST_SNAPBACK}>

thank you sylvanie,

it was exactly that i was looking for...

I'm beginning with autoit and as i m not a fluent speaking english person, i have trubble reading the help files. But in fact, i did find that fonction in the same time you send me this post :( .

Any way, Merci beaucoup

imanuelga

Link to comment
Share on other sites

  • 9 years later...

Hello,

Is it what you're looking for ?

dim $selectedfilename

;open a directory (with files)
run ("C:\WINDOWS\explorer.exe C:\Documents and Settings\ludo\Mes documents\")
WinWaitActive("Mes documents")


;select the last file
Send("{end}")

$index=ControlListView ( "Mes documents", "", 1, "GetSelected")
MsgBox(0,"debug",ControlListView ( "Mes documents", "", 1, "GetText",$index))

This did not work for me. I got 0 in message box. When I checked the control ID for the explorer window, it shows 0. The class is   DirectUIHWND with instance 3

Edited by dilipped
Link to comment
Share on other sites

  • Moderators

dilipped,

lasfirst post in this thread dates from over 9 years ago and that the OP has not been online since then? :huh:

Please do not necro-post like this again - just open a new thread and link to the old one if it is absolutely necessary for understanding the problem. We ask you to do this for two main reasons:

 

- 1. The language advances and the functionality might well be included in core or UDF code by now

- 2. The changes in language syntax mean that it is likely that code from more than a couple of years ago may well not run under the current release interpreter without significant modification.

Thread locked. :mad2:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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