Imagen que representa botones que funcionen como botones activos. Topic is solved

Esta sección es para preguntas sobre programación/scripting usando AutoHotkey.

Moderator: Flipeador

rx65m
Posts: 19
Joined: 16 Mar 2018, 17:29

Imagen que representa botones que funcionen como botones activos.

09 Apr 2021, 12:26

Saludos muy afectuosos.
Tengo esta imagen representando una serie de botones que quisiera usar como botones activos.
Necesito que al clicar en en estos aparentes botones, se abra un diferente script de AutoHotkey, desde cada "botón".

He intentado durante un par de semanas desde diferentes enfoques pero no consigo hacer nada que sea funcional.
Aunque recuerdo haber visto en el foro antiguo algo muy parecido en inglés, no he logrado encontrarlo tampoco.

Agradeceré toda la ayuda que puedan darme.
Gracias anticipadas!
Rex
botones.png
botones.png (11.21 KiB) Viewed 727 times
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Imagen que representa botones que funcionen como botones activos.

09 Apr 2021, 14:40

example

Code: Select all

;-- Example GUI with Buttons to Start URL/Program -----------
#warn
#NoEnv
name1=TEST
setworkingdir,%a_scriptdir%
Gui,2:default
Gui,2: -DPIScale
transform,s,chr,127
WA:=A_screenwidth,HA:=A_screenheight,xx:=100
;Gui,2:Color,C8D0D4,Black                  ;-gray
Gui,2:Color,Black,Black
;- maybe change fontsize
;============ GUISIZEx DPIx 4Kx 3840*2160 is 100% ============
if (wa=3840)
 Gui,2:Font,s12 cBlack,Lucida Console
;============ GUISIZEx DPIx FHD 1920*1080 is 100% ============
else if (wa=1920)
 Gui,2:Font,s10 cBlack,Lucida Console
else
 Gui,2:Font,s7 cBlack,Lucida Console
;=============================================================
;--------------------
cx:=""
ck:=""
sectx=   
(Ltrim comments Join`r`n % 
Autohotkey;https://www.autohotkey.com/
YT_Rotterdam2Amsterdam;https://www.youtube.com/watch?v=HfPCdJapIXA
YT_Offenbach_Barcarole;https://www.youtube.com/watch?v=R-MbbebSQjQ&t=91
NL_Rijkswaterstaat;https://www.youtube.com/channel/UCOESCgenMD6CMDiiHe-iG-g
NL_Archive_1;https://www.youtube.com/channel/UC3Xw6AMOJIiUJ0cNHB7CdIg
NL_Archive_2;https://basromeijnfilms.blogspot.com/
British_pathe;https://www.youtube.com/channel/UCGp4u0WHLsK8OAxnvwiTyhA
BBC_Archive;https://www.bbc.co.uk/archive/
LA_CAMERA_STYLO;https://www.youtube.com/channel/UCxT4JLBXafKV7dCafIceCUg/videos  ;- Film collection
News_Portugal;https://news.google.com/topstories?hl=pt-PT&gl=PT&ceid=PT:pt-150
Weather_Portugal;https://www.timeanddate.com/weather/portugal/lisbon
Hurrican;https://www.accuweather.com/en/hurricane/tracker
Typhoon;https://www.metoc.navy.mil/jtwc/jtwc.html
Wind_Asia;https://earth.nullschool.net/#current/wind/surface/level/orthographic=123.04,23.45,1821/loc=124.879,13.692
FeedReader;https://news.feed-reader.net/
News_Philippines;https://news.feed-reader.net/870-philippinen.html
Euronews;https://de.euronews.com/bulletin
Charmap;charmap
)
;---------------------
loop,parse,sectx,`n,`r
  {
  x:=a_loopfield
  if x=
     break
  stringsplit,k,x,`;
  cx .= k1 . s
  ck .= k2 . s
  }
stringsplit,m,ck,%s%
stringsplit,q,cx,%s%
totx:=(q0-1)
x:=(wa*1)/xx,y:=(ha*2)/xx,w :=(wa*13 )/xx,h:=(ha*2.5)/xx,v:=(ha*.5)/xx
Gui,2:add,text,section x%x% y%y% w0 h0,
i=0
Loop,%totx%
  {
  i++
  if (i=10)
    {
    x:=(wa*15)/xx
    Gui,2:add,text,section x%x% y%y% w0 h0,
    }
  BTName:= q%i%
  Gui,2: Add, Button, xs   y+%v% w%w%  h%h% gStart1 v%btname%_%i% ,%btname%
  }
x:=(wa*1)/xx,y:=(ha*1)/xx,w:=(wa*30)/xx,h:=(ha*30)/xx
Gui,2:Show, x%x% y%y% h%h% w%w%,%name1%
return
;-------------------------------------------------------------------------
2Guiclose:
exitapp
;-------------------------------------------------------------------------
;--------------- start --------------------------
start1:
gui,2:submit,nohide
Mousegetpos,,,,Ctrl       ;- Button1
r:= a_guicontrol          ;- vVar ( Buttonname )
stringtrimleft,ct,ctrl,6  ;- Button-(1)
url:= m%ct%
;msgbox, 262208, ,R=%r%`nCT=%ct%`nCTRL=%ctrl%`nURL=%url%
try
 run,%url%
return
;=================== END SCRIPT =============================================
rx65m
Posts: 19
Joined: 16 Mar 2018, 17:29

Re: Imagen que representa botones que funcionen como botones activos.

10 Apr 2021, 03:32

Thank you very much @garry!
I appreciate a lot your kindness this code is extremely detailed!
Unfortunately it is about a regular GUI with actual buttons which is exactly what I don't want to use.
My wish is to use the image I posted before, in a way that once I click on each of those apparent buttons a different ahk script gets activated, without any actual GUI or actual buttons.
I remember a post teaching this from the old Board, but I can not find it anymore.
Do you have any suggestion similar to what I'm looking for?
Thanks for now.
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Imagen que representa botones que funcionen como botones activos.  Topic is solved

10 Apr 2021, 07:47

what's possible , example , the original picture is in a GUI , click on picture-button , do something

Code: Select all

;- Imagen que representa botones que funcionen como botones activos. 
;- https://www.autohotkey.com/boards/viewtopic.php?f=40&t=89165
;- 
;- modified= 20210410
;- created = 20210410

#warn
setworkingdir,%a_scriptdir%
CoordMode, Mouse , Relative
wa:=A_screenwidth,ha:=A_screenHeight,xx:=100  ;- 4k= 3840*2160
;msgbox,%wa%*%ha%

filename1=TEST CLICK PICTURE-BUTTON
pic01=%a_scriptdir%\botones.png
url=https://www.autohotkey.com/boards/download/file.php?id=12779
ifnotexist,%pic01%
  urldownloadtofile,%url%,%pic01%
;---------------------------------------------
Gui,3:default
Gui,3: -DPIScale -Caption +AlwaysOnTop
SS_REALSIZECONTROL := 0x40
gui,3:color,black,black
x:=(wa*.3)/xx,y:=(ha*.3)/xx,w:=(wa*35)/xx,h:=(ha*40)/xx
Gui,3:add,Picture, x%x% y%y% w%w% h%h% gDnlX ,%pic01%
Gui,3:show,x0 y0,%filename1%
return
;----------------------------------------------
esc::exitapp
;----------------------------------------------
3Guiclose:
exitapp
;----------------------------------------------
DNLx:
mousegetpos,x,y,,CL
;-----------------
wdf:=(wa*4.58)/xx
hdf:=(ha*7.40)/xx
;-----------------
y11:=(ha* 2.6 )/xx
y12:=(ha*11.8 )/xx
y13:=(ha*20.70)/xx
y14:=(ha*29.8)/xx
;-----------------
x11:=(wa* 1.35)/xx
x12:=(wa* 6.87)/xx
x13:=(wa*12.34)/xx
x14:=(wa*17.89)/xx
x15:=(wa*23.43)/xx
x16:=(wa*28.90)/xx
;------------------
if (CL = "Static1")
  {
  if (x>x11) and x<(x11+wdf) and (y>y11) and y<(y11+hdf)
    msgbox, 262208, ,Button-1,2
  if (x>x12) and x<(x12+wdf) and (y>y11) and y<(y11+hdf)
    msgbox, 262208, ,Button-2,2
  if (x>x13) and x<(x13+wdf) and (y>y11) and y<(y11+hdf)
    msgbox, 262208, ,Button-3,2
  if (x>x14) and x<(x14+wdf) and (y>y11) and y<(y11+hdf)
    msgbox, 262208, ,Button-4,2
  if (x>x15) and x<(x15+wdf) and (y>y11) and y<(y11+hdf)
    msgbox, 262208, ,Button-5,2
  if (x>x16) and x<(x16+wdf) and (y>y11) and y<(y11+hdf)
    msgbox, 262208, ,Button-UP,2
  ;-------
  if (x>x11) and x<(x11+wdf) and (y>y12) and y<(y12+hdf)
    msgbox, 262208, ,Button-6,2
  if (x>x12) and x<(x12+wdf) and (y>y12) and y<(y12+hdf)
    msgbox, 262208, ,Button-7,2
  if (x>x13) and x<(x13+wdf) and (y>y12) and y<(y12+hdf)
    msgbox, 262208, ,Button-8,2
  if (x>x14) and x<(x14+wdf) and (y>y12) and y<(y12+hdf)
    msgbox, 262208, ,Button-9,2
  if (x>x15) and x<(x15+wdf) and (y>y12) and y<(y12+hdf)
    msgbox, 262208, ,Button-10,2
  ;--------
  if (x>x11) and x<(x11+wdf) and (y>y13) and y<(y13+hdf)
    msgbox, 262208, ,Button-11,2
  if (x>x12) and x<(x12+wdf) and (y>y13) and y<(y13+hdf)
    msgbox, 262208, ,Button-12,2
  if (x>x13) and x<(x13+wdf) and (y>y13) and y<(y13+hdf)
    msgbox, 262208, ,Button-13,2
  if (x>x14) and x<(x14+wdf) and (y>y13) and y<(y13+hdf)
    msgbox, 262208, ,Button-14,2
  if (x>x15) and x<(x15+wdf) and (y>y13) and y<(y13+hdf)
    msgbox, 262208, ,Button-15,2
  ;--------
  if (x>x11) and x<(x11+wdf) and (y>y14) and y<(y14+hdf)
    msgbox, 262208, ,Button-16,2
  if (x>x12) and x<(x12+wdf) and (y>y14) and y<(y14+hdf)
    msgbox, 262208, ,Button-17,2
  if (x>x13) and x<(x13+wdf) and (y>y14) and y<(y14+hdf)
    msgbox, 262208, ,Button-18,2
  if (x>x14) and x<(x14+wdf) and (y>y14) and y<(y14+hdf)
    msgbox, 262208, ,Button-19,2
  if (x>x15) and x<(x15+wdf) and (y>y14) and y<(y14+hdf)
    msgbox, 262208, ,Button-20,2
  if (x>x16) and x<(x16+wdf) and (y>y14) and y<(y14+hdf)
    msgbox, 262208, ,Button-DOWN,2
  }
return
;================= END SCRIPT =============================

Return to “Pedir Ayuda”

Who is online

Users browsing this forum: No registered users and 52 guests