Jump to content

Email Attach Files Array with Public User


Sam1814
 Share

Recommended Posts

I have a script which will attach and send files as part of an email.  It works as intended except that when a file is located in the "UsersPublicPublic Documents" folder the attachment fails.

This is the pertinent part of the code:

$AttachFiles = "C:UsersPublicPublic DocumentsAccount ManagerAccount.dat"

Error Code:1 Description:0  is the error message.

I realize that C:UsersPublic" has a system variable of %PUBLIC%, and have tried using that as part of the filepath. I have also added an underscore for the folder "Account_Manager".

This is a Windows 7 environment with a Standard User account running the AutoIt executable.  The Account.dat file is accessible by the Standard User from either location and does not require elevation to Administrator for read/write.  The name of the Standard User account [logged on as] is Office.

What is the proper path filename to use in this scenario?

 

Thanks in advance.

Link to comment
Share on other sites

Just an idea...

If the Standard account is the problem

$AttachFiles = "C:\Users\Public\Public Documents\Account Manager\Account.dat"
$CopyFile =  "C:\Temp\TxtFiles\"
 
FileCopy( $AttachFiles, $CopyFile, 9) ; 1 = overwrite existing files + 8 to create the directory
 
; Use "C:\Temp\TxtFiles\Account.dat" to attach
Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Tried that as well.

 

DUH!!!  Foolish Me!

Apparently, the actual path is "C:UsersPublicDOCUMENTS".  Despite the fact that the Windows Explorer displays the path as being "C:UsersPublicPublic Documents..." in the command prompt window the folder is named "Documents" rather than "Public Documents".

Problem solved.

Thanks anyway.

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...