Query about FileSelectFile

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Query about FileSelectFile

Post by PuzzledGreatly » 14 May 2022, 15:54

I've noticed that when the filename is set for fileselectfile and it is long, eg "Fly to the cherry tree" the whole name is not shown in the dialogue edit field. The field is highlighted and pressing left will show the entire name but why is this necessary? Why isn't the entire file name shown immediately? Thanks.

hd0202
Posts: 183
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: Query about FileSelectFile

Post by hd0202 » 15 May 2022, 03:48

Sorry, I cannot answer your question. My WIN8.1 system also reacts with shorted file names, I think it is a windows problem.
But I found a workaround, that simulates a user action:

Code: Select all

File := "Fly to the cherry tree"
selection := "select the file you want"

settimer, timer, 10

FileSelectFile, AusgabeVar,, % file, % selection
msgbox, % ausgabevar " selected"
exitapp

timer:
ifwinactive, % Selection
{
settimer, timer, off
controlsend, ComboBox2, {down 2}{enter}
}
return
Hubert

User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Query about FileSelectFile

Post by PuzzledGreatly » 16 May 2022, 08:06

Thanks for the reply and suggestion. I tried it but it didn't result in the whole file name being shown on my machine.

hd0202
Posts: 183
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: Query about FileSelectFile

Post by hd0202 » 17 May 2022, 04:03

That can occur depending on the given filters. You must have at least one filter other than "All Data (*.*)", which is default.

You can test it manually and it will always be okay:
- select "All Data (*.*)" -> the file selection is changed to all files
- select the other filter, e.g. (*.txt) -> the file selection is changed again, this time to the files according to the filter
and then the full filename is shown

And the problem is: your code must be executed between showing the selection screen and waiting for the user to answer (therefore I use the timer to do it in a separate thread) !

I think, there is another problem: the second selection - away from "All Data (*.*)" - is only accepted when all files are shown, which can take a long time with many files. Perhaps it can be reached by a second timer started from within the first timer, but I didn't test it.

A test via Dllcall and the system API delivered a shortened name too !

Hubert

Post Reply

Return to “Ask for Help (v1)”