Monday, June 15, 2015

AutoHotkey - Some simple tips.


Say you want to perform series of sequential clicks. The best way to do this with repetition is to store all the co-ordinates in an object, then use a for loop to perform those clicks.

The example below, moves the mouse pointer to the co-ordinates I defined in the Point object (you ca n name it anything you wish).

Point :=   Object(138,168,485,690,733,240)

For x, y in Point
{
  Sleep 2000 ;its too fast
  MouseMove, %x%, %y%
}

MsgBox, The script ended...thanks.

I think the code is self explainatory.

Using objects and properties.

ProfileList := {}
 ProfileCount = 2 

 Loop, % ProfileCount 
   ProfileList[A_Index] := {} 

 ProfileList.1.Name := "MyName"
 ProfileList.1.Password := "MyPassword"
 ProfileList.1.Server := "TheServer" 

 ProfileList.2.Name := "AnotherName" 
ProfileList.2.Password := "AnotherPassword" 
ProfileList.2.Server := "AnotherServer" 

 for each, item in ProfileList 
    MsgBox, % "Name: " item.name "`nPassword: " item.Password "`nServer: " item.server
 }

No comments :