Jump to content

File Attachment


grimmlock
 Share

Recommended Posts

This is part of my script

If $s_AttachFiles <> '' Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ';')
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
If FileExists($S_Files2Attach[$x]) Then
ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
$objEmail.AddAttachment($S_Files2Attach[$x])
Else
ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
SetError(1)
Return 0
EndIf
Next
EndIf

What I am trying to figure out is where to put and how to put in a control box that allows the GUI to attach a file. Since this code is already part of my code I am pretty sure all I need is a way to call this.

Any thoughts would be greatly appreciated.

Thanks

Grimm

Edited by grimmlock

Thanks

Grimm

Link to comment
Share on other sites

Should the user just enter the filename or should he select the file from a directory treeview?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

  • Developers

This is part of my script

think you mean that this is part of an udf called _inetsmtpmailcom.... ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Jos yes that is part of the _inetsmtpmailcom udf :)

Water...

Ultimately goal: I would like to have a button ('Browse') that allows that user to open explorer and allows the user to select the file attached. Maybe even include an uneditable edit box that shows the file name that is being attached. Then when the user clicks on the send button that then attaches the file to an email. I was hoping that the part of the code I have will allow the attachment to an email to happen.

Thanks

Grimm

Thanks

Grimm

Link to comment
Share on other sites

So far I created a button that works at opening explorer and letting me "Open" a file

Case $hBrowseButton
Local $file = FileOpenDialog('Choose file...', @DesktopDir, 'All Image Types (*.bmp;*.png;*.jpeg;*.gif;*.jpg;*.tiff)|Word (*.doc;*.docx;*.txt)', 1 + 4)

Now I just need it to attach the selected file to an email, as well as have my file label show the file I selected :)

Thanks

Grimm

Edited by grimmlock

Thanks

Grimm

Link to comment
Share on other sites

Got it need to add -

Original:

$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body)

Fixed:

$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body, [u][b]$s_AttachFiles[/b][/u])

Thanks :thumbsup:

Grimm

Thanks

Grimm

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

×
×
  • Create New...