Jump to content
Macro Express Forums

Click & Drag - does it work?


Recommended Posts

I'm not sure if this is what you mean -- but the code below works on a weather map web site to drag the map down and to the left:

 

      Mouse Move: 600, 200 Relative to Screen // Drag full screen down a bit
      Mouse Left Button Down
        Mouse Move: -100, 375 Relative to Last Position
      Mouse Left Button Up

 

Link to comment
Share on other sites

Or maybe this?  These commands sweep the mouse over a section of text to highlight it, so it can then be deleted, copied to clipboard, or dragged to a new location.

 

  Mouse Move: 649, 215 Relative to Screen
  Mouse Left Button Down
   Mouse Move: -141, 0 Relative to Last Position
  Mouse Left Button Up

 

Link to comment
Share on other sites

1. Move the mouse to the starting position.

2. Activate the following script.

3. Move the mouse to the ending position.

4. Wait ten seconds... or to make the magic happen sooner, press Esc...

 

The macro drags whatever is under the mouse at the starting position to the the ending position.

 

Variable Set Integer %DwellPeriod% to 5 // Dwell time (seconds)
Variable Set Integer %WiggleDistance% to 4 // Wiggle distance (pixels)
Variable Set Integer %WiggleDelay% to 20 // Wiggle delay (milliseconds)
 
Variable Set Integer %StartX%: Set to the Mouse X Coordinate // Get starting coordinates
Variable Set Integer %StartY%: Set to the Mouse Y Coordinate
 
Repeat Start (Repeat 5 times) // Signal activity by wiggling the mouse pointer...
  Mouse Move: %WiggleDistance%, 0 Relative to Last Position
  Delay: %WiggleDelay% milliseconds
  Mouse Move: 0, %WiggleDistance% Relative to Last Position
  Delay: %WiggleDelay% milliseconds
  Mouse Move: -%WiggleDistance%, 0 Relative to Last Position
  Delay: %WiggleDelay% milliseconds
  Mouse Move: 0, -%WiggleDistance% Relative to Last Position
  Delay: %WiggleDelay% milliseconds
End Repeat
 
Wait for Key Press: ESC
 
Variable Set Integer %EndX%: Set to the Mouse X Coordinate // Get ending coordinates
Variable Set Integer %EndY%: Set to the Mouse Y Coordinate
 
If Variable %StartX% Does not Equal "%EndX%" // If mouse pointer has been moved...
  OR
If Variable %StartY% Does not Equal "%EndY%"
  Mouse Move: %StartX%, %StartY% Relative to Screen
  Mouse Left Button Down
    Mouse Move: %EndX%, %EndY% Relative to Screen
    Delay: 500 milliseconds
  Mouse Left Button Up
Else
  Beep
  Text Box Display: Timed out!
  Delay: 3 seconds
End If

<VARIABLE SET INTEGER Option="\x00" Destination="%DwellPeriod%" Value="5" _COMMENT="Dwell time (seconds)"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%WiggleDistance%" Value="4" _COMMENT="Wiggle distance (pixels)"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%WiggleDelay%" Value="20" _COMMENT="Wiggle delay (milliseconds)"/>
<COMMENT _BACK="0080FFFF"/>
<VARIABLE SET INTEGER Option="\x02" Destination="%StartX%" _COMMENT="Get starting coordinates"/>
<VARIABLE SET INTEGER Option="\x03" Destination="%StartY%"/>
<COMMENT _BACK="0080FFFF"/>
<REPEAT START Start="1" Step="1" Count="5" Save="FALSE" _COMMENT="Signal activity by wiggling the mouse pointer..."/>
<MOUSE MOVE Option="\x03" X="%WiggleDistance%" Y="0" _PROMPT="0x000A"/>
<DELAY Flags="\x02" Time="%WiggleDelay%"/>
<MOUSE MOVE Option="\x03" X="0" Y="%WiggleDistance%" _PROMPT="0x000A"/>
<DELAY Flags="\x02" Time="%WiggleDelay%"/>
<MOUSE MOVE Option="\x03" X="-%WiggleDistance%" Y="0" _PROMPT="0x000A"/>
<DELAY Flags="\x02" Time="%WiggleDelay%"/>
<MOUSE MOVE Option="\x03" X="0" Y="-%WiggleDistance%" _PROMPT="0x000A"/>
<DELAY Flags="\x02" Time="%WiggleDelay%"/>
<END REPEAT/>
<COMMENT _BACK="0080FFFF"/>
<WAIT FOR KEY PRESS Key="ESC" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="10" _HANDLE="0x0014"/>
<COMMENT _BACK="0080FFFF"/>
<VARIABLE SET INTEGER Option="\x02" Destination="%EndX%" _COMMENT="Get ending coordinates"/>
<VARIABLE SET INTEGER Option="\x03" Destination="%EndY%"/>
<COMMENT _BACK="0080FFFF"/>
<IF VARIABLE Variable="%StartX%" Condition="\x01" Value="%EndX%" IgnoreCase="FALSE" _COMMENT="If mouse pointer has been moved..."/>
<OR/>
<IF VARIABLE Variable="%StartY%" Condition="\x01" Value="%EndY%" IgnoreCase="FALSE"/>
<MOUSE MOVE Option="\x01" X="%StartX%" Y="%StartY%" _PROMPT="0x000A"/>
<MOUSE LEFT BUTTON DOWN/>
<MOUSE MOVE Option="\x01" X="%EndX%" Y="%EndY%" _PROMPT="0x000A"/>
<DELAY Flags="\x02" Time="500"/>
<MOUSE LEFT BUTTON UP/>
<ELSE/>
<BEEP/>
<TEXT BOX DISPLAY Title="Timed out!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang4105{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 \r\n\\par }\r\n" Left="7" Top="1" Width="114" Height="29" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x01" Delay="3"/>
<DELAY Flags="\x01" Time="3"/>
<END IF/>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...