Jump to content

Recommended Posts

ey... :whistle:

i'd like, to clipput a file, like this

Func _captureclip()

$number = iniread("C:\Screenshots\ini.ini", "ini", "ini", "")

$number = $number - 1

$file = "C:\Screenshots\Screenshot\" & $number

file

clipput($file)

EndFunc

but as the smart scripter can see, i get the text 'C:\Screenshots\Screenshot\" & $number' in my clipboard..

my question is

How do i put a file into the clipboard, with autoit? and is it even possible?

~WhOOt

Link to post
Share on other sites
  • Developers

try:

Func _captureclip()
    $number = IniRead("C:\Screenshots\ini.ini", "ini", "ini", "")
    $number = $number - 1
    $file = "C:\Screenshots\Screenshot\" & $number
    $file_text = FileRead($file,FileGetSize($file)) 
    ClipPut($file_text)
EndFunc  ;==>_captureclip

:whistle:

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 post
Share on other sites

try:

Func _captureclip()
    $number = IniRead("C:\Screenshots\ini.ini", "ini", "ini", "")
    $number = $number - 1
    $file = "C:\Screenshots\Screenshot\" & $number
    $file_text = FileRead($file,FileGetSize($file)) 
    ClipPut($file_text)
EndFunc  ;==>_captureclip

:whistle:

<{POST_SNAPBACK}>

mmmm... it doesnt seem to work for me.. :dance:

i've got a script here, wich i guess seems to be really hard to read :dance:

its nothing fancy, in fact its crap :(

Please help me out, on makin' it workin' :D

global $number = "Screenshot"
global $checkname = "0"
global $number = "1"

while 1
    hotkeyset("^f", "_capture")
    hotkeyset("^d", "_captureclip")
    hotkeyset("^n", "_name")
    sleep(70)
wend

;the capturer, wich saves the Screenshots to C:\Screenshots\
func _capture()
$number = iniread("C:\Screenshots\ini.ini", "ini", "ini", "")
if @error then _error()
; Capture full screen

; Fist parameter - filename, last - jpeg quality. 
DllCall("captdll.dll", "int", "CaptureScreen", "str", "dump_full.jpg", "int", 85)
dircreate("C:\Screenshots")
iniread("C:\Screenshots\ini.ini", "ini", $number, "")
if @error then 
iniwrite("C:\Screenshots\ini.ini", "ini", $number, "")
elseif not @error then
    $number = $number +1
filemove("dump_full.jpg", "C:\Screenshots\"& "ini" & $number & ".jpg")
iniwrite("C:\Screenshots\ini.ini", "ini", "ini", $number)
endif
endfunc

func _name()
    $number = 0
    $number = inputbox("Insert Screenshot name", "Here")
    $dubblecheck = iniread("C:\Screenshots\ini.ini", "ini", "name", "ini")
    if $checkname >0 then
        sleep(10)
        elseif $checkname <0 then 
    iniwrite("C:\Screenshots\ini.ini", "ini", "ini", $number)
    $number = "0"
    endif
    EndFunc


;Captureclip doesnt work
Func _captureclip()
    DllCall("captdll.dll", "int", "CaptureScreen", "str", "dump_full.jpg", "int", 85)
    $number = IniRead("C:\Screenshots\ini.ini", "ini", "ini", "")
    filemove("dump_full.jpg", "C:\Screenshots\"& "ini" & $number & ".jpg")
    $number = $number - 1
    $file = "C:\Screenshots\Screenshot\" & $number
    $file_text = FileRead($file,FileGetSize($file)) 
    ClipPut($file_text)
EndFunc ;==>_captureclip



;If you get errored :)
func _error()
    if not fileexists("C:\Screenshots\ini.ini") Then
    iniwrite("C:\Screenshots\ini.ini", "ini", "ini", "1")
    endif
    endfunc
Link to post
Share on other sites

First you have the use of "ini" too many times ( i believe)

The actual problem.... I think its here

filemove("dump_full.jpg", "C:\Screenshots\"& "ini" & $number & ".jpg")

.....

$file = "C:\Screenshots\Screenshot\" & $number

the location of these are diffferent

8)

Edited by Valuater

NEWHeader1.png

Link to post
Share on other sites

First you have the use of "ini" too many times ( i believe)

The actual problem.... I think its here

filemove("dump_full.jpg", "C:\Screenshots\"& "ini" & $number & ".jpg")

.....

$file = "C:\Screenshots\Screenshot\" & $number

the location of these are diffferent

8)

<{POST_SNAPBACK}>

Oke, i've cleaned my script out, totaly.

Now only the most important is left.

global $number = "Screenshot"
global $checkname = "0"
global $number = "1"

while 1
    hotkeyset("^f", "_capture")
    hotkeyset("^d", "_captureclip")
    hotkeyset("^n", "_name")
    sleep(70)
wend

;the capturer, wich saves the Screenshots to C:\Screenshots\
func _capture()
;DllCall is what makes the Screenshot.
DllCall("captdll.dll", "int", "CaptureScreen", "str", "dump_full.jpg", "int", 85)
dircreate("C:\Screenshots")
filemove("dump_full.jpg", "C:\Screenshots\Screenshot.jpg")
endfunc

func _name()
    EndFunc


;Captureclip doesnt work
Func _captureclip()
DllCall("captdll.dll", "int", "CaptureScreen", "str", "dump_full.jpg", "int", 85)
dircreate("C:\Screenshots")
filemove("dump_full.jpg", "C:\Screenshots\Screenshot.jpg")
    $file = "C:\Screenshots\Screenshot.jpg"
    $file_text = FileRead($file,FileGetSize($file)) 
    ClipPut($file_text)
EndFunc;==>_captureclip



;If you get errored :)
func _error()
msgbox(0, "Error", "Error")
endfunc

I've still got a prob, with the Captureclip... i really dont understand it :S

EDIT: The captureclip output is : ÿØÿà

if i output it in notepad.

it doesnt do anything, if i output it in a folder..

Thanks

~WhOOt

Edited by WhOOt
Link to post
Share on other sites
  • Developers

k.. guess your file you want loaded in the clipboard is a picture and not readable text.....

Don't think you can load that by just reading the file or defining its name. You probably need to load the picture with a program that can display it and then load it into the clipboard.

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 post
Share on other sites

k.. guess your file you want loaded in the clipboard is a picture and not readable text.....

Don't think you can load that by just reading the file or defining its name. You probably need to load the picture with a program that can display it and then load it into the clipboard.

<{POST_SNAPBACK}>

i dont think we understand each other... maybe i dont understand you :whistle:

but i want to output the file, as if i pressed ctrl+c on it.

then press ctrl+v to output it.

= copy the file from one place to another...

Hope i express myself clearly enough..

~WhOOt

Link to post
Share on other sites

the  _capture doesn't work for me

I get a c:\screenshot folder that is empty  (win xp)

does this work for you??

is there a pic in the folder??

8)

<{POST_SNAPBACK}>

yup, it works....

you missed the .dll call... you need the speceficed dllfile

I attached it :whistle:

~WhOOt

captdll.dll

Link to post
Share on other sites

$file = "C:\Screenshots\Screenshot.jpg"
    $file_text = FileRead($file,FileGetSize($file)) 
    ClipPut($file_text)

I've still got a prob, with the Captureclip... i really dont understand it :S

EDIT: The captureclip output is : ÿØÿà

if i output it in notepad.

it doesnt do anything, if i output it in a folder..

<{POST_SNAPBACK}>

i dont think we understand each other... maybe i dont understand you :whistle:

but i want to output the file, as if i pressed ctrl+c on it.

then press ctrl+v to output it.

= copy the file from one place to another...

Hope i express myself clearly enough..

~WhOOt

<{POST_SNAPBACK}>

Just to clarify.

JdeB is correct with what he has stated. What he should have said though, you absolutely cannot FileRead() a jpg file, and you absolutely cannot ClipPut() a picture. A jpg is a compressed picture, so it is binary, not text. AutoIt cannot directly read binary.

Now since you have a jpg in a variable, then there is no known method, unless a DllCall could be used to add it to the clipboard. Or as JdeB has mentioned, script a program that can handle the graphic for you.

If you mean something else, then it is not displayed in this thread.

Link to post
Share on other sites
  • 5 years later...

Just to clarify.

JdeB is correct with what he has stated. What he should have said though, you absolutely cannot FileRead() a jpg file, and you absolutely cannot ClipPut() a picture. A jpg is a compressed picture, so it is binary, not text. AutoIt cannot directly read binary.

Now since you have a jpg in a variable, then there is no known method, unless a DllCall could be used to add it to the clipboard. Or as JdeB has mentioned, script a program that can handle the graphic for you.

If you mean something else, then it is not displayed in this thread.

You could use something like, _ClipPutFile if it is a actual file\ picture and if you are wanting it saved to the clipboard file wise then the DLL or even a COM mabey the best route.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...