 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
kiu
Joined: 18 Dec 2005 Posts: 234 Location: Italy - Galatro(RC)
|
Posted: Thu Feb 02, 2006 12:49 pm Post subject: |
|
|
if someone is interested:
http://www.autohotkey.net/~kiu/kiu-clipsave.exe
use it to save an image on clipboard in png and jpg.When launched it save the image in image.jpg and image.png _________________ ____________________
______________________
kiu - www.romeosa.com |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6836 Location: France (near Paris)
|
Posted: Fri Mar 17, 2006 10:28 am Post subject: |
|
|
If someone is interested:
SetClipboardData is a pure AutoHotkey (with DllCall) solution to this problem. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
madewokherd
Joined: 07 Jul 2007 Posts: 5
|
Posted: Wed Aug 08, 2007 4:51 pm Post subject: |
|
|
PhiLho: This is perfect for a problem I have, but the project I'd like to use it in is open source (GPL). You haven't given a license, and I'd like to avoid any potential legal problems. I would expect that since you've posted your source code for all to see, you are ok with this kind of use. Would you give it a license compatible with the GPL so that I can use it? _________________ jabber: madewokherd@gmail.com |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Wed Aug 08, 2007 4:58 pm Post subject: |
|
|
| PhiLho is unavailable for a few weeks. Hopefully he'll notice your post the next time he gets a chance to visit the forum. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Wed Aug 08, 2007 5:10 pm Post subject: |
|
|
| If you use my original version, it is absolutely free. You can even sell the script (not AHK) for profit, if you want. However, with the recent AHK updates, all of these functions can be greatly simplified and sped up. |
|
| Back to top |
|
 |
madewokherd
Joined: 07 Jul 2007 Posts: 5
|
Posted: Wed Aug 08, 2007 5:41 pm Post subject: |
|
|
Thanks.
On looking more carefully, I think I misunderstood PhiLho's script, and it doesn't provide something I need (it may not be possible, and certainly isn't trivial). I guess I'm better off reading/writing the whole file as a variable. :/ _________________ jabber: madewokherd@gmail.com |
|
| Back to top |
|
 |
apocalypse r Guest
|
Posted: Tue Apr 08, 2008 1:16 am Post subject: more functions + wish list |
|
|
these were adapted from the functions in binreadwrite.ahk provided by PhilLo, and were designed for writing or reading just once; they open and close the handles automatically.
readfiletovar(filename, vartowritecontentsoffileto, bytestoread, startlocation, offset)
startlocation can be -1 for dont move, 0 for start at beginning, 1 for current location, 2 for end of file, and offset is the number of bytes to the left of startlocation to begin reading from (which can be negative). 0 stands for at specified start location
| Code: | readfiletovar(_filename, byref _data, _byteNB = 0, _MoveMethod = -1, _offset = 0)
{
local handle, granted, read
handle := Dllcall("CreateFile", "Str", _filename, "UInt", 0x80000000, "UInt", 3, "UInt", 0, "UInt", 3, "UInt", 0, "UInt", 0)
if (handle = INVALID_HANDLE_VALUE or handle = 0)
{
errorlevel = -1
return, -1
}
if (_moveMethod != -1)
{
_offset := DllCall("SetFilePointer", "UInt", handle, "Int", _offset, "UInt", 0, "UInt", _moveMethod)
if (_offset = -1)
{
ErrorLevel = -2
dllcall("CloseHandle", "UInt", handle)
return -2
}
}
if (_byteNB = 0)
{
_byteNB := Dllcall("GetFileSize", "UInt", handle, "UInt", 0)
if (_byteNB = 0xFFFFFFFF)
{
errorlevel = -3
dllcall("CloseHandle", "UInt", handle)
return -3
}
}
granted := varsetcapacity(_data, _byteNB, 0)
if (granted < _byteNB)
{
errorlevel := %granted%
dllcall("CloseHandle", "UInt", handle)
return -4
}
if (dllcall("ReadFile", "UInt", handle, "Str", _data, "UInt", _byteNb, "UInt *", read, "UInt", 0) = 0)
{
errorlevel := -5
dllcall("CloseHandle", "UInt", handle)
return -5
}
dllcall("CloseHandle", "UInt", handle)
return read
} |
writevartofile(filename, varcontainingdatatowritetofile, bytestowrite, startingposition, offset)
startlocation can be -1 for dont move, 0 for start at beginning, 1 for current location, 2 for end of file, and offset is the number of bytes to the left of startlocation to begin reading from (which can be negative). 0 stands for at specified start location
| Code: | writevartofile(_filename, byref _data, _byteNB, _movemethod, _offset)
{
local handle, datasize, written
handle := dllcall("CreateFile", "Str", _filename, "UInt", 0x40000000, "UInt", 3, "UInt", 0, "UInt", 4, "UInt", 0, "UInt", 0)
if (handle = INVALID_HANDLE_VALUE or handle = -1)
{
errorlevel := -1
return, -1
}
if (_moveMethod != -1)
{
_offset := DllCall("SetFilePointer", "UInt", handle, "Int", _offset, "UInt", 0, "UInt", _moveMethod)
if (_offset = -1)
{
errorLevel = -2
dllcall("CloseHandle", "UInt", handle)
return -2
}
}
datasize := varsetcapacity(_data)
if (_byteNB < 1 or byteNB > datasize)
_byteNB := datasize
if (dllcall("WriteFile", "UInt", handle, "Str", _data, "UInt", _byteNb, "UInt *", written, "UInt", 0) = 0 or written < _byteNB)
{
errorlevel := -3
dllcall("CloseHandle", "UInt", handle)
return -3
}
dllcall("CloseHandle", "UInt", handle)
return written
} |
|
|
| Back to top |
|
 |
WankaUSR
Joined: 14 Aug 2007 Posts: 86
|
Posted: Sat Apr 12, 2008 11:51 am Post subject: |
|
|
| can anyone please help me with a gui for this because i don't quite understand how to use functions |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|