Jump to content
Zwettenduvel

How to get a variable in a folder path?

Recommended Posts

Zwettenduvel

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

Share this post


Link to post
Share on other sites
Zwettenduvel

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.

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Zwettenduvel

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

Share this post


Link to post
Share on other sites
Zwettenduvel

Replace $key with $som, I forgot I was testing things.

Share this post


Link to post
Share on other sites
Zwettenduvel

I have no idea, I am sorry.

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Zwettenduvel

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

Share this post


Link to post
Share on other sites
Zwettenduvel
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?

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

×