DarkAngel Posted July 6, 2010 Share Posted July 6, 2010 the FileOpenDialog is used to get the path of a certain file with the help of a gui . i want to get the path of a "folder" in a similar way using a GUI similar to that of FileopenDialog . How do i do that ? Please help . Link to comment Share on other sites More sharing options...
water Posted July 6, 2010 Share Posted July 6, 2010 Please have a look at FileSelectFolder. 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...
DarkAngel Posted July 6, 2010 Author Share Posted July 6, 2010 Please have a look at FileSelectFolder.Geez thanks .. i didnt read the help file carefully.. by the way whats the way of hiding and renaming folders in autoit? Te filesetattrib function is applicable for files but i couldnt figure out how to set attributes of a folder when i have the path of that folder. The dirmove can be used to rename the folder i guess cause if the folder in the destination is same then it is renamed instead of being replaced. PLease help Link to comment Share on other sites More sharing options...
Country73 Posted July 6, 2010 Share Posted July 6, 2010 Geez thanks .. i didnt read the help file carefully.. by the way whats the way of hiding and renaming folders in autoit? Te filesetattrib function is applicable for files but i couldnt figure out how to set attributes of a folder when i have the path of that folder. The dirmove can be used to rename the folder i guess cause if the folder in the destination is same then it is renamed instead of being replaced. PLease help In the Help File, search for File.You'll see all of the functions associated with File.Look at the "FileGetAttrib" and "FileSetAttrib" If you try to fail and succeed which have you done?AutoIt Forum Search Link to comment Share on other sites More sharing options...
Country73 Posted July 6, 2010 Share Posted July 6, 2010 You can also use that for folders. If you try to fail and succeed which have you done?AutoIt Forum Search Link to comment Share on other sites More sharing options...
DarkAngel Posted July 6, 2010 Author Share Posted July 6, 2010 You can also use that for folders.I tried but nothings happening .. i have worked with files using that command . Isnt a problem ,but i cant do that with directories. The script works all right but the folders arent hidden. I tried doing that by DOS using _rundos .. But i think all commands of dos doesnt work properly in this way. Can you please write that part of code which u say can be used to set attributes to a directory? Link to comment Share on other sites More sharing options...
DarkAngel Posted July 6, 2010 Author Share Posted July 6, 2010 You can also use that for folders.I tried but nothings happening .. i have worked with files using that command . Isnt a problem ,but i cant do that with directories. The script works all right but the folders arent hidden. I tried doing that by DOS using _rundos .. But i think all commands of dos doesnt work properly in this way. Can you please write that part of code which u say can be used to set attributes to a directory? Link to comment Share on other sites More sharing options...
Country73 Posted July 6, 2010 Share Posted July 6, 2010 I just ran this, from inside of Scite. ConsoleWrite(FileGetAttrib("C:\Temp\test") & @CRLF) FileSetAttrib("C:\Temp\test","+H") ConsoleWrite(FileGetAttrib("C:\Temp\test") & @CRLF) The first response I got was: D Then it set the "Hidden" Attribute Then the final response was: HD I checked "C:\Temp\test" and it was hidden. Hope that helps. If you try to fail and succeed which have you done?AutoIt Forum Search Link to comment Share on other sites More sharing options...
DarkAngel Posted July 6, 2010 Author Share Posted July 6, 2010 I just ran this, from inside of Scite. ConsoleWrite(FileGetAttrib("C:\Temp\test") & @CRLF) FileSetAttrib("C:\Temp\test","+H") ConsoleWrite(FileGetAttrib("C:\Temp\test") & @CRLF) The first response I got was: D Then it set the "Hidden" Attribute Then the final response was: HD I checked "C:\Temp\test" and it was hidden. Hope that helps. I didnt do the consolewrite stuff.. newaz. lemme check out..i will let you know . Thanks a lot Link to comment Share on other sites More sharing options...
Fatum48 Posted July 7, 2010 Share Posted July 7, 2010 I didn't used the GUI of AutoIt yet ... But if you can assign the following code to a button it might work To test it you can just load it in AutoIt and press F5 to see if it suit your needs. This code is to select a folder and not a file. $oShell = ObjCreate("Shell.Application") $oFolder = $oShell.BrowseForFolder(0,"Select Folder",0,0) $sFolderPath = $oFolder.Items.Item.Path MsgBox(0,"",$sFolderPath) Of course you can after then remove the MsgBox and display the value of $sFolderPath anywhere you like. Hope it helped! Alex Link to comment Share on other sites More sharing options...
GEOSoft Posted July 7, 2010 Share Posted July 7, 2010 I didn't used the GUI of AutoIt yet ... But if you can assign the following code to a button it might work To test it you can just load it in AutoIt and press F5 to see if it suit your needs. This code is to select a folder and not a file. $oShell = ObjCreate("Shell.Application") $oFolder = $oShell.BrowseForFolder(0,"Select Folder",0,0) $sFolderPath = $oFolder.Items.Item.Path MsgBox(0,"",$sFolderPath) Of course you can after then remove the MsgBox and display the value of $sFolderPath anywhere you like. Hope it helped! Alex As already pointed out, the correct functionality is already provided within AutoIt. There is no need to use a COM object at all for this simple task. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Fatum48 Posted July 7, 2010 Share Posted July 7, 2010 As already pointed out, the correct functionality is already provided within AutoIt. There is no need to use a COM object at all for this simple task.Ok maybe my mistake but I'm curious to see what is the code behind FileSelectFolder! I'm not a HUGE coder but I think there's might be some lines in that code that looks similar to what I wrote. Cause the parameters of FileSelectFolder are kind of similar/Identical to any VB code.Ok my code didn't handle on which button the user click cause it was just an example.No offense I was just trying to help... Link to comment Share on other sites More sharing options...
GEOSoft Posted July 7, 2010 Share Posted July 7, 2010 No offense taken. Your method might be similar to the way it's done in VB (it is) but AutoIt is written in C++ using the Windows API and that bears no similarity to VB. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
DarkAngel Posted July 11, 2010 Author Share Posted July 11, 2010 Well dun laugh guys but i still couldn't filesetattrib to set attributes for folder. I figured out that the filegetfolder function gives the full path of the folder. now if i assign that to a variable and use the filesetatrib on it to set atributes then its kinda not possible to set attributes to the full path of the folder. Can the path be navigated into and just the folder name be obtained in any way ? Link to comment Share on other sites More sharing options...
GEOSoft Posted July 11, 2010 Share Posted July 11, 2010 $sFolder = StringRegExpReplace($sPath, "^.+\\(.+)(?:\\)$", "$1");; allows for a trailing backslash if one exists George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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