Jump to content

Problem with FileOpenDialog using long default filenames - (Moved)


Recommended Posts

I have a problem with FileOpenDialog using long default filenames ... they always get truncated. 

For example: 

"A Long FileName.mpg" as a default would prompt as just "FileName.mpg" (but scrolling left will show it named correctly).

Does anyone know of a fix for this please (I didn't spot it in a Forum search), or is it one for the bug tracker?

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files."
Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT), "A Long FileName.mpg")

Thanks,

Link to post
Share on other sites
  • Moderators

Moved to the appropriate forum.

Moderation Team

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 post
Share on other sites

@FrancescoDiMuro

  •  
  • Active Members
  • 223
  • 1,894 posts

@Tippex

Quote

Could you please post some screenshoots of the issue you are having? :)

 

Sorry for the delay.

The screenshot shows the defaulted filename being initially displayed as just "FileName.mpg" and below it another screenshot correctly showing what was intended ("A Long FileName.mpg") found by clicking another window then returning by clicking its title bar which seems to be all it takes to rectify/refresh it.

I also discovered that if the window is maximised then the problem doesn't occur. 

Thanks

Truncated_Browse_Filenames.jpg

Edited by Tippex
added quote
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By prizm1
      AppendVersion_X64

      AppendVersion_x64 is a simple program intended to expedite the systematic renaming of  executable
      installation files, compressed installation files and Start Menu links that point to installed executable
      program files.

      In this discussion, 'target executable file' can refer to an uncompressed installation executable, or to the
      compressed installation executable file inside a packaged compressed file (zip, 7z, rar or tar), or to the
      executable file that a Start Menu link points to. A 'rename target' can refer, again, to an uncompressed
      installation executable file, or to the compressed file containing a packaged target executable file, or to
      a Start Menu link pointing to a target executable file.

      There are four scenarios for AppendVersion processing:
      An installation executable file is renamed and appended with that target executable file's own
      file version number.
      A compressed installation file (zip, 7z, tar, or rar) is renamed and appended with its compressed
      target executable file's own file version number.
      A Start Menu link pointing to its target executable file is renamed and appended with that
      target executable file's own version number.
      A folder is selected containing any assorted collection of rename target types.

      Having an archived program installation file renamed with its target executable file's file properties
      version number appended to the installation file's name, in a systematic format, aids in quickly
      determining whether or not you have the latest version installed.

      Having all the Start Menu program links (rename targets) appended with their target executable file's
      version numbers quickly aids in determining whether or not you have the most recent published
      upgrade or update of that program installed. Hovering your mouse over  a Start Menu link will
      conveniently display the target executable file's version number.

      Start Menu links exist in two system folders:
      @ProgramsDir (%appdata%\Microsoft\Windows\Start Menu\Programs)
      @ProgramsCommonDir (%programdata%%\Microsoft\Windows\Start Menu\Programs)
      Renaming Start Menu links in these two folders require Administrator privilege. You can either compile
      this AppendVersion.au3 script with the #RequireAdmin macro at the top of the script, or go to the
      compiled executable 'AppendVersion_x64.exe' file's Properties Compatibility tab and check 'Run this
      program as an administrator'.

      ====
      AppendVersion can also receive full file path argument parameters via Run or the Windows terminal.
      This allows for processing files from different directory locations in one AppendVersion session.
      ====

      AppendVersion  is initiated via a Windows SendTo 'AppendVersion' link. Running the compiled
      executable 'AppendVersion_X64.exe' once will auto-create an 'AppendVersion' link in the SendTo
      subfolder if the SendTo link does not exist and will also create a default Settings.ini file in the @ScriptDir
      folder if the Settings.ini file does not exist. The Settings.ini file maintains basenames and other
      configuration data that AppendVersion requires.

      ====
      Icon @ScripDir subfolder location directive for compiling AppendVersion_x64.au3 is:
      #AutoIt3Wrapper_Icon=.\Icon\add2.ico
      ====

      To use AppendVersion, in Windows Explorer select one or more rename target files, rename target links
      and any folders containing rename target files or links, then select the SendTo 'AppendVersion' link.

      You can also right-click on a Start Menu link and select Open Location:

      After Windows Explorer opens, right-click on the highlighted rename target link and then select
      'AppendVersion' from the SendTo menu.

      You can also process Start menu rename target links enmasse in succession by selecting one of the two
      Programs folders where Windows maintains most all the Start Menu links:
      %appdata%\Microsoft\Windows\Start Menu
      %programdata%\Microsoft\Windows\Start Menu
      Select one of the two Programs folders and then select 'AppendVersion' from the SendTo menu

      You can process both Programs folders in one session by running the compiled executable
      'AppendVersion Start Menu Links_x64.exe'.

      ====
      The script maintains processed file identification data in the Settings.ini [BaseNames] section. This
      section is used in identifying new updated versions of earlier files previously processed by
      AppendVersion. This file identification data (key basenames and fingerprint value) is used to compare
      and systematically rename later matching updated versions of the identified file.

      'Basename(s)' is one or two substrings in the installation file that usually does not change in the rename
      target file name from one file version to the next.

      Except for file size and file/product version properties, which can change with every new file version, the
      remaining available target file properties are concatenated together to create a target file properties
      'fingerprint'. The fingerprint consists of file properties that usually will not change from one target file
      version to the next, i.e., 'File Description', 'Product Name', 'Copyright', 'Language', 'Original File name',
      'Legal Trademarks', 'Company Name' and 'DefaultLangCodePage'.

      The basename(s) and fingerprint together constitute the 'identification' of a candidate file. This ID is
      used to identify later downloaded versions of the file that can be automatically renamed without user
      interaction.

      If the target executable file's properties does not have a file version number, the file's product version
      number will be used instead in the version appending and renaming of the file.
      If the target executable has neither a file version nor product version number, the user will be prompted
      to enter the published file version number acquired from the provider's web site.

      Both the basename(s) and version numbers will be used for the renaming of the file.

      If the rename target file is in a popular compressed format, i.e., (*.zip, *.7z, *.rar, and *.tar), the script
      will use PeaZip-portable to decompress the zipped file into a temporary folder (@ScripDir & "\UnZip")
      and then prompt the user to select the target executable file with file properties used in the rename
      target 'identification'.
      The freeware PeaZip portable can be downloaded from:
      https://peazip.github.io/peazip-portable.html
      Unpack PeaZip portable into the @ScripDir & "\peazip" subfolder.

      Once the target executable file properties are read from the target executable, the user will be
      prompted to configure the basename(s) from the rename target file name, unless an identification
      already exists in Settings.ini, in which case the rename target file will automatically be renamed by
      AppendVersion. The process is not always fully automatic. If the target executable file has neither a file
      nor product version in its file properties, the user will be prompted to manually enter the published file
      version number.

      Process example, the target file for renaming is:
      FreeFileSync_11.14_[Donation_Edition]_Windows_Portable.zip

      Righ-click on the file. Select 'AppedVersion' from the SendTo submenu.

      The script, recognizing the rename target file as a compressed file (*.zip, *.7z, *.tar, and *.rar), will decompress
      the rename target file into a temporarily created @ScriptDir & '\UnZip' folder.

      Then, the user will then be prompted to select from the folder or subfolder containing the target
      executable file from which the file properties will be read:
      'FreeFileSync_11.14_[Donation_Edition]_Setup.exe'.

      Once the target executable file is selected and opened, the script will prompt the user to create one or
      two basename(s) from the rename target zip file's name.

      Base name(s) are created from the rename target zip file name (without extension):
      Examples,   'FreeFileSync_' , '[Donation_Edition]' and '_Windows_Portable'.

      Base names must be separate substrings in the rename target zip file's name.

      The user can choose to use just one or two base names for file identification.

      The user can also choose to use the entirety of the original rename target zip file name:
      'FreeFileSync_11.14_[Donation_Edition]_Windows_Portable'
      as a base name in renaming later versions of FreeFileSync. This may not be advisable with this base name, since later versions of this rename target
      file name will not have version '11.14' in the name, but this naming convention is an option.

      In this example, I will use the 'FreeFileSync_" and '[Donation_Edition]' substrings as base names, since
      these are file name structures that are unique to the file name and will probably not change in later
      published file version names.

      The file properties fingerprint collected from the FreeFileSync.exe executable is:
      FreeFileSyncFreeFileSync.orgFreeFileSync-FolderComparisonandSynchronization040904B0

      To use two base names for later automatic file version identification, the base names must be
      separated with a colon ':', i.e., 'FreeFileSync_:[Donation_Edition]'.
      If a later file version of a candidate rename target file's name contains both of these substrings and
      has the same target executable file properties 'fingerprint', the script will automatically identify and
      rename the later-versioned file's name.

      The combined file identification of [Key] base names + [Value] fingerprint is:
      FreeFileSync_:[Donation_Edition]=FreeFileSyncFreeFileSync.orgFreeFileSyncFolderComparisonandSynchronization040904B0

      This identification is stored in the Settings.ini file under the [BaseNames] section.
      When a new version of FreeFileSync_XX.XX_[Donation_Edition]_Windows_Portable.zip is processed by
      AppendVersion, if an entry in Settings.ini [BaseNames] section can match the rename target's file name
      and also match the candidate target executable's fingerprint, the script will use this to automatically rename the zip file.

      Finally, the rename target file is then renamed with the base name(s) and with one of three version
      prefixes to the version number:
      " - fver_ "; for files with a properties file version number (preferred default)
      " - pver_ "; for files without file version numbers but with product version numbers(fallback)
      " - uver_ "; for files with neither file nor product numbers. User manually entered published file version number.

      NOTE: These version format prefixes can be changed in Settings.ini [QuotedPrefix] section to meet your
      prefix format preferences. The [QuotedPrefix] section value entries must be quoted.

      In this example, FreeFileSync.exe contains a properties file version number of 11.14.0.0
      The resultant AppendVersion renamed file is:
      FreeFileSync_[Donation_Edition] - fver_ 11.14.0.0.zip

      This systematic approach works well with most file names, but files with short file names such as 'a.exe'
      and having no finger-printable file properties are problematic. In such case, perhaps renaming the
      downloaded file with a longer, unique name before running this script on it is preferrable, although
      renaming the file before processing it with AppendVersion circumvents the purpose of the script. This
      would not be an issue if software creators would always include full file properties in their file
      compilations.
      Settings.ini add2.ico ReadMe.pdf
      AppendVersion Start Menu Links.au3 AppendVersion.au3
    • By Colduction
      Hi guys! i want to write speedy and very fast code to check if chosen filename exists then add "-1" at end of it and if chosen filename exists again, add "-2" instead of "-1" and check filename until be unique.
       
      For Example: I have to write "Filename.txt" in C:\ directory with FileOpen then check if "Filename.txt" exists in that directory then rename chosen filename to "Filename-2.txt" and if exists again in directory, rename chosen filename to "Filename-3.txt" and do this work until to find unique number to add end of filename.




       
      ====================== SOLUTION by @Subz ======================
       
    • By XinYoung
      Hello all!   I'm stuck at a seemingly simple part of my script. Using IE, I'm filling out a web form that involves clicking a "Browse" button and selecting a file. Once the file explorer dialog opens, however, I am unable to control it.
      I have a string, which is the name of the file I want, and I'm trying to insert it into the 'File name:' text box in the dialog (which already has focus), but it doesn't get inserted. I've tried ClipPut and Send. 

      What's even more concerning is, when I close the dialog, the string is then pasted into the very next window that has focus, which is often SciTE. It's like that Browse's file open dialog halts all processes. Once it's closed, the script continues.
      ;~ Open a IE window and navigate to the login page. Global $oIE = _IECreate($urlBBLogin) _IELoadWait($oIE) ;~ Recognize the form on this page (login input boxes). Local $oForm = _IEFormGetObjByName($oIE, "login") Local $oTextLogin = _IEFormElementGetObjByName($oForm, "user_id") Local $oTextPass = _IEFormElementGetObjByName($oForm, "password") ;~ Enter the Automation user credentials into the form. _IEFormElementSetValue($oTextLogin, $bbUsername) _IEFormElementSetValue($oTextPass, $bbPassword) ;~ Click the Login button. _IEFormSubmit($oForm) _IELoadWait($oIE) ;~ Navigate to the feedfile upload page. _IENavigate($oIE, $urlUpload) _IELoadWait($oIE) ;~ Click the Browse button Local $Browse = _IEGetObjById($oIE, "feedFile_chooseLocalFile") _IEAction($Browse, "Click") Local $Browse = WinWait("Choose File to Upload") ;~ Open the file we created. WinActivate($Browse) Send($finalFile) Has anyone else experienced this problem? Any ideas to get around it? Am I approaching this the wrong way?
      Any support is greatly appreciated.
      Thank you.
    • By nacerbaaziz
      Hello, dears.
      First I apologise to you for the stupid question I'm going to ask.
      is the default style for Windows created using AutoIt   a dialog box style?
      I decided to ask this question
      Because I am using a screen reader
      If i open any program that is designed using autoit, the screen reader read for example,  
      test dialog
      but If i open any other program, for example goldwave, it read goldwav only without a word dialog
      Is there a solution to this
      The code i used to create the window is:
      $hGUI = GUICreate(str("title"), 500, 420, -1, -1, BitOr($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_SYSMENU, $WS_CAPTION), BitOr($WS_EX_ACCEPTFILES,$WS_EX_LAYERED,$WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
      I hope to find a solution to this problem
      please Accept my greetings, and thank you very much.
    • By milos83
      Default keyword for optional parameter is interpreted wrongly.
      ConsoleWrite(StringReplace("aa", "a", "b", Default, 1) & @CRLF) StringReplace ( "string", "searchstring/start", "replacestring" [, occurrence = 0 [, casesense = 0]] ) The code above will output ab even thou the default value for the occurrence is 0 (replace all).
      Of course using zero instead of Default will work fine.
×
×
  • Create New...