AutoHotkey Community

It is currently May 26th, 2012, 3:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 2nd, 2006, 1:49 pm 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 17th, 2006, 11:28 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
If someone is interested: :-)
SetClipboardData is a pure AutoHotkey (with DllCall) solution to this problem.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 5:51 pm 
Offline

Joined: July 7th, 2007, 7:29 pm
Posts: 5
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 5:58 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
PhiLho is unavailable for a few weeks. Hopefully he'll notice your post the next time he gets a chance to visit the forum.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 6:10 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 6:41 pm 
Offline

Joined: July 7th, 2007, 7:29 pm
Posts: 5
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 8th, 2008, 2:16 am 
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
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2008, 12:51 pm 
Offline

Joined: August 14th, 2007, 12:11 pm
Posts: 86
can anyone please help me with a gui for this because i don't quite understand how to use functions


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, oldbrother and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group