Jump to content
Sign in to follow this  
kater

Print Screen - and save the image

Recommended Posts

kater

Hi Guy's :)

your advice is very important for me about the below code ;)

I have this code for Print Screen and save the image of the screen in C Drive ;)

My question is : we need to modify in the existing code to save the image of the screen with the name of the existing user so how to get the name and save the image with name of the existing user

  • How to can I get the name of the existing user by AutoIt v3 ?
;Gets Screen HackMan
SEND("{PRINTSCREEN}")
Run("mspaint.exe")
WinWaitActive("untitled - Paint")
WinSetState ( "untitled - Paint", "", @SW_MAXIMIZE )
Send("!EP")
Send("P")
WinWaitActive("untitled - Paint")
Send("!FA")
Send("!T")
Send("{DOWN}")
Send("{DOWN}")
Send("{ENTER}")
Send("!N")
$sFileName = @MON & @MDAY & @HOUR & @MIN & @SEC & ".jpg"
Send("c:\user")

Send("{ENTER}")
Send("{TAB 1}")
Send("{ENTER}")

Send("!{F4}")
EXIT

Edited by kater

Share this post


Link to post
Share on other sites
DjDeep00

@Username

Share this post


Link to post
Share on other sites
qazwsx

there are easier ways to save the image from print screen than using paint, but i guess paint would be good practice coding.

Share this post


Link to post
Share on other sites
Nahuel

Yeah, there's this new library. But it will only work on WinXP.

@username is the macro you needed. Also, I think that saving the sreenshot on the desktop would be more useful. So instead of Send("c:\user") use:

Send(@DesktopDir&"+7"&@username)

-edit-

If you use Send("c:\user") it will send: c.7user (the / key is 7 in my keyboard.)

So use the + to send a shift stroke.

Edited by Nahuel

Share this post


Link to post
Share on other sites
kater

Please advice me in this error :)

I tried to change the existing code to save the image in C Drive but there is some errors

so please advice me in the below code

Send("c:\user"&"+7"&@username)

Share this post


Link to post
Share on other sites
martin

Please advice me in this error :)

I tried to change the existing code to save the image in C Drive but there is some errors

so please advice me in the below code

Send("c:\user"&"+7"&@username)

Send("C:\user\" & @Username & "\" & $Filename)

Where $filename is the name of the file to be saved, eg

$Filename = "image17.bmp"

I'm not sure what the email bits are for, and the "+7" is from advice you were given-

If you use Send("c:\user") it will send: c.7user (the / key is 7 in my keyboard.)

So use the + to send a shift stroke.

Maybe he meant

If you use Send("c:\user") it will send: c:7user (the '\' key is shift '7' in my keyboard.)

So use the + to send a shift stroke.

If you send("C:\user") and it sends "C:\user", then don't worry about the "+7" which must be a quirk of Nahuel's PC, I certainly don't have that problem.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
kater

still there is error , How to can I fix it ?

Share this post


Link to post
Share on other sites
Nahuel

If you send("C:\user") and it sends "C:\user", then don't worry about the "+7" which must be a quirk of Nahuel's PC, I certainly don't have that problem.

Oh sorry, I didn't notice my mistake. I don't know what an English keyboard looks like. In my case, if you want to send the ":" character, you have to press shift+ "." (Which I guess applies for every keyboard), otherwise it will send the dot, obviously. As for the "\" character, I was wrong. It was AltGr+"º" (below esc).

Anyway, sorry if I'm causing confusion. But this is how it works for me. If I use "send("C:\user")" it sends "c.ºuser".

kater, why don't you tell us what the error is. It's probably somewhere else.

I checked your script and I'm not sure what some thigs do.

Here's what I did. (It hasn't been tested properly since my Paint is in spanish, but it worked.)

Send("{PRINTSCREEN}")
Run("mspaint.exe")
WinWaitActive("untitled - Paint")
WinSetState ( "untitled - Paint", "", @SW_MAXIMIZE)
Send("^v")  
Send("^s")
WinWaitActive("Save as")
$sFileName = @MON & @MDAY & @HOUR & @MIN & @SEC & "-"&@Username&".bmp"
ClipPut(@DesktopDir&"\"&$sFileName)
send("^v")
Send("{ENTER}")
Sleep(500);Just in case...
ProcessClose("mspaint.exe")

Share this post


Link to post
Share on other sites
kater

I have idea !! :)

No need to all the codes we need to create a new code as the below description

" we need to this point only "

when the script running we need from it to get the user name and copy it in the clipboard

when me want to save the image I'll apply the code of Ctrl +V

with this step can we save the image with same user name ;)

but tell me which code will get the name and it will copy it in the clipboard ? ;)

Share this post


Link to post
Share on other sites
kater

How to can I get the user name of the existing user ? :)

Share this post


Link to post
Share on other sites
herewasplato

How to can I get the user name of the existing user ? :)

@UserName

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
herewasplato

.....but tell me which code will get the name and it will copy it in the clipboard ? :)

ClipPut(@UserName)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
herewasplato

Nahuel,

You were so close...

I only had to change

WinWaitActive("Save as") to be

WinWaitActive("Save As")

I'll bet it is hard to do the translation pefect...

I cannot even get English scripts right sometimes and I have an English OS :-)

Thanks for your help in this tread.

-MSP-


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
herewasplato

...I'm not sure what the email bits are for,...

Let's hope that the screen shots are not to be e-mailed :-(

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
kater

how to can I get the name of the existing user name and copy it in Clipboard

is there any guy can help me and explain to me :)

Share this post


Link to post
Share on other sites
Nahuel

how to can I get the name of the existing user name and copy it in Clipboard

is there any guy can help me and explain to me :)

1º. Open SciTe (The script editor).

2º. Type this: ClipPut(@UserName)

3º. Save it.

4º. Run the script.

Now the name of the existing user name is in the clipboard.

Just remember to always check the help file. (Look for ClipPut and ClipGet) ;)

Share this post


Link to post
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
Sign in to follow this  

×