1 (изменено: Limon4ek, 2018-01-05 14:58:13)

Тема: AHK:Смена картинки по хоткею.

Доброго времени суток. Я делаю скрипт, который по хоткею должен "нажимать" кнопки, а потом менять картинку в своём gui. Но он пропускает замену картинки, когда я выношу в отдельный файл, часть которая пропускалась работает. Прошу помощи.
Часть:

ad:=17
cikl:=0

Gui,add, picture, x1 y0 w80 h80 vMyPicture1, .\overlay\skills_icons\alacrity.png
gui,add, picture, x1 y0 w80 h80 vMyPicture , .\overlay\skills_icons\alacrity_CD.png
GuiControl, hide, MyPicture
Gui,Font, s24
GUI,add, text, x27 y20 w40 h40 c516E0D vHDLOL  +BackGroundTrans, %ad%  
GuiControl, hide, HDLOL
GUI, Show
return

sc1E::
Send, {sc11}{sc11}{sc12}{sc13}
Sleep,100
Send,{sc20}{sc20}{sc20}

GuiControl, hide, MyPicture1
GuiControl, show, MyPicture

while cikl = 0
{
	if ad > 0 
	{
		GuiControl,show,HDLOL
		GuiControl,,HDLOL,%ad%
		Sleep,1000
		ad--
		
	}
	Else
	{
	GuiControl,,HDLOL,%ad%
	GuiControl, hide, MyPicture
	GuiControl, Show, MyPicture1
	GuiControl, hide, HDLOL
	break
	}
}
GuiClose:
Exitapp

Целый код:


;rt := 0
;pr := 0
;pt := 0
var := 255
cikl := 0
gr:= 17

Gui,new, +AlwaysOnTop 
Gui, -Border
Gui,add, picture, x1 y0 w80 h80 vMyPicture1, .\overlay\skills_icons\alacrity.png
gui,add, picture, x1 y0 w80 h80 vMyPicture , .\overlay\skills_icons\alacrity_CD.png
GuiControl,hide,MyPicture
GUI,add, text, x27 y20 w40 h40 c516E0D vHDLOL  +BackGroundTrans, %gr%  
GuiControl, hide, HDLOL

Gui,Add, Picture, x1 y90 w80 h80 , .\overlay\skills_icons\CM.png

Gui,Add, Picture, x1 y180 w80 h80 , .\overlay\skills_icons\CS.png

Gui,Add, Picture, x1 y270 w80 h80 , .\overlay\skills_icons\DB.png

Gui,Add, Picture, x1 y360 w80 h80 , .\overlay\skills_icons\EMP.png

Gui,Add, Picture, x1 y450 w80 h80 , .\overlay\skills_icons\FS.png

Gui,Add, Picture, x1 y540 w80 h80 , .\overlay\skills_icons\GW.png

Gui,Add, Picture, x1 y630 w80 h80 , .\overlay\skills_icons\SS.png

Gui,Add, Picture, x1 y720 w80 h80 , .\overlay\skills_icons\SW.png

Gui,Add, Picture, x91 y1 w80 h80 , .\overlay\skills_icons\Tornado.png

Gui,Add, Picture, x91 y90 w100 h100 , .\overlay\skills_icons\Invoke.png

Gui,Add, Text,x1 y0 w10 h15, A
Gui,Add, Text,x1 y92 w10 h15, T
Gui,Add, Text,x1 y182 w10 h15, S
Gui,Add, Text,x1 y272 w10 h15, B
Gui,Add, Text,x1 y362 w40 h15, Shift N
Gui,Add, Text,x1 y452 w40 h15, Shift G
Gui,Add, Text,x1 y542 w40 h15, Shift S
Gui,Add, Text,x1 y632 w10 h15, G
Gui,Add, Text,x1 y722 w40 h15, Shift A
Gui,Add, Text,x91 y2 w40 h15, Shift N
InputBox, var, Opacity, Enter value of opacity(1-255).|.Recomend value 150-170
Gui,Show, w172 h801, InvokerInfoPanel
Winset, Transparent, %var%, InvokerInfoPanel
IfWinExist, InvokerInfoPanel
{
	WinMove, 1502, 70
	OnMessage(0x03, "WM_MOVE")
	return
	OnMessage(0x201, "WM_LBUTTONDOWN")
	Return
	WM_LBUTTONDOWN()
	{
		PostMessage, WM_NCLBUTTONDOWN := 0xA1, HTCAPTION := 2
	}
}
sc1E::
Send, {sc11}{sc11}{sc12}{sc13}
Sleep,80
Send,{sc20}{sc20}{sc20}

Gui,Font,s24
GuiControl, hide, MyPicture1
GuiControl, show, MyPicture

while cikl = 0
{
	if gr > 0 
	{
		
		GuiControl,show,HDLOL
		GuiControl,,HDLOL,%gr%
		Sleep,1000
		gr--
		MsgBox, скрипт выполнен - %gr% раз ; Просто DEBUG_MSG
	}
	Else
	{
	GuiControl,,HDLOL,%gr%
	GuiControl, hide, MyPicture
	GuiControl, Show, MyPicture1
	GuiControl, hide, HDLOL
	break
	}
}
return
return


return

sc10::Send,{sc10}{sc10}{sc10}
;

sc11::Send, {sc11}{sc11}{sc11} 
;

sc12::Send, {sc12}{sc12}{sc12}
;

;



sc1F::
Send,{sc10}{sc10}{sc10}{sc13}
Sleep,150
Send, {sc20}{LButton}
return
;

+sc1F::
Send,{sc10}{sc10}{sc11}{sc13}
Send,{sc11}{sc11}{sc11}
Sleep, 150
Send, {sc20}{sc20}{sc20}{sc20}
return
;

+sc1E::
Send, {sc10}{sc10}{sc12}{sc13}
Sleep, 100
Send, {sc20}
return
;

sc31::
Send,{sc11}{sc11}{sc11}{sc13}
Sleep,150
Send,{sc20}{LButton}
return
;


+sc31::
Send,{sc11}{sc11}{sc10}
;Sleep, 30
Send,{sc13}
Sleep,100
Send,{sc20}{LButton}
return
;

sc30::
Send,{sc10}{sc11}{sc12}{sc13}
Sleep,80
Send, {sc20}{LButton}
return
;

sc22::
Send,{sc12}{sc12}{sc12}{sc13}
Sleep,80
Send,{sc20}{LButton}
return
;

+sc22::
Send,{sc12}{sc12}{sc10}{sc13}
sleep,90
Send,{sc20}
return

sc14::
Send,{sc12}{sc12}{sc11}{sc13}
Sleep, 90
Send,{sc20}{LButton}
return

return












GuiClose:
ExitApp

P.S. За Send не судите, ибо это специально для работы на загруженном ПК.
P.S.S. var ad=gr.