AutoHotkey Community

It is currently May 27th, 2012, 6:47 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: AHK basic & windows 7
PostPosted: August 24th, 2011, 3:29 pm 
Offline

Joined: November 24th, 2008, 7:22 pm
Posts: 73
I dread moving to a new operating system. Call me a p%^&y, but it generally results in reduced productivity for weeks. Work is moving from XP to 7 and "just enough" of my AHK productivity tools have issues. I'm sure the changes microsoft were in my best interest but...

Any consoling words or ideas to ease the transistion would be appreciated.

Relayer


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2011, 6:20 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
The first thing I'll say is don't condemn 7 on the first day. It will be the little differences that annoy you (for example the loss of a maximize button from windows to mac).
Also, remember to do something about UAC :!: turn it off, use Lexikos's script to sign AutoHotkey.exe ...
Third, Google is your friend :lol: chances are people will have already solved most problems you will have.

And remember the ahk community is here to help :wink:

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


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

Joined: November 24th, 2008, 7:22 pm
Posts: 73
nimda,

Very encouraging words. Thank you! I'm plugging along pretty well and have a lot of things running as they were in XP. I use the magnifier script that has been talked about a lot on the forum. I've searched the forum until my hand cramped up but I still can't get this working on win 7. Any ideas? Perhaps I should post to the ask for help section?

Thanks in advance!
Relayer

Code:
#NoEnv
#SingleInstance, Force
SetWinDelay, 10
CoordMode, Mouse, Screen
DetectHiddenWindows, On


Magnifier()
ExitApp

^q::
ExitApp

Magnifier(bInvert = False)
{
   Global nZ, nW, nH, vW, flag
   vW := 3
   nZ := 2                               ; Zoom Factor
   nW := A_ScreenWidth // vW //2//nZ      ; Width  of (small) Target Rectangle  // is floor division (rounds down)
   nH := A_ScreenHeight// (2 * vW) //2//nZ      ; Height of (small) Target Rectangle
   
RunIt:   
   ToolTip, %A_Space%
   WinGet, hWnd, ID, ahk_class tooltips_class32
   WinClose, ahk_class SysShadow      ; Comment it out to have the DropShadow

   hDC_SC := DllCall("GetDC", "Uint",    0)
   hDC_LW := DllCall("GetDC", "Uint", hWnd)
   hDC_TT := DllCall("GetDC", "Uint", hWnd)

   DllCall("SetStretchBltMode", "Uint", hDC_TT, "int", 4)

   Loop
   {
      MouseGetPos, xCursor, yCursor
      DllCall("BitBlt", "Uint", hDC_LW, "int", 0, "int", 0, "int", 2*nW, "int", 2*nH, "Uint"
               , hDC_SC, "int", xCursor-nW, "int", yCursor-nH, "Uint", 0x40CC0020)
      If bInvert
         DllCall("BitBlt", "Uint", hDC_LW, "int", 0, "int", 0, "int", 2*nW, "int", 2*nH
               , "Uint", 0, "int", 0, "int", 0, "Uint", 0x00550009)
      Cursor(hDC_LW, nW, nH)      ; Capture magnified mouse cursor.
      DllCall("StretchBlt", "Uint", hDC_TT, "int", 0, "int", 0, "int", 2*nW*nZ, "int", 2*nH*nZ
            , "Uint", hDC_LW, "int", 0, "int", 0, "int", 2*nW, "int", 2*nH, "Uint", 0x00CC0020)
      Cursor(hDC_TT, nW*nZ, nH*nZ)   ; Capture un-magnified mouse cursor.
      WinMove, ahk_id %hWnd%,, xCursor-(nW*nZ+1), yCursor+nH, 2*(nW*nZ+1), 2*(nH*nZ+1)

      If GetKeyState("Esc")
         Break
      If (flag)
         Break
   }

   DllCall("ReleaseDC", "Uint",    0, "Uint", hDC_SC)
   DllCall("ReleaseDC", "Uint", hWnd, "Uint", hDC_LW)
   DllCall("ReleaseDC", "Uint", hWnd, "Uint", hDC_TT)

   if (flag)
   {
      HelpTip = Magnify
      HelpTip = %HelpTip%`n  {Up} = magnify more
      HelpTip = %HelpTip%`n  {Down} = magnify less
      HelpTip = %HelpTip%`n  {Left} = reduce viewer size
      HelpTip = %HelpTip%`n  {Right} = increase viewer size
      ToolTip, %HelpTip%
      While flag
      {
      }
      Goto RunIt
   }
   else
      WinClose, ahk_id %hWnd%
}

Up::
   nZ += 1
   nW := A_ScreenWidth // vW //2//nZ
   nH := A_ScreenHeight// (2 * vW) //2//nZ
Return

Down::
   nZ := ( (nZ = 1) ? (nZ) : (nZ - 1) )
   nW := A_ScreenWidth // vW //2//nZ
   nH := A_ScreenHeight// (2 * vW) //2//nZ
Return

Left::
   vW := ( (vW = 10) ? (vW) : (vW + 1) )
   nW := A_ScreenWidth // vW //3//nZ
   nH := A_ScreenHeight// (2 * vW) //2//nZ
Return

Right::
   vW := ( (vW = 1) ? (vW) : (vW - 1) )
   nW := A_ScreenWidth // vW //2//nZ
   nH := A_ScreenHeight// (2 * vW) //2//nZ
Return

F1::
   flag := ( (flag) ? (False) : (True) )
Return

Cursor(hDC, xCenter, yCenter)
{
   VarSetCapacity(mi, 20, 0)
   mi := Chr(20)
   DllCall("GetCursorInfo", "Uint", &mi)

   ptr := &mi + 4
   bShow   := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
   hCursor := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24

   DllCall("GetIconInfo", "Uint", hCursor, "Uint", &mi)

   ptr := &mi + 4
   xHotspot := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
   yHotspot := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
   hBMMask  := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
   hBMColor := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24

   DllCall("DeleteObject", "Uint", hBMMask)
   DllCall("DeleteObject", "Uint", hBMColor)

   If bShow
   DllCall("DrawIcon", "Uint", hDC, "int", xCenter - xHotspot, "int", yCenter - yHotspot, "Uint", hCursor)
}


Last edited by Relayer on August 26th, 2011, 5:21 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 25th, 2011, 10:06 pm 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
I'd normally recommend the Gdi+ library for something like this, but no reason to re-do it. The first line of the script you posted is "loop". It skips the # directives because they aren't code lines and just calls "SetWinDelay" until you close the script.

I'm not entirely sure what it should do, but I get a little icon on my screen that changes when I move my mouse around.

Quote:
Work is moving from XP to 7
I'd prefer they switched to Linux, but 7 is definitely better than XP. It's good news to me that businesses are upgrading operating systems (or at least your's).

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 26th, 2011, 5:23 pm 
Offline

Joined: November 24th, 2008, 7:22 pm
Posts: 73
Frankie,

Thanks for the reply. I'm sorry about the typo. The "loop" got left behind in some cut & paste activity.

Relayer


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 26th, 2011, 5:44 pm 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
I tried the second one on this page. It's right after "or with less gui, my current favorite."

It works on Window 7 with AutoHotkey Basic. I use x64 but that shouldn't matter because basic runs in 32 bit mode.

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 26th, 2011, 6:37 pm 
Offline

Joined: November 24th, 2008, 7:22 pm
Posts: 73
Frankie,

Thank you. That version also works on my win7. I'm going to look at the scripts side by side and see if I can tease out why my other one isn't working. It looks like it relies on the same DLL.

Relayer


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 26th, 2011, 11:02 pm 
Offline

Joined: November 24th, 2008, 7:22 pm
Posts: 73
Good news! I have gotten all the magnification stuff working in win7. The script I was using employed a tooltip as the magnification window. Win7 didn't like that so I modified it to use a GUI like in the script Frankie pointed out.

My next challenge is getting the balloon tips in ColorPicker() working. They look great in XP but are just black blobs in 7.

Thanks for the help.
Relayer


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 3 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