Jump to content

[Resolved] OutlookEx AttachmentSave auto add _ to file name


CC_Mu
 Share

Recommended Posts

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 by CC_Mu
resolved the question
Link to comment
Share on other sites

@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 by TheXman
Link to comment
Share on other sites

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...