push key, then click somewhere on the screen

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
MikeTB78
Newbie
Posts: 3
Joined: Wed Jun 15, 2011 4:14 pm

push key, then click somewhere on the screen

Post by MikeTB78 » Wed Feb 01, 2012 9:59 am

hi,

I want to make a macro when i click "1", my mouse click somewhere on my screen.
When i click "2", it clicks somewhere else and so on.

thx Mike

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Feb 01, 2012 2:59 pm

Here's one way

I remarked out the click part to prevent issues if someone were to copy and run this as-is.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Caption = 'Click Screen'
  ClientHeight = 65
  ClientWidth = 439
  object MSButton1: tMSButton
    Left = 12
    Top = 20
    Width = 75
    Height = 25
    Caption = 'Click 1'
  end
  object MSButton2: tMSButton
    Left = 96
    Top = 20
    Width = 75
    Height = 25
    Caption = 'Click 2'
  end
  object MSButton3: tMSButton
    Left = 180
    Top = 20
    Width = 75
    Height = 25
    Caption = 'Click 3'
  end
  object MSButton4: tMSButton
    Left = 264
    Top = 20
    Width = 75
    Height = 25
    Caption = 'Click 4'
  end
  object MSButton5: tMSButton
    Left = 348
    Top = 20
    Width = 75
    Height = 25
    Caption = 'Click 5'
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,MSButton1,OnClick,Click(100,100)
AddDialogHandler>Dialog1,MSButton2,OnClick,Click(200,200)
AddDialogHandler>Dialog1,MSButton3,OnClick,Click(300,300)
AddDialogHandler>Dialog1,MSButton4,OnClick,Click(400,400)
AddDialogHandler>Dialog1,MSButton5,OnClick,Click(500,500)

Show>Dialog1,

SRT>Click
  GetCursorPos>CurX,CurY
  MouseMove>Click_var_1,Click_var_2
  //LClick
  //MouseMove>CurX,CurY
END>Click

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts