Jump to content

prtscn & send email


 Share

Recommended Posts

Maybe explain what it is you're trying to do, that snippet isn't any help.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

- show a tooltip
- send ALT+PRTSCRN
- sleep for 200
- show blank tooltip


the only thing you'll see when you run this is the tooltip show for 0.2 seconds

to email the pic you'll need to save the binary from the clipboard to a file, generate an email, attach the file and send

check out functions _ScreenCapture_Capture   and _ScreenCapture_SaveImage

i cant remember the email function but it's really easy to use   SMTPSend or something like that.

Good luck :)

Link to comment
Share on other sites

some email tools:

_INetSmtpMail

_INetMail

i don't think they can do attachments though so you might need to use a third party commandline email program like Blat and run it using RunWait

I did not understand well Can you give me an example

& Thank you for help :D

Link to comment
Share on other sites

neither of the two functions I said can do attachments.

Download the windows commandline email program BLAT

To make an email and attach the screenshot:

RunWait(@ComSpec & " /c " & @ScriptDir & '\blat310\full\blat.exe - -body "body text here" -to username@isp.com -pw mypassword -attach snapshot.jpg', "", @SW_HIDE)

I'd use FileInstall to save a copy of blat.exe inside your script and dump it to the local drive during execution of your autoit script then on close have it delete Blat.

You'll need to provide the full path to Blat and to the attachment jpg file unless they live in the same folder as the script or are in your PATH environment variable.

Edited by gruntydatsun
Link to comment
Share on other sites

If you're going to be sending attachments use '?do=embed' frameborder='0' data-embedContent>>

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

thank you all

Waiting for more help

 

You're welcome

Waiting for some code

 

edit: Hint - You've been given all info you need.  Put something together based on the above replies.  If you run into trouble we'll help you out. 

Good Luck

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

What kylomas wanted to tell you is:

You have been given all information to do what you want. Now it is your turn to make a script out of it.

We do not spoon feed users here. We teach them to fish.

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

What kylomas wanted to tell you is:

You have been given all information to do what you want. Now it is your turn to make a script out of it.

We do not spoon feed users here. We teach them to fish.

ok

Thank you all

Excuse me, and I'm new here  :)

Edited by 3aberxcs
Link to comment
Share on other sites

No problem :)

If you encounter errors we will be happy to assist.

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

Not work ! :o

title="prtscn & send email: post #15">plz help me icon_share.png water
#include <ScreenCapture.au3> 
 #include <INet.au3>
$new = _ScreenCapture_Capture("new" & ".jpg")


$TextFileName = $new
$s_SmtpServer = "email server"
$s_FromName = "user name"
$s_FromAddress = "user@email.com"
$s_ToAddress = "user2@email.com"
$s_Subject = "Subject"
Dim $as_Body[2]
$as_Body[0] = "Message text line 1"
$as_Body[1] = "Message text line 2"

$Log = FileRead($TextFileName)

$pageArray = StringSplit($Log, @CRLF)

For $i = 1 To $pageArray[0]
If StringInStr($pageArray[$i], $findtext) Then $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @computername, -1)
Next
Edited by 3aberxcs
Link to comment
Share on other sites

Can you please be a bit more specific? "Not working" doesn't tell us much :)

What doesn't work? The screen capture part? The mailing part?

Do you get an error message?

If it is the mail part, what return value and error value (@error) do you get?

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

Variable $findtext is undefined so AutoIt doesn't know what to search for in function StringInStr.

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

#include <ScreenCapture.au3> 
 #include <INet.au3>
$new = _ScreenCapture_Capture("new" & ".jpg")


$TextFileName = $new
$s_SmtpServer = "email server"
$s_FromName = "user name"
$s_FromAddress = "user@email.com"
$s_ToAddress = "user2@email.com"
$s_Subject = "Subject"
Dim $as_Body[2]
$as_Body[0] = "Message text line 1"
$as_Body[1] = "Message text line 2"
; First we read the text file
$Log = FileRead($TextFileName)
; Put the contents into an array
$pageArray = StringSplit($Log, @CRLF)
; Now go through the array and look for the word failure if its found send and email
For $i = 1 To $pageArray[0]
If StringInStr($pageArray[$i], $findtext) Then $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @computername, -1)

 Return @error
Next

the mail part .

error msg

 

==> Variable used without being declared.:

If StringInStr($pageArray[$i], $findtext) Then $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @computername, -1)

If StringInStr($pageArray[$i], ^ ERROR

Link to comment
Share on other sites

Replace $findtext with "failure".

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

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