checkbox

Помощь в написании скриптов
Selestor
Posts: 2
Joined: 13 Aug 2023, 02:31

checkbox

13 Aug 2023, 02:34

Я в скрипте создал пару checkbox-ов. Как мне считать данные нажат ли checkbox? Я смотрел офф вики, там добавляеться парамет vCheckbox, но при нем я никак не могу настроить положение и оно сбрасываеться на стандартное

Code: Select all

Gui, Add, CheckBox, x12 y39 w90 h40 , CheckBox1
Gui, Add, CheckBox, x12 y79 w90 h20 , CheckBox2
Gui, Add, CheckBox, x12 y99 w90 h30 , CheckBox3
Selestor
Posts: 2
Joined: 13 Aug 2023, 02:31

Re: checkbox

13 Aug 2023, 04:29

Нашел решение, считал но теперь выдает ошибку что у меня стоит else без if, хотя if есть

Code: Select all

#SingleInstance force
tpcooldown = 5000
chatkey = {T}
sprintkey = {LShift}
usekey = {RButton}
Gui, Add, CheckBox, x12 y9 w90 h30 vKriger, Кригер
Gui, Add, Button, x182 y329 w90 h20 vStart, Старт
Gui, Show, w479 h375, Боссы
Start:
Sleep tpcooldown
GuiControlGet, CheckBoxState,, Kriger
if (CheckBoxState = 1)
    Send, %chatkey%
    Sleep 300
    SendPlay /boss 15{Enter}
    Sleep tpcooldown
    Sleep 3000
    Send, %sprintkey% down
    Send, %usekey% down
    Send, {W down}
    Sleep 2000
    Send, {W up}
else
    Reload
Image
garry
Posts: 3852
Joined: 22 Dec 2013, 12:50

Re: checkbox

13 Aug 2023, 13:00

также пример, запустите google или запустите программу

Code: Select all

;- Modified=20230813
;- Created =20140412
SplitPath,a_scriptname, name, dir, ext, name_no_ext, drive
F1=%a_scriptdir%\%name_no_ext%.ini
;-----------
I=12                 ;- total checkboxes
src=Владивосто́к      ;- search for preselect
;-----------
Gui,2: Color,Black, Black
Gui,2: Font, CDefault s14, Lucida Console
Loop,%i%
   {
   IniRead, Ch%A_Index%, %f1%, ss, Cb%A_Index% , 0
    If (Ch%A_Index% = 1)
       Cb%A_Index% = Checked
    Else
       Cb%A_Index% =
   }
Gui,2:  Show, x100 y5 w350 h500, %name_no_ext%
Gui,2: Add, Edit,      x20 y5  w315 h27 cWhite vSearch,%src%
Gui,2:  Add, CheckBox, x20 y40  vCh1  %cb1%   cYellow, Google
Gui,2:  Add, CheckBox, x20 y65  vCh2  %cb2%   cYellow, Google  I``m feeling lucky
Gui,2:  Add, CheckBox, x20 y90  vCh3  %cb3%   cYellow, Bing    Pictures
Gui,2:  Add, CheckBox, x20 y115 vCh4  %cb4%   cYellow, Flickr  Pictures
Gui,2:  Add, CheckBox, x20 y140 vCh5  %cb5%   cYellow, Google  Pictures
Gui,2:  Add, CheckBox, x20 y165 vCh6  %cb6%   cYellow, Google  SEARCH ru
Gui,2:  Add, CheckBox, x20 y190 vCh7  %cb7%   cYellow, Google  NEWS ru
Gui,2:  Add, CheckBox, x20 y215 vCh8  %cb8%   cYellow, Google  PDF
Gui,2:  Add, CheckBox, x20 y240 vCh9  %cb9%   cYellow, Google  Video
Gui,2:  Add, CheckBox, x20 y265 vCh10 %cb10%  cYellow, Youtube Video
Gui,2:  Add, CheckBox, x20 y290 vCh11 %cb11%  cYellow, Wikipedia
Gui,2:  Add, CheckBox, x20 y310 vCh12 %cb12%  cYellow, Charmap


Gui,2:  Add, CheckBox, x20 y400 vCh98 gCheckAll   cYellow, Select All
Gui,2:  Add, CheckBox, x20 y425 vCh99 gUnCheckAll cYellow, De-Select All

Gui,2:  Add, Button,   x10 y465 w100 h26 gAA ,Start
GuiControl,2:Focus,search
return
;--------------------------
CheckAll:
Loop, %i%
    GuiControl,2:, Ch%A_Index%, 1
GuiControl,2:, Ch99, 0
Return
;--------------------------
UnCheckAll:
Loop, %i%
    GuiControl,2:, Ch%A_Index%, 0
GuiControl,2:, Ch98, 0
Return
;--------------------------
AA:
Gui,2: submit, nohide
StringReplace,Search, Search, %A_space%, +, All
search=`%22%search%`%22

  if Ch1
    run,https://www.google.ru/search?q=%search%
  if Ch2
    run,https://www.google.ru/search?btnI=I`%27m+Feeling+Lucky&q=%search%
  if Ch3
    run,https://www.bing.com/images/search?q=%search%&FORM=HDRSC2
  if Ch4
    run,https://www.flickr.com/search/?q=%search%
  if Ch5
    run,https://www.google.ru/search?q=%search%&tbm=isch
  if Ch6
    {
    run,https://www.google.com/search?q=%search%#q=%search%&tbm=nws&hl=ru&gl=RU&ceid=RU:ru
    ;run,https://www.google.com/search?q=%search%#q=%search%&tbm=nws&hl=nl  ;- nederlands
	}
  if Ch7
	run,https://news.google.com/home?hl=ru&gl=RU&ceid=RU:ru
  if Ch8
    {
	run,https://www.google.ru/search?q=%search% filetype:pdf
	}
  if Ch9
    run,https://www.google.com/search?q=%search%&tbm=vid&hl=ru&gl=RU&ceid=RU:ru
  if Ch10
    run,https://www.youtube.ru/results?search_query=%search%
  if Ch11
     {
     StringReplace,search,search,+,%A_space%, All
     StringUpper,search,search,T
     StringReplace,search,search,%A_space%,_, All
     StringReplace,Search,Search,`%22, , All
     run, https://en.wikipedia.org/wiki/%search%
     }
  if Ch12
     run,charmap                             ;--- open xy program
return
;--------------------------
2GuiClose:
Gui,2:  Submit
Loop,%i%
   {
   e= % ch%a_index%
   IniWrite, %e%, %f1%, ss, Cb%a_index%
   }
ExitApp
;===========================================================================


Return to “Помощь”

Who is online

Users browsing this forum: No registered users and 19 guests