CC_Mu Posted December 4, 2018 Share Posted December 4, 2018 (edited) I am trying to save email's attachment to destination folder but the file name automatically replace space with an underscore, How can I eliminate this feature? this is my code _OL_ItemAttachmentSave($oOutlook, $aMail[1][0], Default, 1, "W:\myfolder\file name has space 2018.xlsx) however, the file saved is actually this Quote W:\myfolder\file_name_has_space_2018.xlsx How can I make sure the file name is saved as what I need? Thank you so much for helping me! Edited December 5, 2018 by CC_Mu resolved the question Link to comment Share on other sites More sharing options...
TheXman Posted December 5, 2018 Share Posted December 5, 2018 (edited) @CC_Mu If you look at the _OL_ItemAttachmentSave() function, in the OutlookEx.au3 file, on or about line 2449, you will see the following line of code: $sFName = StringRegExpReplace($sFName, '[ \/:*?"<>|]', '_') It is replacing all special characters in the filename with underscore. So if you don't want it to do that, you can modify the function, create your own function, or rename the file after the fact. Edited December 5, 2018 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
water Posted December 5, 2018 Share Posted December 5, 2018 If it works for you then I might modify the UDF as spaces are acceptable in file names. 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...
CC_Mu Posted December 5, 2018 Author Share Posted December 5, 2018 15 hours ago, TheXman said: @CC_Mu If you look at the _OL_ItemAttachmentSave() function, in the OutlookEx.au3 file, on or about line 2449, you will see the following line of code: $sFName = StringRegExpReplace($sFName, '[ \/:*?"<>|]', '_') It is replacing all special characters in the filename with underscore. So if you don't want it to do that, you can modify the function, create your own function, or rename the file after the fact. Got it, I may just rename the file one more time, dont want to mess up with the original function. Thank you for your help! TheXman 9 hours ago, water said: If it works for you then I might modify the UDF as spaces are acceptable in file names. Hey Water, thanks for reading this post, it is ok for me to rename the file one more time. Since I dont see much people have similar question like me, I am not sure if it worths for your to modify the UDF, but it is totally up to you! Thank you for developing this UDF, it is awesome! Link to comment Share on other sites More sharing options...
water Posted December 5, 2018 Share Posted December 5, 2018 Glad you like the UDF As you have found a simple solution I will, for the time being, not change the UDF until a few more users report the same problem. 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...
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