Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

323
Vistas
How to spread a variable in AutoHotkey?

In JavaScript, we use the spread operator to spread an array of items, e.g.

const arr = [1, 2, 3]

console.log(...arr) // 1 2 3

And I want to achieve a similar effect in AHK:

Position := [A_ScreenWidth / 2, A_ScreenHeight]

MouseMove Position ; 👈 how to spread it?
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

AFAIK, there's no spread syntax in AHK, but there are some alternatives:

For big arrays you can use:

position := [A_ScreenWidth / 2, A_ScreenHeight]
Loop,% position.Count()
    MsgBox % position[A_Index] ; show a message box with the content of any value

or

position := [A_ScreenWidth / 2, A_ScreenHeight]
For index, value in position
    MsgBox % value ; show a message box with the content of any value

In your example, can be:

position := [A_ScreenWidth / 2, A_ScreenHeight]
MouseMove, position[1], position[2]

This will move your mouse to the bottom middle of your screen.

To avoid decimals, you may use Floor(), Round(), Ceil() functions for example, like:

position := [ Floor( A_ScreenWidth / 2 ), Round( A_ScreenHeight ) ]
Loop,% position.Count()
    MsgBox % position[A_Index] ; show a message box with the content of any value
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda