如何根据变量设置添加或删除GUI按钮? 我的想法是,如果在我读过的ini文件中它是否会显示1 Gui,Add,Button,h30 w140 gAEFiles vButton13,实际小时数如果设置为0则不会显示。 我尝试了几种变化而没有成功。任何帮助,我会很感激。
if(%AEButton%=1)
{
gui Tab,Daily
Gui, Add, Button, h30 w140 gNewfolder vButton14, Make daily folder
Gui, Add, Button, h30 w140 gdailyfile vButton8, Daily file
Gui, Add, Button, h30 w140 gLaborfile vButton9, Labor
Gui, Add, Button, h30 w140 gCyclefile vButton10, Cycle Count
Gui, Add, Button, h30 w140 gGLQueryfile vButton11, gQuery
Gui, Add, Button, h30 w140 gEarnhoursfile vButton12, Earn Hours
Gui, Add, Button, h30 w140 gAEFiles vButton13, Actual hours
}
else
{
gui Tab,Daily
Gui, Add, Button, h30 w140 gNewfolder vButton14, Make daily folder
Gui, Add, Button, h30 w140 gdailyfile vButton8, Daily file
Gui, Add, Button, h30 w140 gLaborfile vButton9, Labor
Gui, Add, Button, h30 w140 gCyclefile vButton10, Cycle Count
Gui, Add, Button, h30 w140 gGLQueryfile vButton11, gQuery
Gui, Add, Button, h30 w140 gEarnhoursfile vButton12, Earn Hours
}
答案 0 :(得分:0)
尝试一下:
<强>的config.ini 强>
[General]
AEButton=1
<强> script.ahk 强>
dailyTabHeight := 250
IniRead, AEButton, config.ini, General, AEButton
If(AEButton = 1) {
dailyTabHeight += 35 ;make the tab 35 pixels higher
}
Gui, Add, Tab, w165 h%dailyTabHeight%, Daily
Gui, Add, Button, h30 w140 gNewfolder vButton14, Make daily folder
Gui, Add, Button, h30 w140 gdailyfile vButton8, Daily file
Gui, Add, Button, h30 w140 gLaborfile vButton9, Labor
Gui, Add, Button, h30 w140 gCyclefile vButton10, Cycle Count
Gui, Add, Button, h30 w140 gGLQueryfile vButton11, gQuery
Gui, Add, Button, h30 w140 gEarnhoursfile vButton12, Earn Hours
If(AEButton = 1)
{
Gui, Add, Button, h30 w140 gAEFiles vButton13, Actual hours
;you could put other things in here too
}
Gui, Show
Newfolder:
dailyfile:
Laborfile:
Cyclefile:
GLQueryfile:
Earnhoursfile:
AEFiles:
Return
GuiClose:
ExitApp