Combobox varias imagens

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Combobox varias imagens

Re: Combobox varias imagens

Post by garry » 06 Mar 2023, 16:01

exemplo com 4 imagens

Code: Select all

#Warn
#SingleInstance,Force
transform,s,chr,31
setworkingdir, %a_scriptdir%
wa:=A_screenwidth,ha:=A_screenHeight
CoordMode,Pixel,Screen
CoordMode,Mouse,Screen
;-
gosub,a2
;-
gui,2:new, +alwaysontop
Gui,2:Font,s14 cYellow ,Lucida console
Gui,2:Color,Gray,Black
Gui,2:Add, Tab3,  x2 y0  w380 h280  , MAIN|test|
Gui,2:Tab, Main
Gui,2:add,Edit , x10 y50 w380 h30 -vscroll vED1 readonly
gui,2:add, combobox,  x7 y100 w200 vCB  gA1, %s%|Russia|Germany|China|France
Gui,2:add, text,x0 y0 vT1
gui,2:show,x500 y100 w400 h300 ,ImageSearch
Guicontrol,2:Choosestring,cb,France    ;- preselect
;Guicontrol,2:choose,cb,1
GuiControl,2: Focus,T1                 ;- remove focus from CB
return
;-----------
2Guiclose:
exitapp
;------------
;---------
A1:
Gui,2:submit,nohide
;msgbox, 262208,CB ,%cb%
;---------------
if (cb="Russia")
  {
  path=%f1%
  picx=%name1%
  }
if (cb="Germany")
  {
  path=%f2%
  picx=%name2%
  }
if (cb="China")
  {
  path=%f3%
  picx=%name3%
  }
if (cb="France")
  {
  path=%f4%
  picx=%name4%
  }
GuiControl,2: Focus,T1  
GuiControl,2:,ED1,Search for %picx% ...
sleep,400  
;------------------------------------------------  
ImageSearch,xf,yf,0,0,%wa%,%ha%,*transblack %path% 
GuiControl,2:,ED1,
if errorlevel=1
  {
  msgbox, 262208, ,Error`n,3
  return
  }
else if errorlevel=2
  {
  msgbox, 262208, ,Picture %picx% not found`n,3
  return
  }
;-----------------------  
MouseMove,%xf%,%yf%,
  {
  ToolTip,Here flag %picx%
  sleep,2000
  tooltip
  }
return
;--------------------------------------------------------------
A2:
ur1=https://autohotkey.com/boards/images/flags/russia.png
SplitPath,ur1, name1, dir1, ext, name_no_ext, drive
f1 :=a_desktop . "\" . name1
;--
ur2=https://autohotkey.com/boards/images/flags/germany.png
SplitPath,ur2, name2, dir2, ext, name_no_ext, drive
f2 :=a_desktop . "\" . name2
;--
ur3=https://autohotkey.com/boards/images/flags/china.png
SplitPath,ur3, name3, dir3, ext, name_no_ext, drive
f3 :=a_desktop . "\" . name3
;--
ur4=https://autohotkey.com/boards/images/flags/france.png
SplitPath,ur4, name4, dir4, ext, name_no_ext, drive
f4 :=a_desktop . "\" . name4
;--
ifnotexist,%f1%
  urldownloadtofile,%ur1%,%f1%
ifnotexist,%f2%
  urldownloadtofile,%ur2%,%f2%
ifnotexist,%f3%
  urldownloadtofile,%ur3%,%f3%
ifnotexist,%f4%
  urldownloadtofile,%ur4%,%f4%
return
;==============================================================

Combobox varias imagens

Post by Maverick » 28 Feb 2023, 11:06

como faço pra adicionar na gui do script um combobox com varias imagens pra usar no meu ImageSearch? tipo imagem1, imagem2, imagem3 e assim por diante cada uma delas fazendo ligação com as imagens .png que estão na pasta.

Code: Select all

ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, %a_scriptdir%\imagem1.png
tem 10 imagens diferentes e a função vai procurar pela imagem selecionada no combobox, alguem pode me ajudar?

Top