Zwettenduvel Posted September 25, 2017 Share Posted September 25, 2017 I wrote a script that take a screenshot of a certain area and saves it in a map. However I want to take multiple screenshots in a row, without it erasing the same picture every time. dim $sFilePath = "C:\Users\Deeters\Desktop\aze\$key.jpg" $key is a variable that is different each time. And alternative that I also would like to try is add a date and time in the name of the screenshot. Thank you Link to comment Share on other sites More sharing options...
jguinch Posted September 25, 2017 Share Posted September 25, 2017 You must concatenate the string and the variable, using the character "&" : $sFilePath = "C:\Users\Deeters\Desktop\aze\" & $key & ".jpg" For the rest, look at the help file, please Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Zwettenduvel Posted September 25, 2017 Author Share Posted September 25, 2017 When I 2 minutes ago, jguinch said: You must concatenate the string and the variable, using the character "&" : $sFilePath = "C:\Users\Deeters\Desktop\aze\" & $key & ".jpg" For the rest, look at the help file, please Thank you for answering but I already tried that and when I do that my image has no name. Link to comment Share on other sites More sharing options...
Developers Jos Posted September 25, 2017 Developers Share Posted September 25, 2017 Well, that is the valid way of doing it so show the code that you have issues with so we can check whether there is something else wrong. Jos 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 More sharing options...
Zwettenduvel Posted September 25, 2017 Author Share Posted September 25, 2017 HotKeySet("{ESC}", "Terminate") HotKeySet("k", "drukknopK") Global $key Global $som #include <ScreenCapture.au3> dim $sFilePath = "C:\Users\Deeters\Desktop\aze\" & $key & ".jpg" dim $OCR_Rectangle[4] = [434, 256, 750, 447] Func Terminate() Exit 1 EndFunc MsgBox(0, "test", "ok") Func drukknopK() _ScreenCapture_Capture($sFilePath,434, 256, 750, 447,False) Local $som = PixelChecksum ( 434, 256, 750, 447 ) $key = "k" sleep(300) MsgBox(1,"test","de som =" & $key & " " & $som) sleep(300) WinActivate ("azebeze - WordPad") WinWaitActive("azebeze - WordPad") Send(1 & " " & $som & "{ENTER}") EndFunc While 1 sleep(250) WEnd Link to comment Share on other sites More sharing options...
Zwettenduvel Posted September 25, 2017 Author Share Posted September 25, 2017 Replace $key with $som, I forgot I was testing things. Link to comment Share on other sites More sharing options...
Developers Jos Posted September 25, 2017 Developers Share Posted September 25, 2017 So why do you expect that $key is anything else than empty ("") at the time you concatenate it into the $ sFilePath variable? Jos 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 More sharing options...
Zwettenduvel Posted September 25, 2017 Author Share Posted September 25, 2017 I have no idea, I am sorry. Link to comment Share on other sites More sharing options...
Developers Jos Posted September 25, 2017 Developers Share Posted September 25, 2017 Well, I hope you have some expectations what that filename actually should be...right? Explain what your intent was for the $Key variable and what is supposed to contain. 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 More sharing options...
Zwettenduvel Posted September 25, 2017 Author Share Posted September 25, 2017 I found it! This is what I wanted to achieve: Thank you for helping. Func drukknopK() Local $som = PixelChecksum ( 434, 256, 750, 447 ) _ScreenCapture_Capture("C:\Users\Deeters\Desktop\aze\" & $som & ".jpg",434, 256, 750, 447,False) $key = "k" sleep(300) MsgBox(1,"poes","de som =" & $key & " " & $som) ;dim $sFilePath = "C:\Users\Deeters\Desktop\aze\" & $som & ".jpg" sleep(300) WinActivate ("azebeze - WordPad") WinWaitActive("azebeze - WordPad") Send(1 & " " & $som & "{ENTER}") EndFunc Link to comment Share on other sites More sharing options...
Zwettenduvel Posted September 25, 2017 Author Share Posted September 25, 2017 17 minutes ago, Jos said: Well, I hope you have some expectations what that filename actually should be...right? Explain what your intent was for the $Key variable and what is supposed to contain. This is maybe to much to ask but. If you look at my code you might understand what im trying to do. I want to make a list of all the pixelvaluesums of an area that is chaning on the screen in wordpad. But now my script automatically goes to wordpad, types the pixelvaluesum and then I have to go back to the screen I want to take screenshots from manually, is there a way that I can make this list in the background without changing windows? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now