electrico Posted April 22, 2013 Share Posted April 22, 2013 (edited) Hello guys, Haven't been here for a long time, and now I have a question, cause searching google and forums didnt made a trick. So, in this bottom code I got a last folder name (full path is previously written as a value to ini file, where array was used to show all values of a ini section named "Folders", as you see in script below) for my drop-down combo. Global $combo3 = GuiCtrlCreateCombo("", 10, 200, 100, "", $CBS_DROPDOWNLIST) Local $var3 = IniReadSection($instruction, "Folders") If @error Then MsgBox(4096, "", "INI file probably corrupted.") Else For $i = 1 To $var3[0][0] Global $sFullPath = $var3[$i][1] Global $sLastFolder = StringRegExpReplace($sFullPath, "(.+?\\)*(.+?)(\\.*?(?!\\))", "$4") GuiCtrlSetData(-1, $sLastFolder) Next EndIf Then I have to open (presumably, with ShellExecute command) a folder that have been chosen from combobox. I have tryed to do so: ShellExecute(FileGetLongName(GuiCtrlRead($combo3))) but succeeded just in few cases (some folders was just impossible to open, with stantard windows error, because full path was not given back!) Please, can someone be so polite to help me in resolving this problem? Is there something like DirGetLongName ot smth (maybe someone will explain how to use _FullPath() here, because till the moment _FullPath() just returning the full path of ini file, not a full path of folder selected in Combo (prescripted as value for each folder in ini file)! Maybe somebody will tell how to get back string replaced previously in my script with Global $sLastFolder = StringRegExpReplace($sFullPath, "(.+?\\)*(.+?)(\\.*?(?!\\))", "$4") ??? This would be full path that I am searching for. Thx a lot to all. Edited April 22, 2013 by electrico Link to comment Share on other sites More sharing options...
water Posted April 22, 2013 Share Posted April 22, 2013 (edited) You are talking about _PathFull?Can you post how you called this function? Edited April 22, 2013 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
electrico Posted April 22, 2013 Author Share Posted April 22, 2013 Thanks for reply. _PathFull() in my script was called in several ways: ShellExecute(_PathFull(GuiCtrlRead($combo3))) and ShellExecute(_PathFull(FileGetLongName(GuiCtrlRead($combo3)))) ; here may be incorrect but I tryed everything was coming into my mind....... Please correct me, may be I am nearly the right key.... Link to comment Share on other sites More sharing options...
water Posted April 22, 2013 Share Posted April 22, 2013 Can you please tell me by giving an examplewhat the user selects from the comboboxwhat the full path should the be based on the selectionwhat the working directory for the script is My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
electrico Posted April 22, 2013 Author Share Posted April 22, 2013 (edited) Thx for trying to deal with my problem. 1) From combobox users select folder that further must be opened with button (or other control). 2) In combobox only last folders should be displayed, however script command ShellExecute that I use next, should use whole path, not only selected value (last folder name), - to open the folder. 3) script working directory is @DesktopDir, but values are descripted in ini file that i keeping in my flash drive. Please, for deeper understanding what I mean, and also for useful helping, I attach whole my script, where problem is at lines: 741 - 743 (func _open_personal_folder()) Thanks for any attention.startp.au3 - Copy.au3 Edited April 22, 2013 by electrico Link to comment Share on other sites More sharing options...
water Posted April 22, 2013 Share Posted April 22, 2013 Thanks for posting the code. Quite long and needs some additional UDFs. I can't test in the moment so I'm going to ask a few questions: Does the user select e.g C:foldersubfoldersubsubfolder or just subsubfolder from the ComboBox? If the 2nd is true: Should the full path be @DesktopDir & "subsubdir" or does your script read the rest of the path from the ini file? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
electrico Posted April 23, 2013 Author Share Posted April 23, 2013 Code is long and script is hardcoded - this is my ugly programming style Answers: 1) - yes, they see just subfolder, whole path would be too long and ugly 2) If it would be just @DesktopDir I would not write a post here, but script must read the whole path from the ini file, (handling the option selected by user from combobox, dropdown, that is last subfolder in path - yes, you understood correctly!) I just was searching how to get back the whole path that was prevously cut till last subfolder by expression StringRegExpReplace......... (see my first msg in this post). Thx. Link to comment Share on other sites More sharing options...
water Posted April 23, 2013 Share Posted April 23, 2013 This searches the full path from the right side until a "\" is found and takes the folder from there. Means: Returns "subsubfolder" from "C:\folder\subfolder\subsubfolder" $fullpath = "C:\folder\subfolder\subsubfolder" $folder = StringMid($fullpath, StringInStr($fullpath, "\", 0, -1) + 1) ConsoleWrite($folder & @LF) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
electrico Posted April 24, 2013 Author Share Posted April 24, 2013 (edited) Yes, this is another way how to take last subfolder. But in my case I would like to know how to return whole path from this subsubfolder. And this is not the prevously declared path with vairable or smth.. it is user's choice from combobox.. So, after user choose from dropdown this "subsubfolder" as you said, this subsubfolder must be converted back to full path that indicated in ini file as value... (as u see in my script from lines 741 - 743). Anyways, even if you do not want to go deep... thx for paying attention. Edited April 24, 2013 by electrico Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now