Jump to content
Sign in to follow this  
Hotwc

How to Change the Location of a Script

Recommended Posts

Hotwc

This is a Script someone wrote to create a crosshair on your screen:

HotKeySet("{ESC}","Quit"); Press ESC to quit

Global $CENTER_X = Int(@DesktopWidth/2)

Global $CENTER_Y = Int(@DesktopHeight/2)

$REFRESH = InputBox("DrawLines","Refresh time","5")

While 1

DrawLines()

Sleep(GUICtrlRead($REFRESH*1000))

WEnd

Func DrawLines()

$DC = DllCall ("user32.dll", "int", "GetDC", "hwnd", "")

For $INDEX = $Center_X - 25 To $CENTER_X + 25

DrawPixel($DC,$INDEX,$CENTER_Y,0x000000)

Next

For $INDEX = $CENTER_Y - 25 To $CENTER_Y + 25

DrawPixel($DC,$CENTER_X,$INDEX,0x000000)

Next

EndFunc

Func DrawPixel($hDC,$X,$Y,$COLOR)

DllCall ("gdi32.dll", "long", "SetPixel", "long", $hDC[0], "long", $X, "long", $Y, "long", $COLOR)

EndFunc

Func Quit()

Exit

EndFunc

How would I modify the location of this, for Example, I want to move the crosshair up

Edited by Hotwc

Share this post


Link to post
Share on other sites
dantay9

Change $Center_X and $Center_Y.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
Hotwc

I figured that, but what options do I have to Change it?

Like what would I replace $Center_X with?

Edited by Hotwc

Share this post


Link to post
Share on other sites
eEniquEe

I figured that, but what options do I have to Change it?

Like what would I replace $Center_X with?

With anything you want. It's up to your imagination. $CENTER_X, and $CENTER_Y are simply just the (x, y)-coordinate of the "crosshair".

The following script will move the "crosshair" from middle of the screen to the left after the given amount of time.

HotKeySet("{ESC}","Quit"); Press ESC to quit
Global $CENTER_X = Int(@DesktopWidth/2)
Global $CENTER_Y = Int(@DesktopHeight/2)
$REFRESH = InputBox("DrawLines","Refresh time","5")
While 1
DrawLines()
Sleep(GUICtrlRead($REFRESH*1000))
$CENTER_X -= 1 ;new line added
WEnd

Func DrawLines()
$DC = DllCall ("user32.dll", "int", "GetDC", "hwnd", "")
For $INDEX = $Center_X - 25 To $CENTER_X + 25
DrawPixel($DC,$INDEX,$CENTER_Y,0x000000)
Next
For $INDEX = $CENTER_Y - 25 To $CENTER_Y + 25
DrawPixel($DC,$CENTER_X,$INDEX,0x000000)
Next
EndFunc

Func DrawPixel($hDC,$X,$Y,$COLOR)
DllCall ("gdi32.dll", "long", "SetPixel", "long", $hDC[0], "long", $X, "long", $Y, "long", $COLOR)
EndFunc

Func Quit()
Exit
EndFunc

Share this post


Link to post
Share on other sites
Hotwc

With anything you want. It's up to your imagination. $CENTER_X, and $CENTER_Y are simply just the (x, y)-coordinate of the "crosshair".

The following script will move the "crosshair" from middle of the screen to the left after the given amount of time.

HotKeySet("{ESC}","Quit"); Press ESC to quit
Global $CENTER_X = Int(@DesktopWidth/2)
Global $CENTER_Y = Int(@DesktopHeight/2)
$REFRESH = InputBox("DrawLines","Refresh time","5")
While 1
DrawLines()
Sleep(GUICtrlRead($REFRESH*1000))
$CENTER_X -= 1 ;new line added
WEnd

Func DrawLines()
$DC = DllCall ("user32.dll", "int", "GetDC", "hwnd", "")
For $INDEX = $Center_X - 25 To $CENTER_X + 25
DrawPixel($DC,$INDEX,$CENTER_Y,0x000000)
Next
For $INDEX = $CENTER_Y - 25 To $CENTER_Y + 25
DrawPixel($DC,$CENTER_X,$INDEX,0x000000)
Next
EndFunc

Func DrawPixel($hDC,$X,$Y,$COLOR)
DllCall ("gdi32.dll", "long", "SetPixel", "long", $hDC[0], "long", $X, "long", $Y, "long", $COLOR)
EndFunc

Func Quit()
Exit
EndFunc

What you modified broke the script, it make multiple crosshairs

How do I define where the Origin is

Share this post


Link to post
Share on other sites
Hotwc

Anyone can help?

Share this post


Link to post
Share on other sites
hot202

this dont work anyway it dont go ontop of a game screen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×