Welcome to Chaox.us
Diablo 2 LOD Battle.net US East Ladder Channel: Clan ChX
Don't forget to favorite www.Chaox.us
 
Clan ChxClan Chx  HomeHome  Log inLog in  RegisterRegister  

Share | 
 

 My first real program!

View previous topic View next topic Go down 
AuthorMessage
Kyle
Administrator
Administrator
avatar

Posts : 3709
Registered : 2007-10-03

Nick-Name : Kyle/Kail

PostSubject: My first real program!   3/26/2013, 11:11 am

I've made some bots n shit, small stuff (Though the coding was not small in the least...) But this is a real program, made it to automatically switch between my displays (Gfx card only supports 2 monitors, so it's either monitor + tv or dual monitor)

Still has a lot of cleaning up to do, and a few more things to add (Just for convenience, right now it does exactly what I need it to)

Code:
HotKeySet("{End}", "Terminate")
HotKeySet("{f1}", "Move")
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <ImageSearch.Au3>
Opt("GUIOnEventMode", 1)
Opt("SendKeyDownDelay", 50)
#Region ### START Koda GUI section ### Form=C:\Users\Kyle\Desktop\Koda\Forms\Form1.kxf
$Monitors = GUICreate("Monitors", 211, 76, -1739, 112)
$Tv = GUICtrlCreateButton("Tv", 8, 24, 81, 25)
$Dual = GUICtrlCreateButton("Dual", 120, 24, 81, 25)
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")
#EndRegion ### END Koda GUI section ###
GUICtrlSetOnEvent($Tv, "TvButton")
GUICtrlSetOnEvent($Dual, "DualButton")
$x = 0
$y = 0
$d = "{LWin} {D Down}"
$u = "{D UP} {LWin Up}"
$click = 0

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         Exit
   EndSwitch
WEnd

Func Move()
  $pos = WinGetPos("Monitors")
If $pos[0] <> 0 and $pos[1] <> 0 Then
  WinMove("Monitors","",300,500)
  Sleep(100)
EndIf
EndFunc

Func TvButton()
 
  WinMinimizeAll()
  Sleep(250)
  MouseClick("Left",0,0,1,0)
  Sleep(250)
 
  MouseClick("Right",900,500,1,0)
  Sleep(250)
  Do
  $Search = _ImageSearch("nvidia.bmp",0,$x,$y,50)
  If $Search = 1 Then
     MouseClick("Left",$x+20,$y,1,0)
     Sleep(250)
  EndIf
  Until $Search = 1

  $pos = WinGetPos("NVIDIA")
  If $pos[0] <> 0 and $pos[1] <> 0 Then
     WinMove("NVIDIA","",350,125)
     Sleep(100)
  EndIf

  Do
     $Search = _ImageSearch("sony.bmp",0,$x,$y,10)
     If $Search = 1 Then
       MouseClick("Left",$x,$y-20,1,0)
       Sleep(250)
       MouseClick("Left",$x,$y,1,0)
       Sleep(250)
     EndIf
  Until $Search = 1
 
  Do
  $Search = _ImageSearch("apply.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x,$y,1,0)
     Sleep(250)
  EndIf
  Until $Search = 1
 
  Do
  $Search = _ImageSearch("yes.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x,$y,1,0)
     Sleep(250)
  Else
     MouseMove(0,0,0)
  EndIf
  Until $Search = 1

  MouseClick("Right",900,0,1,0)
  Sleep(250)
  Do
  $Search = _ImageSearch("screen.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x,$y,1,0)
     Sleep(1000)
  Else
     MouseClick("Right",900,0,1,0)
  EndIf
  Until $Search = 1

  $pos = WinGetPos("Screen")
  If $pos[0] <> 170 and $pos[1] <> 112 Then
     WinMove("Screen","",170,112)
     Sleep(250)
  EndIf

Local $size = WinGetPos("Screen")

  $Search = _ImageSearch("extend.bmp",0,$x,$y,10)
  If $Search = 1 Then
  MouseClick("Left",$x,$y,1,0)
  Sleep(500)
  MouseClick("Left",$x,$y+37,1,0)
  Sleep(250)
  EndIf
 
  Do
  $Search = _ImageSearch("keep.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x,$y,1,0)
     Sleep(250)
  Else
     ControlClick("Screen","&Apply","[Class:Button;Instance:6]","Left",1)
  EndIf
  Until $Search = 1

If ProcessExists("nvcplui.exe") Then
    ProcessClose("nvcplui.exe")
   WinClose("Screen")
EndIf

WinMinimizeAll()

Send("{ALT DOWN}")
Send("{TAB}")
Send("{ALT UP}")
Sleep(750)
WinSetState("","",@SW_MINIMIZE)

Do
Send("{LShift Down}")
MouseClick("Right",700,500,1)
Sleep(250)
Send("{LShift Up}")
MouseClick("Left",765,673,10)
Sleep(250)
$click += 1
Until $click = 2
WinMinimizeAllUndo()
Exit 0
EndFunc

Func DualButton()
 
  WinMinimizeAll()
  Sleep(250)
  MouseClick("Left",0,0,1,0)
  Sleep(250)
 
  MouseClick("Right",900,500,1,0)
  Sleep(250)
  Do
  $Search = _ImageSearch("nvidia.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x+20,$y,1,0)
     Sleep(500)
  EndIf
  Until $Search = 1

  $pos = WinGetPos("NVIDIA")
  If $pos[0] <> 0 and $pos[1] <> 0 Then
     WinMove("NVIDIA","",350,125)
     Sleep(100)
  EndIf

  Do
  $Search = _ImageSearch("dual.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x,$y,1,0)
     Sleep(250)
  EndIf
  Until $Search = 1
 
  Do
  $Search = _ImageSearch("prim.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x,$y,1,0)
     Sleep(500)
  Else
     ControLClick("NVIDIA","","[Class:AfxWnd100su; Instance:1]","Right",1)
     Sleep(250)
  EndIf
  Until $Search = 1
 
 
  Do
  $Search = _ImageSearch("apply.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x,$y,1,0)
     MouseMove(0,0,0)
     Sleep(250)
  EndIf
  Until $Search = 1
 
  Do
  $Search = _ImageSearch("yes.bmp",0,$x,$y,10)
  If $Search = 1 Then
     MouseClick("Left",$x,$y,1,0)
     Sleep(250)
  Else
     MouseMove(0,0,0)
  EndIf
  Until $Search = 1

If ProcessExists("nvcplui.exe") Then
    ProcessClose("nvcplui.exe")
EndIf

WinMinimizeAll()

Send("{ALT DOWN}")
Send("{TAB}")
Send("{ALT UP}")
Sleep(750)
WinSetState("","",@SW_MINIMIZE)

Do
Send("{LShift Down}")
MouseClick("Right",700,500,1)
Sleep(250)
Send("{LShift Up}")
MouseClick("Left",765,673,10)
Sleep(250)
$click += 1
Until $click = 2
WinMinimizeAllUndo()
Exit 0
EndFunc

Func Terminate()
  Exit 0
EndFunc

_________________

~I survived the 2012 apocalypse~
Back to top Go down
http://www.d2chaox.com
alabama-boy
V.I.P. Member
V.I.P. Member
avatar

Posts : 1597
Registered : 2007-07-28

Nick-Name : Derrick/Kevin

PostSubject: Re: My first real program!   3/26/2013, 8:04 pm

not quite sure what you're saying this program does
Back to top Go down
http://gamebattles.majorleaguegaming.com/profile/Ag3ntOrange4
Kyle
Administrator
Administrator
avatar

Posts : 3709
Registered : 2007-10-03

Nick-Name : Kyle/Kail

PostSubject: Re: My first real program!   3/26/2013, 8:22 pm

It sets my display to either duplicate display on tv and monitor or extend display between my 2 monitors

It's one or the other cause my gfx card only supports 2 displays

_________________

~I survived the 2012 apocalypse~
Back to top Go down
http://www.d2chaox.com
Sponsored content




PostSubject: Re: My first real program!   

Back to top Go down
 
My first real program!
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» someone is building a rhino.....for real!
» example of Basic turbo C program in PLC Programming
» "Refer a Friend" program on Taiwan Servers?
» DeAveiro Basketball Skills Development Program
» On cars, tracks and real life...

Permissions in this forum:You cannot reply to topics in this forum
Clan Chx :: Off Topic :: Random Chatting-
Jump to: