AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting Display setting from computer with AHK???
Goto page Previous  1, 2
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
newpie



Joined: 16 Nov 2007
Posts: 135

PostPosted: Mon Nov 19, 2007 2:22 am    Post subject: Reply with quote

Hello, here is my first one, this is for the display setting #1.

Code:

f1::
ImageSearch,,, 0, 0, 1279, 799, C:\test.bmp
if ErrorLevel = 2
    Send, !o
else if ErrorLevel = 1
    send, !o
else
   Send, {ALTDOWN}g{ALTUP}{TAB}{SPACE}{DOWN}{SPACE}!o
return



I would use the same code above, but different bmp file as follows for the second display setting.


Code:

ImageSearch,,, 0, 0, 1279, 799, C:\test2.bmp
if ErrorLevel = 2
    Send, !o
else if ErrorLevel = 1
    send, !o
else
   Send, {ALTDOWN}g{ALTUP}{TAB}{SPACE}{DOWN}{SPACE}!o
return


Hope this helps a tad.
Back to top
View user's profile Send private message
newpie



Joined: 16 Nov 2007
Posts: 135

PostPosted: Mon Nov 19, 2007 2:49 am    Post subject: Reply with quote

I forgot to mention that I am running script on JAVA that I have to mouseclick the coordinates so this is another reason why I created two different scripts for different screen displays.

An example:

Code:

f1::
    Send, {ENTER}{TAB 11}{RIGHT 6}^c
    sleep, 2000
    MouseClick, left,  1200,  455
    return


Thanks
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Mon Nov 19, 2007 4:31 pm    Post subject: Reply with quote

Code:

F1::
If A_ScreenWidth = 1600
  Image = C:\test.bmp
else If A_ScreenWidth = 1680
  Image = C:\test2.bmp
else
{
  Msgbox bad resolution
  Return
}

ImageSearch,,, 0, 0, 1279, 799, %Image%
if ErrorLevel
    Send, !o
else
   Send, !g{TAB} {DOWN} !o
return

_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
newpie



Joined: 16 Nov 2007
Posts: 135

PostPosted: Tue Nov 20, 2007 3:01 am    Post subject: Reply with quote

Thanks engunneer, that is very thoughtful script that is very efficient. I hope you have a good day.
Back to top
View user's profile Send private message
newpie



Joined: 16 Nov 2007
Posts: 135

PostPosted: Tue Nov 20, 2007 3:59 am    Post subject: Reply with quote

Engunneer, can I do the same thing wih coordinates, I tried a couple of times, but keep getting it wrong. Here is what I have so far:

Code:

If A_ScreenWidth = 1600
  Coord = 400,  500
else If A_ScreenWidth = 1680
  Coord = 500,  500
else
{
  Msgbox bad resolution,please choose 1600x900 or 1680x450
  Return
}

    run, notepad
    sleep, 500
    MouseClick,left, %Coord%
    send, Hello

return
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Tue Nov 20, 2007 5:23 am    Post subject: Reply with quote

use two seperate variables for x and y coords. you can't combine them so easily.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
newpie



Joined: 16 Nov 2007
Posts: 135

PostPosted: Tue Nov 20, 2007 11:43 pm    Post subject: Reply with quote

Modified script, works wonderfully.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group