Sign in to follow this  
Followers 0
CyNDeR

Problem with ClipPut()

4 posts in this topic

I'm writing a small script to help with another much larger script i'm working on.

$left = InputBox("Left", "Whats the left line?")
$top = InputBox("Top", "Whats the top line?")
$right = InputBox("Right", "Whats the right line?")
$bottom = InputBox("Bottom", "Whats the bottom line?")
$sum = PixelChecksum($left, $top, $right, $bottom)
WinActivate("Diablo II")
WinWaitActive("Diablo II")
Sleep(1000)
ClipPut(PixelChecksum($left, $top, $right, $bottom));This is where i'm having the problem
If MsgBox(0, "Continue?", "Do you wish to continue?") = 1 Then
    ClipPut($sum)
EndIf

The line commented above is supposed to copy PixelChecksum($left, $top, $right, $bottom) to the clipboard while filling in the $left, $top, $right, and $bottom parts.

IE: "PixelChecksum(200, 200, 200, 200)" should be copied so i can paste it into another script.

That line is the only one that i cant get to work, everything else does. Any help?


My scripts: Random Painter

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Since you specifically want "PixelChecksum(..." to be copied into the clipboard, you need to pass ClipPut() a string containing the function name and the values fitted in place.

There are 2 simple solutions to this:

ClipPut("PixelChecksum(" & $left & ", " & $top & ", " & $right & ", " & $bottom & ")")
or

ClipPut(StringFormat("PixelChecksum(%d, %d, %d, %d)", $left, $top, $right, $bottom))

I prefer the latter simply because it's much cleaner and easier to read. If you're not sure what StringFormat() is doing, check the AutoIt help file (you won't regret it, as it's a useful function for things like this).

Edited by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

Share this post


Link to post
Share on other sites

Since you specifically want "PixelChecksum(..." to be copied into the clipboard, you need to pass ClipPut() a string containing the function name and the values fitted in place.

There are 2 simple solutions to this:

ClipPut("PixelChecksum(" & $left & ", " & $top & ", " & $right & ", " & $bottom & ")")
or

ClipPut(StringFormat("PixelChecksum(%d, %d, %d, %d)", $left, $top, $right, $bottom))

I prefer the latter simply because it's much cleaner and easier to read. If you're not sure what StringFormat() is doing, check the AutoIt help file (you won't regret it, as it's a useful function for things like this).

Thanks alot! It works perfect now. I had been trying to use the double quotes and the "&" symbols but i was putting them in the wrong place. And thanks for pointing out StringFormat(), it seems very useful even though i dont fully understand it yet, lol.


My scripts: Random Painter

Share this post


Link to post
Share on other sites

Guess i spoke too soon, it doesnt return the correct checksum for some reason. Any ideas?


My scripts: Random Painter

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  
Followers 0