Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Screenshot using GDIp and AHK_L


  • Please log in to reply
2 replies to this topic
camerb
  • Moderators
  • 573 posts
  • Last active: Sep 14 2015 03:32 PM
  • Joined: 19 Mar 2009
I'm trying to take a screenshot using AHK_L and GDIp... however, the following code works fine in AHK_basic, but hangs in AHK_L (waits forever for the JPG file to be created at the end of the script). For this reason, I'm suspecting that Gdip_SaveBitmapToFile() does not function properly using AHK_L. Can anyone confirm or deny this?

I'm using GDIp 1.43 by tic, and it works in AHK_basic, but fails in AHK_L unicode 32-bit and AHK_L ansi 32-bit.

file:="joe.jpg"
nl:=100
nt:=100
nw:=200
nh:=200
pToken:=Gdip_Startup()
pBitmap:=Gdip_BitmapFromScreen(nL "|" nT "|" nW "|" nH)
Gdip_SaveBitmapToFile(pBitmap, file, 100)
Gdip_Shutdown(pToken)

while NOT FileExist(file)
   Sleep, 10

Aren't you glad that I didn't put an annoying gif here?

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
works fine for me, try using absolute path, e.g. "c:\temp\joe.jpg"

camerb
  • Moderators
  • 573 posts
  • Last active: Sep 14 2015 03:32 PM
  • Joined: 19 Mar 2009
ugh... You're right, it works fine when I eliminate all other code. Works fine for a absolute or a relative path. Something must be wrong with the library that I use for testing scripts (although I'm quite surprised that it manifested itself in that way). Now it's time to debug.
Aren't you glad that I didn't put an annoying gif here?