发表回复 
AHK写的精品推荐:
2014-10-07, 22 : 08
RE: AHK写的精品推荐:
呃....... @namejm

如果要看时间,当前是麻烦了.....倒不至于转列表、排序,只需,引用+回复、树状模式,相对简单点...
空了再部分恢复些吧....比如只有年份?

另外,由版本号也是能查时间的...我想,版本号才是独立唯一的标识...

One for all, but man for himself

帮推广:AHK知乎专栏
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-10-14, 23 : 25
RE: AHK写的精品推荐:
你不新开个贴子,真是浪费你的文字

wiz,ahkscript,wiki,zhihu,ahk8,Github,多个QQ群,贴吧,
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
[+] 1用户表示感谢huyaowen
2014-11-09, 15 : 18 (这个帖子最后修改于: 2014-11-09 15 : 20 by tmplinshi.)
RE: AHK写的精品推荐:
@robertL
我也赞同恢复显示发帖时间(不要“只有年份”..)。如果你发起一个投票,我相信赞同的占多数。
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
[+] 1用户表示感谢tmplinshi
2014-11-10, 09 : 51 (这个帖子最后修改于: 2014-11-10 11 : 32 by huyaowen.)
RE: AHK写的精品推荐:
好吧,请用投票的方式决定是否显示时间。

wiz,ahkscript,wiki,zhihu,ahk8,Github,多个QQ群,贴吧,
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-11-10, 15 : 53
RE: AHK写的精品推荐:
我反对,这里就是萝卜的后宫,萝卜说什么就是什么,所有反对的声音都滚粗
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-11-12, 13 : 08
RE: AHK写的精品推荐:
@kongqir 拿什么奖励你呢?
我觉得时间显示与否好像都行,但有点懒了...呵呵

One for all, but man for himself

帮推广:AHK知乎专栏
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-12-14, 23 : 38
RE: AHK写的精品推荐:
晕,没有下载地址,也没有说在哪个群里
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-12-15, 08 : 20
RE: AHK写的精品推荐:
@svnjcx 群:3222783

One for all, but man for himself

帮推广:AHK知乎专栏
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-12-17, 14 : 32 (这个帖子最后修改于: 2014-12-31 09 : 53 by huyaowen.)
RE: AHK写的精品推荐:
现在又多了一个精品:Taskdialog Creator

都知道scite自带的那个msgboxC吧,是生成msgbox提示框的工具脚本。
现在
just me编写了一个华丽的msgobx
详情见这里:http://ahkscript.org/boards/viewtopic.php?f=6&t=4635

[Image: file.php?id=440]


这个函数的参数比较多,平时使用时对应稍显复杂,于是,我就写了个他的生成器,代码图样,不过能用。

34楼有更新版,支持自定义图标功能
代码: (全选)
;作者:小古
;20141215
;TaskDialog函数为just me作品
;ahk版本:1.1.16.05

#NoEnv
#NoTrayIcon
#SingleInstance  force
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
ListLines Off

Menu, HelpMenu, Add, QQ群:3222783, MenuHelp
Menu, HelpMenu, Add, Candy视频教程, CandyHelp
Menu, HelpMenu, Add, 关于本生成器, MenuHelp
Menu, MyMenuBar, Add, 帮助, :HelpMenu

Menu, MyMenuBar, Add, 重新加载, reloadcreator
Menu, MyMenuBar, Add,Let's help each other out!,openahkscript
Gui, Menu, MyMenuBar


Gui, Add, Edit, x110 y30 w340 h70 Multi vmain   r3, 主要内容
Gui, Add, Edit, x110 y90 w340 h40 Multi vextra   r5, 次要内容
Gui, Add, Edit, x110 y180 w340 h20 -Multi  limit15 vtitle, 提示
Gui, Add, Edit, x110 y210 w340 h20 -Multi  vwidth +number, 400
Gui, Add, Slider,x110 y240 w310 h20 Range0-20 ReadOnly Right vTimeout gcontroltimeout, 0
Gui, Add, Edit, x420 y242 w30 h20 -Multi  limit15 vtimeoutshow, 0.0
Gui, Font, s11 bold cpurple
Gui, Add, GroupBox, x470 y20 w290 h125 , 按钮组合
Gui, Font
Gui, Add, Radio, x490 y40 w100 h20 vbutton1, Ok
Gui, Add, Radio, x490 y64 w100 h20 vbutton2, Yes
Gui, Add, Radio, x490 y88 w100 h20 vbutton3 checked, Yes/No
Gui, Add, Radio, x490 y112 w130 h20 vbutton4, Cancel/Retry/Close

Gui, Add, Radio, x620 y112  w100 h20 vbutton5, All Buttons
Gui, Add, Radio, x620 y64 w100 h20 vbutton6, Retry/Cancel
Gui, Add, Radio, x620 y88 w100 h20 vbutton7, Retry/Close
Gui, Add, Radio,x620 y40 w130 h20 vbutton8, Yes/No/Close
Gui, Font
Gui, Font, s11 bold cpurple
Gui, Add, GroupBox, x470 y150 w290 h160 , 图标与主题
Gui,Font
Gui,Font,bold
Gui, Add, Radio, x490 y170 w100 h20 vicon1, 警告
Gui, Add, Radio, x490 y198 w100 h20 vicon2, 错误
Gui, Add, Radio, x490 y226 w100 h20 vicon3, 提示
Gui, Add, Radio, x490 y254 w100 h20 vicon4, 守护
Gui, Add, Radio,x490 y282 w100 h20 vicon10, 问号
Gui, Font
Gui, Font,  cblue bold
Gui, Add, Radio,  x610 y254 w100 h20 vicon5, 蓝色
Gui, Font, cFF8000
Gui, Add, Radio, x610 y170 w100 h20 vicon6, 黄色
Gui, Font,  cred
Gui, Add, Radio,  x610 y226 w100 h20 vicon7, 红色
Gui, Font,  cgreen
Gui, Add, Radio,  x610 y198w100 h20 vicon8 checked, 绿色
Gui, Font,  cgray
Gui, Add, Radio,  x610 y282 w100 h20 vicon9, 灰色
Gui, Font
Gui, Font, s11 bold
Gui, Add, Text, x20 y55   w90 h20, 主要内容:
Gui, Add, Text, x20 y120 w90 h20, 次要内容:
Gui, Add, Text, x20 y185 w90 h20, 标题文字:
Gui, Add, Text, x20 y215 w90 h20 , 窗口宽度:
Gui, Add, Text, x20 y245 w90 h20 , 超时秒数:
Gui, Font
gui,font,s13
Gui, Add, Edit, x20 y330 w740 h50 r3  vcontent, 结果代码
gui,font
Gui, Add, Button, x240 y270 w100 h40 gcommand, 生成(F2)
Gui, Add, Button, x20 y270 w100 h40 gview, 预览TD(F1)
Gui, Add, Button, x130 y270 w100 h40 gviewXP, 预览MB
Gui, Add, Button, x350 y270 w100 h40 gcopycode, 复制代码(F3)
Gui, Add, Text, x270 y410 w700 h30 +disabled, 脚本中使用的TaskDialog函数为just me作品,该函数不支持xp,在xp系统会显示普通的Msgbox。
; Generated using SmartGuiXP Creator mod 4.3.29.0
Gui, Show, Center w780 h430, TaskDialogEx Creator
GuiControl, +Default, 生成
Return


controltimeout:
   GuiControl, , timeoutshow, % (Timeout = 0 ? 0 : Round(Timeout / 2, 1))*2
return

GuiClose:
ExitApp

f1::
view:
Gui, Submit, NoHide
gosub transbuttonandicon
MsgBox,262208,提示, % "您点击的是:"  TaskDialogEx(main,extra,title,button,icon,width,-1,timeout)
return

f2::
command:
Gui, Submit, NoHide
gosub transbuttonandicon
if icon=question
   icon="question"
myfunction=
myfunction=TaskDialogUseMsgBoxOnXP(true)`r`nTaskDialogEx("%main%","%extra%","%title%",%button%,%icon%,%width%,-1,%timeout%)
;~ msgbox % myfunction
GuiControl,,content,%myfunction%
return

f3::
copycode:
gosub command
clipboard:=myfunction
SoundBeep, 750, 100
SoundBeep, 750, 100
return

viewXP:
Gui, Submit, NoHide
gosub transbuttonandicon
TaskDialogUseMsgBoxOnXP(true)
MsgBox,262208,提示, % "您点击的是:"  TaskDialogMsgBox(main,extra,title,button,icon,-1,timeout)
return

MenuHelp:
  MsgBox, 262208, 关于TaskDialogEx Creator,
(
TaskDialog函数为just me作品,详情参见:
http://ahkscript.org/boards/viewtopic.php?f=6&t=4635

此生成器由小古编写
AHK版本: AHK_L 1.1.16.05
操作系统: >= WIN_7

此函数不支持XP系统,若使用TaskDialogUseMsgBoxOnXP(true),在XP系统可显示一个普通的Msgbox。

)
return

openahkscript:
run http://ahkscript.org/boards/viewtopic.php?f=6&t=4635
return

CandyHelp:
run http://pan.baidu.com/s/1c0Eiz2g
return

reloadcreator:
Reload
return

transbuttonandicon:
button=
icon=
loop 8
{
    if button%a_index%=1
    {
        if A_Index = 1
            button = 1
        else if A_Index = 2
            button = 2
        else if A_Index = 3
            button = 6
        else if A_Index = 4
            button = 56
        else if A_Index = 5
            button = 63
        else if A_Index = 6
            button = 24
        else if A_Index = 7
            button = 48
        else if A_Index = 8
            button = 38
        break
    }

}
loop 10
{
    if icon%a_index%=1
    {
        if a_index=10
            icon=question
        else
            icon:=a_index
        break
    }

}        
return

;=========================================================================
; TaskDialogEx(主文,副文,标题,按钮,图标,宽度,父窗口,超时)
TaskDialogEx(Main, Extra := "", Title := "提示:", Buttons := 1, Icon := 8, Width := 600, Parent := -1, TimeOut := 0) {
  Static TDCB      := RegisterCallback("TaskDialogCallback", "Fast")
        , TDCSize   := (4 * 8) + (A_PtrSize * 16)
        , TDBTNS    := {OK: 1, YES: 2, NO: 4, CANCEL: 8, RETRY: 16, CLOSE: 32}
        , TDF       := {HICON_MAIN: 0x0002, ALLOW_CANCEL: 0x0008, CALLBACK_TIMER: 0x0800, SIZE_TO_CONTENT: 0x01000000}
        , TDICON    := {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9
                      , WARN: 1, ERROR: 2, INFO: 3, SHIELD: 4, BLUE: 5, YELLOW: 6, RED: 7, GREEN: 8, GRAY: 9
                      , QUESTION: 0}
        , HQUESTION := DllCall("User32.dll\LoadIcon", "Ptr", 0, "Ptr", 0x7F02, "UPtr")
        , DBUX      := DllCall("User32.dll\GetDialogBaseUnits", "UInt") & 0xFFFF
        , OffParent := 4
        , OffFlags  := OffParent + (A_PtrSize * 2)
        , OffBtns   := OffFlags + 4
        , OffTitle  := OffBtns + 4
        , OffIcon   := OffTitle + A_PtrSize
        , OffMain   := OffIcon + A_PtrSize
        , OffExtra  := OffMain + A_PtrSize
        , OffCB     := (4 * 7) + (A_PtrSize * 14)
        , OffCBData := OffCB + A_PtrSize
        , OffWidth  := OffCBData + A_PtrSize
   ; -------------------------------------------------------------------------------------------------------------------
   If ((DllCall("Kernel32.dll\GetVersion", "UInt") & 0xFF) < 6) {
      If TaskDialogUseMsgBoxOnXP()
         Return TaskDialogMsgBox(Main, Extra, Title, Buttons, Icon, Parent, Timeout)
      Else {
         MsgBox, 16, %A_ThisFunc%, You need at least Win Vista / Server 2008 to use %A_ThisFunc%().
         ErrorLevel := "You need at least Win Vista / Server 2008 to use " . A_ThisFunc . "()."
         Return 0
      }
   }
   ; -------------------------------------------------------------------------------------------------------------------
   Flags := Width = 0 ? TDF.SIZE_TO_CONTENT : 0
   If (Title = "")
      Title := A_ScriptName
   BTNS := 0
   If Buttons Is Integer
      BTNS := Buttons & 0x3F
   Else
      For Each, Btn In StrSplit(Buttons, ["|", " ", ",", "`n"])
         BTNS |= (B := TDBTNS[Btn]) ? B : 0
   ICO := (I := TDICON[Icon]) ? 0x10000 - I : 0
   If Icon Is Integer
      If ((Icon & 0xFFFF) <> Icon) ; caller presumably passed HICON
         ICO := Icon
   If (Icon = "Question")
      ICO := HQUESTION
   If (ICO > 0xFFFF)
      Flags |= TDF.HICON_MAIN
   AOT := Parent < 0 ? !(Parent := 0) : False ; AlwaysOnTop
   ; -------------------------------------------------------------------------------------------------------------------
   PTitle := A_IsUnicode ? &Title : TaskDialogToUnicode(Title, WTitle)
   PMain  := A_IsUnicode ? &Main : TaskDialogToUnicode(Main, WMain)
   PExtra := Extra = "" ? 0 : A_IsUnicode ? &Extra : TaskDialogToUnicode(Extra, WExtra)
   VarSetCapacity(TDC, TDCSize, 0) ; TASKDIALOGCONFIG structure
   NumPut(TDCSize, TDC, "UInt")
   NumPut(Parent, TDC, OffParent, "Ptr")
   NumPut(BTNS, TDC, OffBtns, "Int")
   NumPut(PTitle, TDC, OffTitle, "Ptr")
   NumPut(ICO, TDC, OffIcon, "Ptr")
   NumPut(PMain, TDC, OffMain, "Ptr")
   NumPut(PExtra, TDC, OffExtra, "Ptr")
   If (AOT) || (TimeOut > 0) {
      If (TimeOut > 0) {
         Flags |= TDF.CALLBACK_TIMER
         TimeOut := Round(Timeout * 1000)
      }
      TD := {AOT: AOT, Timeout: Timeout}
      NumPut(TDCB, TDC, OffCB, "Ptr")
      NumPut(&TD, TDC, OffCBData, "Ptr")
   }
   NumPut(Flags, TDC, OffFlags, "UInt")
   If (Width > 0)
      NumPut(Width * 4 / DBUX, TDC, OffWidth, "UInt")
   If !(RV := DllCall("Comctl32.dll\TaskDialogIndirect", "Ptr", &TDC, "IntP", Result, "Ptr", 0, "Ptr", 0, "UInt"))
      Return TD.TimedOut ? -1 : Result
   ErrorLevel := "The call of TaskDialogIndirect() failed!`nReturn value: " . RV . "`nLast error: " . A_LastError
   Return 0
}
; ================================================================================​======================================
; Call this function once passing 1/True if you want a MsgBox to be displayed instead of the task dialog on Win XP.
; ================================================================================​======================================
TaskDialogUseMsgBoxOnXP(UseIt := "") {
   Static UseMsgBox := False
   If (UseIt <> "")
      UseMsgBox := !!UseIt
   Return UseMsgBox
}
; ================================================================================​======================================
; Internally used functions
; ================================================================================​======================================
TaskDialogMsgBox(Main, Extra, Title := "", Buttons := 0, Icon := 0, Parent := 0, TimeOut := 0) {
   Static MBICON := {1: 0x30, 2: 0x10, 3: 0x40, WARN: 0x30, ERROR: 0x10, INFO: 0x40, QUESTION: 0x20}
        , TDBTNS := {OK: 1, YES: 2, NO: 4, CANCEL: 8, RETRY: 16}
   BTNS := 0
   If Buttons Is Integer
      BTNS := Buttons & 0x1F
   Else
      For Each, Btn In StrSplit(Buttons, ["|", " ", ",", "`n"])
         BTNS |= (B := TDBTNS[Btn]) ? B : 0
   Options := 0
   Options |= (I := MBICON[Icon]) ? I : 0
   Options |= Parent = -1 ? 262144 : Parent > 0 ? 8192 : 0
   If ((BTNS & 14) = 14)
      Options |= 0x03 ; Yes/No/Cancel
   Else If ((BTNS & 6) = 6)
      Options |= 0x04 ; Yes/No
   Else If ((BTNS & 24) = 24)
      Options |= 0x05 ; Retry/Cancel
   Else If ((BTNS & 9) = 9)
      Options |= 0x01 ; OK/Cancel
   Main .= Extra <> "" ? "`n`n" . Extra : ""
   MsgBox, % Options, %Title%, %Main%, %TimeOut%
   IfMsgBox, OK
      Return 1
   IfMsgBox, Cancel
      Return 2
   IfMsgBox, Retry
      Return 4
   IfMsgBox, Yes
      Return 6
   IfMsgBox, No
      Return 7
   IfMsgBox, TimeOut
      Return -1
   Return 0
}
; ================================================================================​======================================
TaskDialogToUnicode(String, ByRef Var) {
   VarSetCapacity(Var, StrPut(String, "UTF-16") * 2, 0)
   StrPut(String, &Var, "UTF-16")
   Return &Var
}
; ================================================================================​======================================
TaskDialogCallback(H, N, W, L, D) {
   Static TDM_CLICK_BUTTON := 0x0466
        , TDN_CREATED := 0
        , TDN_TIMER   := 4
   TD := Object(D)
   If (N = TDN_TIMER) && (W > TD.Timeout) {
      TD.TimedOut := True
      PostMessage, %TDM_CLICK_BUTTON%, 2, 0, , ahk_id %H% ; IDCANCEL = 2
   }
   Else If (N = TDN_CREATED) && TD.AOT {
      DHW := A_DetectHiddenWindows
      DetectHiddenWindows, On
      WinSet, AlwaysOnTop, On, ahk_id %H%
      DetectHiddenWindows, %DHW%
   }
   Return 0
}

[Image: inamo0.png]
[attachment=1933]

wiz,ahkscript,wiki,zhihu,ahk8,Github,多个QQ群,贴吧,
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
[+] 3用户表示感谢huyaowen
2014-12-23, 14 : 38
RE: AHK写的精品推荐:
@robertL 已加入,非常感谢!
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-12-29, 19 : 30
RE: AHK写的精品推荐:
第一个 一直和TC用 不错的说
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-12-30, 20 : 50
RE: AHK写的精品推荐:
TaskDialog()这个是自带函数 还是自定义的啊
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-12-30, 21 : 01
RE: AHK写的精品推荐:
@aiAUTOHK 你得[Image: postbit_multi_mention.gif]你要问的人,或者[Image: postbit_quote.gif]某人的帖子。

这函数是他包装的功能。

One for all, but man for himself

帮推广:AHK知乎专栏
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2014-12-31, 09 : 27 (这个帖子最后修改于: 2014-12-31 14 : 58 by huyaowen.)
RE: AHK写的精品推荐:
@aiAUTOHK 好好看贴子,那个楼一开头都讲到了。

更新:支持自定义图标:

代码: (全选)
;作者:小古
;20141215
;TaskDialog函数为just me作品
;ahk版本:1.1.16.05

#NoTrayIcon
#SingleInstance  force
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
ListLines Off

Menu, HelpMenu, Add, QQ群:3222783, MenuHelp
Menu, HelpMenu, Add, Candy视频教程, CandyHelp
Menu, HelpMenu, Add, 关于本生成器, MenuHelp
Menu, MyMenuBar, Add, 帮助, :HelpMenu

Menu, MyMenuBar, Add, 重新加载, reloadcreator
Menu, MyMenuBar, Add,Let's help each other out!,openahkscript
Gui,  1:Menu, MyMenuBar


Gui,  1:Add, Edit, x110 y30 w340 h70 Multi vmain   r3, 主要内容
Gui, 1: Add, Edit, x110 y90 w340 h40 Multi vextra   r5, 次要内容
Gui,  1:Add, Edit, x110 y180 w340 h20 -Multi  limit15 vtitle, 提示
Gui,  1:Add, Edit, x110 y210 w340 h20 -Multi  vwidth +number, 400
Gui, 1: Add, Slider,x110 y240 w310 h20 Range0-20 ReadOnly Right vTimeout gcontroltimeout, 0
Gui,  1:Add, Edit, x420 y242 w30 h20 -Multi  limit15 ReadOnly vtimeoutshow, 0.0
Gui,  1:Font, s11 bold cpurple
Gui,  1:Add, GroupBox, x470 y20 w290 h125 , 按钮组合
Gui,  1:Font
Gui,  1:Add, Radio, x490 y40 w100 h20 vbutton1, Ok
Gui,  1:Add, Radio, x490 y64 w100 h20 vbutton2, Yes
Gui,  1:Add, Radio, x490 y88 w100 h20 vbutton3 checked, Yes/No
Gui,  1:Add, Radio, x490 y112 w130 h20 vbutton4, Cancel/Retry/Close

Gui,  1:Add, Radio, x620 y112  w100 h20 vbutton5, All Buttons
Gui,  1:Add, Radio, x620 y64 w100 h20 vbutton6, Retry/Cancel
Gui,  1:Add, Radio, x620 y88 w100 h20 vbutton7, Retry/Close
Gui,  1:Add, Radio,x620 y40 w130 h20 vbutton8, Yes/No/Close
Gui,  1:Font
Gui, 1: Font, s11 bold cpurple
Gui,  1:Add, GroupBox, x470 y150 w290 h200 , 图标与主题
Gui, 1:Font
Gui, 1:Font,bold
Gui,  1:Add, Radio, x490 y170 w100 h20 vicon1, 警告
Gui,  1:Add, Radio, x490 y198 w100 h20 vicon2, 错误
Gui,  1:Add, Radio, x490 y226 w100 h20 vicon3, 提示
Gui,  1:Add, Radio, x490 y254 w100 h20 vicon4, 守护
Gui,  1:Add, Radio,x490 y282 w100 h20 vicon10, 问号
Gui,  1:Font
Gui,  1:Font,  cblue bold
Gui,  1:Add, Radio,  x610 y254 w100 h20 vicon5, 蓝色
Gui,  1:Font, cFF8000
Gui,  1:Add, Radio, x610 y170 w100 h20 vicon6, 黄色
Gui, 1: Font,  cred
Gui,  1:Add, Radio,  x610 y226 w100 h20 vicon7, 红色
Gui,  1:Font,  cgreen
Gui,  1:Add, Radio,  x610 y198w100 h20 vicon8 checked, 绿色
Gui,  1:Font,  cgray
Gui,  1:Add, Radio,  x610 y282 w50 h20 vicon9, 灰色
Gui,  1:Font,  cblack
Gui,  1:Add, Radio,  x490 y314 w72 h20 vicon11 gcustomicon, 自定义:
Gui,  1:Font
Gui,  1:Add, Edit, x560 y314 w180 h20 -Multi  ReadOnly vicon_file_path,
Gui,  1:Font, s11 bold
Gui,  1:Add, Text, x20 y55   w90 h20, 主要内容:
Gui,  1:Add, Text, x20 y120 w90 h20, 次要内容:
Gui,  1:Add, Text, x20 y185 w90 h20, 标题文字:
Gui,  1:Add, Text, x20 y215 w90 h20 , 窗口宽度:
Gui, 1: Add, Text, x20 y245 w90 h20 , 超时秒数:
Gui, 1: Font
gui, 1:font,s13
Gui,  1:Add, Edit, x20 y360 w737 h100   vcontent, 结果代码
gui, 1:font
Gui,  1:Add, Button, x240 y280 w100 h50 hwndIcon3 gcommand, 生成(F2)
Gui,  1:Add, Button, x10 y280 w110 h50 hwndIcon1 gview, 预览TD(F1)
Gui,  1:Add, Button, x130 y280 w100 h50 hwndIcon2 gviewXP, 预览MB
Gui,  1:Add, Button, x350 y280 w100 h50 hwndIcon4 gcopycode, 复制(F3)

GuiButtonIcon(Icon1, "shell32.dll", 172, "s32 a0 l5")
GuiButtonIcon(Icon2, "shell32.dll", 3, "s32 a0 l5")
GuiButtonIcon(Icon3, "shell32.dll", 46, "s32 a0 l5")
GuiButtonIcon(Icon4, "shell32.dll", 259, "s32 a0 l5")

Gui,  1:Add, Text, x270 y480 w700 h30 +disabled, 脚本中使用的TaskDialog函数为just me作品,该函数不支持xp,在xp系统会显示普通的Msgbox。
; Generated using SmartGuiXP Creator mod 4.3.29.0
Gui,  1:Show, Center w780 h500, TaskDialogEx Creator
GuiControl, +Default, 生成
Return


controltimeout:
   GuiControl,  1:, timeoutshow, % (Timeout = 0 ? 0 : Round(Timeout / 2, 1))*2
return

GuiClose:
ExitApp

f1::
view:
Gui,  1:Submit, NoHide
gosub transbuttonandicon
if icon11
{
   stringsplit,filepath,icon_file_path,`,
   HICON := LoadIcon(filepath1, filepath2)
   MsgBox,262208,提示, % "您点击的是:"  TaskDialogEx(main,extra,title,button,hicon,width,-1,timeout)
return
}
MsgBox,262208,提示, % "您点击的是:"  TaskDialogEx(main,extra,title,button,icon,width,-1,timeout)
return

f2::
command:
Gui, 1:Submit, NoHide
gosub transbuttonandicon
controlsettext,edit7
if icon11
{
      stringsplit,filepath,icon_file_path,`,
   HICON= LoadIcon(%filepath1%, %filepath2%)
myfunction=
myfunction=#include <TaskDialogEx>`r`nTaskDialogUseMsgBoxOnXP(true)`r`nTaskDialogEx("%main%","%extra%","%title%",%button%,%hicon%,%width%,-1,%timeout%)
;~ msgbox % myfunction
GuiControl,1:,content,%myfunction%
return  
}
if icon=question
   icon="question"
myfunction=
myfunction=#include <TaskDialogEx>`r`nTaskDialogUseMsgBoxOnXP(true)`r`nTaskDialogEx("%main%","%extra%","%title%",%button%,%icon%,%width%,-1,%timeout%)
;~ msgbox % myfunction
GuiControl,1:,content,%myfunction%
return

f3::
copycode:
gosub command
clipboard:=myfunction
SoundBeep, 750, 100
SoundBeep, 750, 100
return

viewXP:
Gui, 1:Submit, NoHide
gosub transbuttonandicon
TaskDialogUseMsgBoxOnXP(true)
MsgBox,262208,提示, % "您点击的是:"  TaskDialogMsgBox(main,extra,title,button,icon,-1,timeout)
return

MenuHelp:
  MsgBox, 262208, 关于TaskDialogEx Creator,
(
TaskDialog函数为just me作品,详情参见:
http://ahkscript.org/boards/viewtopic.php?f=6&t=4635

此生成器由小古编写
AHK版本: AHK_L 1.1.16.05
操作系统: >= WIN_7

此函数不支持XP系统,若使用TaskDialogUseMsgBoxOnXP(true),在XP系统可显示一个普通的Msgbox。

)
return

;~ customicon:
  ;~ FileSelectFile, icon_File ,,%SystemRoot%\system32\SHELL32.dll, Select an File with icon
      ;~ If icon_File <>
        ;~ guicontrol,,icon_file_path,%icon_File%,1
      ;~ Else
          ;~ Return
;~ return

openahkscript:
run http://ahkscript.org/boards/viewtopic.php?f=6&t=4635
return

CandyHelp:
run http://pan.baidu.com/s/1c0Eiz2g
return

reloadcreator:
Reload
return

customicon:
Gui,2:add, text, x10 y10 w400 h20, 查找此文件中的图标:
Gui,2:add, edit, x10 y30 w300 h20 -Multi vfile
Gui,2:add, button, x325 y30 w80 h20 gselect, 浏览(&B)...
Gui,2:add, text, x10 y55 w400 h20, 从以下列表中选择一个图标:
Gui,2:Add, ListView, x10 y70 w400 h300 Icon vMyListView gMyListView, id
Gui,2:add, Button, x10 y380 w180 h30 Default gok, 确定
Gui,2:add, Button, x230 y380 w180 h30 gcancel, 取消
Gui,2: show, , 选择图标
Gui 2:+LastFound +OwnDialogs
controlclick,button1
Return


select:
FileSelectFile, file, , %SystemRoot%\system32\SHELL32.dll, 请选择图标文件, 图标(*.dll;*.ico;*.exe)
if file
{
    GuiControl, 2:, file, % file
    ImageListID := IL_Create(,,1)
    LV_SetImageList(ImageListID)
    icon_count := GetIconCount(file)
    LV_Delete()
    loop % icon_count
        IL_Add(ImageListID, file, A_Index)
    loop % icon_count
        LV_Add("Icon" . A_Index, A_Index)
}
else
gui, 2:Destroy  
Return

cancel:
gui, 2:Destroy
Return

ok:
MyListView:
icon := {}
FocusedRowNumber := LV_GetNext(0, "F")
if not FocusedRowNumber
    {
    MsgBox, 4144, 提示, 您未选择任何图标!
    Return
    }
LV_GetText(id, FocusedRowNumber, 1)
icon["file"] := file
icon["id"] := id
; MsgBox, 64, 提示, % "你选择了" """" icon["file"] """" "的第" icon["id"] "个图标"
guicontrol,1:,icon_file_path,% icon["file"] "," icon["id"]
Gui,2: destroy
Return

GetIconCount(file){
Menu, test, add, test, handle
Loop
{
try {
    id++
    menu, test, Icon, test, % file, % id
} catch error {
    Break
}
}
Return id-1
}

handle:
return




transbuttonandicon:
button=
icon=
loop 8
{
    if button%a_index%=1
    {
        if A_Index = 1
            button = 1
        else if A_Index = 2
            button = 2
        else if A_Index = 3
            button = 6
        else if A_Index = 4
            button = 56
        else if A_Index = 5
            button = 63
        else if A_Index = 6
            button = 24
        else if A_Index = 7
            button = 48
        else if A_Index = 8
            button = 38
        break
    }

}
loop 10
{
    if icon%a_index%=1
    {
        if a_index=10
            icon=question
        else
            icon:=a_index
        break
    }

}        
return

;=========================================================================
; TaskDialogEx(主文,副文,标题,按钮,图标,宽度,父窗口,超时)
TaskDialogEx(Main, Extra := "", Title := "提示:", Buttons := 1, Icon := 8, Width := 600, Parent := -1, TimeOut := 0) {
  Static TDCB      := RegisterCallback("TaskDialogCallback", "Fast")
        , TDCSize   := (4 * 8) + (A_PtrSize * 16)
        , TDBTNS    := {OK: 1, YES: 2, NO: 4, CANCEL: 8, RETRY: 16, CLOSE: 32}
        , TDF       := {HICON_MAIN: 0x0002, ALLOW_CANCEL: 0x0008, CALLBACK_TIMER: 0x0800, SIZE_TO_CONTENT: 0x01000000}
        , TDICON    := {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9
                      , WARN: 1, ERROR: 2, INFO: 3, SHIELD: 4, BLUE: 5, YELLOW: 6, RED: 7, GREEN: 8, GRAY: 9
                      , QUESTION: 0}
        , HQUESTION := DllCall("User32.dll\LoadIcon", "Ptr", 0, "Ptr", 0x7F02, "UPtr")
        , DBUX      := DllCall("User32.dll\GetDialogBaseUnits", "UInt") & 0xFFFF
        , OffParent := 4
        , OffFlags  := OffParent + (A_PtrSize * 2)
        , OffBtns   := OffFlags + 4
        , OffTitle  := OffBtns + 4
        , OffIcon   := OffTitle + A_PtrSize
        , OffMain   := OffIcon + A_PtrSize
        , OffExtra  := OffMain + A_PtrSize
        , OffCB     := (4 * 7) + (A_PtrSize * 14)
        , OffCBData := OffCB + A_PtrSize
        , OffWidth  := OffCBData + A_PtrSize
   ; -------------------------------------------------------------------------------------------------------------------
   If ((DllCall("Kernel32.dll\GetVersion", "UInt") & 0xFF) < 6) {
      If TaskDialogUseMsgBoxOnXP()
         Return TaskDialogMsgBox(Main, Extra, Title, Buttons, Icon, Parent, Timeout)
      Else {
         MsgBox, 16, %A_ThisFunc%, You need at least Win Vista / Server 2008 to use %A_ThisFunc%().
         ErrorLevel := "You need at least Win Vista / Server 2008 to use " . A_ThisFunc . "()."
         Return 0
      }
   }
   ; -------------------------------------------------------------------------------------------------------------------
   Flags := Width = 0 ? TDF.SIZE_TO_CONTENT : 0
   If (Title = "")
      Title := A_ScriptName
   BTNS := 0
   If Buttons Is Integer
      BTNS := Buttons & 0x3F
   Else
      For Each, Btn In StrSplit(Buttons, ["|", " ", ",", "`n"])
         BTNS |= (B := TDBTNS[Btn]) ? B : 0
   ICO := (I := TDICON[Icon]) ? 0x10000 - I : 0
   If Icon Is Integer
      If ((Icon & 0xFFFF) <> Icon) ; caller presumably passed HICON
         ICO := Icon
   If (Icon = "Question")
      ICO := HQUESTION
   If (ICO > 0xFFFF)
      Flags |= TDF.HICON_MAIN
   AOT := Parent < 0 ? !(Parent := 0) : False ; AlwaysOnTop
   ; -------------------------------------------------------------------------------------------------------------------
   PTitle := A_IsUnicode ? &Title : TaskDialogToUnicode(Title, WTitle)
   PMain  := A_IsUnicode ? &Main : TaskDialogToUnicode(Main, WMain)
   PExtra := Extra = "" ? 0 : A_IsUnicode ? &Extra : TaskDialogToUnicode(Extra, WExtra)
   VarSetCapacity(TDC, TDCSize, 0) ; TASKDIALOGCONFIG structure
   NumPut(TDCSize, TDC, "UInt")
   NumPut(Parent, TDC, OffParent, "Ptr")
   NumPut(BTNS, TDC, OffBtns, "Int")
   NumPut(PTitle, TDC, OffTitle, "Ptr")
   NumPut(ICO, TDC, OffIcon, "Ptr")
   NumPut(PMain, TDC, OffMain, "Ptr")
   NumPut(PExtra, TDC, OffExtra, "Ptr")
   If (AOT) || (TimeOut > 0) {
      If (TimeOut > 0) {
         Flags |= TDF.CALLBACK_TIMER
         TimeOut := Round(Timeout * 1000)
      }
      TD := {AOT: AOT, Timeout: Timeout}
      NumPut(TDCB, TDC, OffCB, "Ptr")
      NumPut(&TD, TDC, OffCBData, "Ptr")
   }
   NumPut(Flags, TDC, OffFlags, "UInt")
   If (Width > 0)
      NumPut(Width * 4 / DBUX, TDC, OffWidth, "UInt")
   If !(RV := DllCall("Comctl32.dll\TaskDialogIndirect", "Ptr", &TDC, "IntP", Result, "Ptr", 0, "Ptr", 0, "UInt"))
      Return TD.TimedOut ? -1 : Result
   ErrorLevel := "The call of TaskDialogIndirect() failed!`nReturn value: " . RV . "`nLast error: " . A_LastError
   Return 0
}
; ================================================================================​======================================
; Call this function once passing 1/True if you want a MsgBox to be displayed instead of the task dialog on Win XP.
; ================================================================================​======================================
TaskDialogUseMsgBoxOnXP(UseIt := "") {
   Static UseMsgBox := False
   If (UseIt <> "")
      UseMsgBox := !!UseIt
   Return UseMsgBox
}
; ================================================================================​======================================
; Internally used functions
; ================================================================================​======================================
TaskDialogMsgBox(Main, Extra, Title := "", Buttons := 0, Icon := 0, Parent := 0, TimeOut := 0) {
   Static MBICON := {1: 0x30, 2: 0x10, 3: 0x40, WARN: 0x30, ERROR: 0x10, INFO: 0x40, QUESTION: 0x20}
        , TDBTNS := {OK: 1, YES: 2, NO: 4, CANCEL: 8, RETRY: 16}
   BTNS := 0
   If Buttons Is Integer
      BTNS := Buttons & 0x1F
   Else
      For Each, Btn In StrSplit(Buttons, ["|", " ", ",", "`n"])
         BTNS |= (B := TDBTNS[Btn]) ? B : 0
   Options := 0
   Options |= (I := MBICON[Icon]) ? I : 0
   Options |= Parent = -1 ? 262144 : Parent > 0 ? 8192 : 0
   If ((BTNS & 14) = 14)
      Options |= 0x03 ; Yes/No/Cancel
   Else If ((BTNS & 6) = 6)
      Options |= 0x04 ; Yes/No
   Else If ((BTNS & 24) = 24)
      Options |= 0x05 ; Retry/Cancel
   Else If ((BTNS & 9) = 9)
      Options |= 0x01 ; OK/Cancel
   Main .= Extra <> "" ? "`n`n" . Extra : ""
   MsgBox, % Options, %Title%, %Main%, %TimeOut%
   IfMsgBox, OK
      Return 1
   IfMsgBox, Cancel
      Return 2
   IfMsgBox, Retry
      Return 4
   IfMsgBox, Yes
      Return 6
   IfMsgBox, No
      Return 7
   IfMsgBox, TimeOut
      Return -1
   Return 0
}
; ================================================================================​======================================
TaskDialogToUnicode(String, ByRef Var) {
   VarSetCapacity(Var, StrPut(String, "UTF-16") * 2, 0)
   StrPut(String, &Var, "UTF-16")
   Return &Var
}
; ================================================================================​======================================
TaskDialogCallback(H, N, W, L, D) {
   Static TDM_CLICK_BUTTON := 0x0466
        , TDN_CREATED := 0
        , TDN_TIMER   := 4
   TD := Object(D)
   If (N = TDN_TIMER) && (W > TD.Timeout) {
      TD.TimedOut := True
      PostMessage, %TDM_CLICK_BUTTON%, 2, 0, , ahk_id %H% ; IDCANCEL = 2
   }
   Else If (N = TDN_CREATED) && TD.AOT {
      DHW := A_DetectHiddenWindows
      DetectHiddenWindows, On
      WinSet, AlwaysOnTop, On, ahk_id %H%
      DetectHiddenWindows, %DHW%
   }
   Return 0
}


LoadIcon(FullFilePath, IconNumber := 1, LargeIcon := 1) {
   HIL := IL_Create(1, 1, !!LargeIcon)
   IL_Add(HIL, FullFilePath, IconNumber)
   HICON := DllCall("Comctl32.dll\ImageList_GetIcon", "Ptr", HIL, "Int", 0, "UInt", 0, "UPtr")
   IL_Destroy(HIL)
   Return HICON
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
    RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
    RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
    RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
    RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
    RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
    RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
    RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
    RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
    Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
    VarSetCapacity( button_il, 20 + Psz, 0 )
    NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr )   ; Width & Height
    NumPut( L, button_il, 0 + Psz, DW )     ; Left Margin
    NumPut( T, button_il, 4 + Psz, DW )     ; Top Margin
    NumPut( R, button_il, 8 + Psz, DW )     ; Right Margin
    NumPut( B, button_il, 12 + Psz, DW )    ; Bottom Margin
    NumPut( A, button_il, 16 + Psz, DW )    ; Alignment
    SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
    return IL_Add( normal_il, File, Index )
}

[attachment=1950]

[Image: 2lbhnjr.png]

感谢 @thinkai 的icon功能代码。

wiz,ahkscript,wiki,zhihu,ahk8,Github,多个QQ群,贴吧,
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2015-01-17, 23 : 01 (这个帖子最后修改于: 2015-01-18 14 : 39 by robertL.)
RE: AHK写的精品推荐:
Windy 在群里确实搜不到了 lz@huyaowen 能否提供下呀
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2015-01-19, 08 : 56
RE: AHK写的精品推荐:
木有,让它成为传说吧。

wiz,ahkscript,wiki,zhihu,ahk8,Github,多个QQ群,贴吧,
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2015-10-13, 10 : 44
RE: AHK写的精品推荐:
@huyaowen
群文件里没找到 Pandy、Bardy、Windy,能再分享一下吗?
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2018-10-30, 16 : 11
RE: AHK写的精品推荐:
很多都挂点找不到了, 希望有大神出来分享下
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
发表回复 


论坛跳转:


联系我们 | Autohotkey 中文站 | 回到顶部 | 回到正文区 | 精简(归档)模式 | RSS 聚合