├── Candy.ahk ├── Candy.exe ├── Candy_include.ahk ├── Candy_multifiles.ahk ├── Candy简明帮助.chm ├── ini ├── Candy1 │ └── Candy1.ini ├── Candy2 │ └── Candy2.ini ├── Candy3 │ ├── Ahk.ini │ ├── Candy3.ini │ ├── Dll.ini │ ├── Exe.ini │ ├── Ioi.ini │ ├── Iso.ini │ ├── Pdf.ini │ ├── torrent.ini │ ├── 压缩文件.ini │ ├── 图标文件.ini │ ├── 图片文件.ini │ ├── 文件夹.ini │ ├── 文本文件.ini │ ├── 短文本.ini │ ├── 磁盘.ini │ ├── 网址.ini │ ├── 视频文件.ini │ ├── 通用.ini │ ├── 通用折叠.ini │ ├── 长文本.ini │ └── 音频文件.ini ├── Candy4 │ └── Candy4.ini └── candycfg.ini ├── v1.73更新内容.txt └── 说明.txt /Candy.ahk: -------------------------------------------------------------------------------- 1 | ;~~~~~~~~~~~~~~~~~~~~万年书妖~~~~~~~~~~~~~~~~~~~~ 2 | ;~~~~~~~~~~~~~~~~~~~~带两位小数的版本为群内测试版~~~~~~~~~~~~~~~~~~~~ 3 | 4 | ; /* 5 | #MaxThreadsPerHotkey 3 6 | #NoTrayIcon 7 | #NoEnv 8 | #SingleInstance Ignore 9 | #WinActivateForce 10 | Process Priority,,High 11 | SetWorkingDir,%A_ScriptDir% 12 | coordmode,Mouse,screen 13 | SetTitleMatchMode,2 14 | config_iniFile=ini\candycfg.ini 15 | 16 | ; */ 17 | 18 | ^F9:: 19 | candy_inipath=ini\candy1 20 | Candy_IniFile=%candy_inipath%\Candy1.ini 21 | Goto Label_Candy_Start 22 | Return 23 | 24 | ^F10:: 25 | candy_inipath=ini\candy2 26 | Candy_IniFile=%candy_inipath%\Candy2.ini 27 | Goto Label_Candy_Start 28 | Return 29 | 30 | ^F11:: 31 | candy_inipath=ini\candy3 32 | Candy_IniFile=%candy_inipath%\Candy3.ini 33 | Goto Label_Candy_Start 34 | Return 35 | ^F12:: 36 | candy_inipath=ini\candy4 37 | Candy_IniFile=%candy_inipath%\Candy4.ini 38 | Goto Label_Candy_Start 39 | Return 40 | 41 | 42 | ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 用拷贝的方法提取内容 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43 | Label_Candy_Start: 44 | IniRead,程序路径_默认文本编辑器, %config_iniFile%,Configuration,default_texteditor ;文本编辑器 45 | IniRead ,candy_UserdBrowsers, %config_iniFile%,Configuration,used_browser ;你用到的浏览器 46 | IniRead,candy_DefaultBrowser, %config_iniFile%,Configuration,Default_browser ;你默认的浏览器,注意不同于系统默认 47 | 48 | CandySelected:= 49 | Candy_IniFile1:= 50 | Candy_IniFile2:= 51 | i=0 52 | MouseGetPos, Candy_CurrWin_x,Candy_CurrWin_y,Candy_CurrWin_id,Candy_CurrWin_ClassNN, ;当前鼠标下的窗口 53 | WinGet, Candy_CurrWin_pid,PID,Ahk_ID %Candy_CurrWin_id% ;当前窗口的PID 54 | WinGet, Candy_CurrWin_Fullpath,ProcessPath,Ahk_ID %Candy_CurrWin_id% ;当前窗口的进程路径 55 | SplitPath, Candy_CurrWin_Fullpath,,,,Candy_CurrWin_ProcName ;当前窗口的进程名称,不带后缀 56 | WinGetClass, Candy_CurrWin_class, Ahk_ID %Candy_CurrWin_id% ;当前窗口的class 57 | WinGetTitle, Candy_CurrWin_Title, Ahk_ID %Candy_CurrWin_id% ;当前窗口的Title 58 | ControlGet, Candy_CurrWin_hwnd,HWND,,,Ahk_ID %Candy_CurrWin_id% ;当前窗口的Hwnd 59 | 60 | 61 | ; flag_menuClipboard_disabled:=1 ;配合windy的粘贴板语句,独立的时候,该句删除 62 | Candy_Saved_ClipBoard := ClipboardAll 63 | Clipboard = 64 | Send, ^c 65 | ClipWait,1 66 | If ErrorLevel ;如果粘贴板里面没有内容,则有窗口定义 67 | { 68 | Clipboard := Candy_Saved_ClipBoard ;若不想进行Windy,屏蔽掉即可 69 | Return 70 | } 71 | Candy_ClipBoard_Rich:=ClipboardAll 72 | CandySelected=%Clipboard% 73 | Clipboard := Candy_Saved_ClipBoard 74 | Candy_Saved_ClipBoard = 75 | ; flag_menuClipboard_disabled:=0 ;配合windy的,独立的时候,该句删除 76 | 77 | ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 根据内容判断或者设定后缀 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78 | CandySelected_FileExtension= 79 | IniRead,Candy_ShortText_length,%Candy_IniFile%,Candy_Settings,ShortText_length,80 ;短文本的长度 80 | IfExist,%CandySelected% ;如果是电脑里面存在的文件 81 | { 82 | Flag_isFile:=1 83 | FileGetAttrib, CandySelected_FileAttrib, %CandySelected% ;是文件的情况下,区分是否文件夹 84 | IfInString, CandySelected_FileAttrib, D ;Attrib= D ,则是文件夹 85 | { 86 | If(RegExMatch(CandySelected,"^.:\\$")) 87 | { 88 | CandySelected_FileExtension:="Driver" ;盘符 89 | } 90 | Else 91 | { 92 | CandySelected_FileExtension:="Folder" ;文件夹 93 | } 94 | SplitPath,CandySelected,,CandySelected_FilePathOnly,,CandySelected_FileNamenoExt,CandySelected_FileDriver 95 | SplitPath,CandySelected_FilePathOnly,,,,CandySelected_FileFolderName_Uplevel, 96 | } 97 | Else ;若不是文件夹的话,则只能是文件了 98 | { 99 | SplitPath,CandySelected,,CandySelected_FilePathOnly,CandySelected_FileExtension,CandySelected_FileNamenoExt,CandySelected_FileDriver 100 | SplitPath,CandySelected_FilePathOnly,,,,CandySelected_FileFolderName_Uplevel, 101 | IfEqual CandySelected_FileExtension,lnk 102 | { 103 | FileGetShortcut, %CandySelected%, Candy_linkTarget, 104 | } 105 | Else If !CandySelected_FileExtension ;没有后缀的文件 106 | { 107 | CandySelected_FileExtension:="NoExt" 108 | } 109 | } 110 | } 111 | Else ;如果不是文件,也不是文件夹,那么就是文本或者是“多个文件” 112 | { 113 | Flag_isFile:=0 114 | CandySelected:=RegExReplace(CandySelected,"^\s*|\s*$","") ;去除前后的空格 115 | ;-----------特殊文字串辨析------------------- 116 | If(RegExMatch(CandySelected,"^(0x|#)?([a-fA-F0-9]){6}$")) 117 | { 118 | CandySelected_FileExtension:="ColorCode" ;颜色的十六进制编码 119 | } 120 | Else If(RegExMatch(CandySelected,"^([a-zA-Z0-9]){20,50}$")) 121 | { 122 | CandySelected_FileExtension:="MagnetLink" ;磁力链接 123 | } 124 | Else if(RegExMatch(CandySelected,"^(\(*\d+([.,]\d+)*\)*\s*(\+|-|/|\*)\s*)+\d+([.,]\d+)*\)*$")) 125 | { 126 | CandySelected_FileExtension:="Math" ;数学表达式 127 | } 128 | Else if(RegExMatch(CandySelected,"i)^(HKCU|HKCR|HKCC|HKU|HKLM|Hkey_)")) 129 | { 130 | CandySelected_FileExtension:="RegPath" ;注册表项 131 | } 132 | Else if(RegExMatch(CandySelected,"^\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}$")) 133 | { 134 | CandySelected_FileExtension:="CLSID" ;Clsid 135 | } 136 | Else If(RegExMatch(CandySelected,"i)^(https://|http://)?([A-Za-z0-9]+(-[A-Za-z0-9]+)*\.)+[A-Za-z]{2,}?")) 137 | { 138 | CandySelected_FileExtension:="WebUrl" ;网址 139 | } 140 | Else If(RegExMatch(CandySelected, "^[\w-_.]+@(?:\w+(?::\d+)?\.){1,3}(?:\w+\.?){1,2}$")) 141 | { 142 | CandySelected_FileExtension:="Email" ;email地址 143 | } 144 | ;-----------长短文字串辨析------------------- 145 | If CandySelected_FileExtension!= 146 | { 147 | CandySelected_FileExtension_Regex=i)(^|\|)%CandySelected_FileExtension%($|\|) ;正则 148 | CandySelected_FileExtension_Group:=SksSub_Ini_RegexFindKey(Candy_IniFile, "Texttype", CandySelected_FileExtension_Regex) 149 | IniRead,Candy_Value,%Candy_IniFile%,Texttype,%CandySelected_FileExtension_Group%,No_CandyValue_0 150 | IfNotEqual Candy_Value,No_CandyValue_0 ;如果有相应后缀组的定义 151 | { 152 | Goto Label_Candy_Find_Value 153 | } 154 | } 155 | If (StrLen(CandySelected)0 ;如果是文件类型 184 | { 185 | CandySelected_FileExtension_Regex=i)(^|\|)%CandySelected_FileExtension%($|\|) ;正则成群组 186 | CandySelected_FileExtension_Group:=SksSub_Ini_RegexFindKey(Candy_IniFile, "filetype", CandySelected_FileExtension_Regex) 187 | IniRead,Candy_Value,%Candy_IniFile%,filetype,%CandySelected_FileExtension_Group%,No_CandyValue_1 188 | IfEqual Candy_Value,No_CandyValue_1 ;如果没有相应后缀组的定 189 | { 190 | IniRead,Candy_Value, %Candy_IniFile%,filetype,AnyFile,No_CandyValue_2 191 | IfEqual Candy_Value,No_CandyValue_2 ;没有定义的话,直接运行 192 | { 193 | Run,%CandySelected%, ,UseErrorLevel 194 | Return 195 | } 196 | } 197 | } 198 | Else ;如果是文本类型 199 | { 200 | CandySelected_FileExtension_Regex=i)(^|\|)%CandySelected_FileExtension%($|\|) ;正则成群组 201 | CandySelected_FileExtension_Group:=SksSub_Ini_RegexFindKey(Candy_IniFile, "texttype", CandySelected_FileExtension_Regex) 202 | IniRead,Candy_Value,%Candy_IniFile%,texttype,%CandySelected_FileExtension_Group%,No_CandyValue_1 203 | IfEqual Candy_Value,No_CandyValue_1 ;如果没有相应后缀组的定 204 | { 205 | IniRead,Candy_Value, %Candy_IniFile%,texttype,AnyText,No_CandyValue_2 206 | IfEqual Candy_Value,No_CandyValue_2 ;没有定义的话,直接运行 207 | { 208 | Return 209 | } 210 | } 211 | } 212 | 213 | 214 | ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 直接运行还是菜单 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 215 | If(RegExMatch(Candy_Value,"i)^((file|Menu)\|)")) 216 | Goto Label_Candy_DrawMenu ;如果是以Menu|或者file|开头,先去画菜单 217 | Else 218 | Goto Label_Candy_RunCommand ;否则直接运行应用程序 219 | 220 | Label_Candy_DrawMenu: 221 | Menu,CandyMenu,Add 222 | Menu,CandyMenu,Delete 223 | 224 | CandySelected_StrLen:=StrLen(CandySelected) 225 | IfGreater,CandySelected_StrLen,20 ;菜单第一行,限制字数在20个字 226 | { 227 | StringLeft,Candy_Menu_Title_left,CandySelected,5 228 | StringRight,Candy_Menu_Title_Right,CandySelected,10 229 | Menu CandyMenu,Add,%Candy_Menu_Title_left% ... %Candy_Menu_Title_Right%,Label_CopyFullpath ;加第一行菜单,显示选中的内容,该菜单让你拷贝其内容 230 | } 231 | Else 232 | { 233 | Menu CandyMenu,Add,%CandySelected%,Label_CopyFullpath ;加第一行菜单,显示选中的内容,该菜单让你直接打开配置文件 234 | } 235 | Menu,CandyMenu,Add 236 | 237 | Loop,parse,Candy_Value,+ ;Menu可能存在于两个ini(字段)中 238 | { 239 | Splitted_Candy_Value_File2:= 240 | Splitted_Candy_Value_File3:= 241 | i++ 242 | If (i=3) 243 | { 244 | Break 245 | } 246 | If(RegExMatch(A_LoopField,"i)^(Menu\|)")) ;如果是menu|开头的话,则必定是在原ini文件里定义 247 | { 248 | StringReplace,CandyMenu_Ini_Sec_Name,A_LoopField,Menu|, ;menu|字段名 249 | CandyMenu_Ini_Sec_Name%i%=%CandyMenu_Ini_Sec_Name% ;得到真正的Section的名称 250 | Candy_IniFile%i%=%Candy_IniFile% ;用于下面的menu处理 251 | } 252 | Else If(RegExMatch(A_LoopField,"i)^(file\|)")) ;如果是file|开头,则必定是其他ini文件里面 253 | { 254 | StringSplit,Splitted_Candy_Value_File,A_LoopField,| ;file|文件名|字段名 255 | Candy_IniFile%i%=%Candy_inipath%\%Splitted_Candy_Value_File2% ;用哪个文件?这样的写法,限定了ini必须在Candy_inipath文件夹里面 256 | If Splitted_Candy_Value_File3!= 257 | { 258 | CandyMenu_Ini_Sec_Name%i%:=Splitted_Candy_Value_File3 ;如果定义了,则得到真正的Section的名称 259 | } 260 | Else 261 | { 262 | CandyMenu_Ini_Sec_Name%i%:="Configuration" ;这种写法是固定了段名 263 | } 264 | } 265 | Else ;只支持menu file 混杂组合叠加,其它写法都是错误的,将被抛弃 266 | { 267 | Continue 268 | } 269 | ;================根据各类型画出菜单================================ 270 | IniRead,CandyMenu_Ini_AllItem,% Candy_IniFile%i%,% CandyMenu_Ini_Sec_Name%i%, ;读取全部字段的内容 271 | 272 | Loop, Parse, CandyMenu_Ini_AllItem,`n ;首先做子菜单的清理 273 | { 274 | CandyMenu_Ini_ItemLeft:=trim(substr(A_LoopField,1,instr(A_LoopField,"=",1,1)-1)) 275 | IfInString,CandyMenu_Ini_ItemLeft,`\ 276 | { 277 | CandyMenu_Ini_ItemLeft_SubMenuName:=trim(substr(CandyMenu_Ini_ItemLeft,1,instr(CandyMenu_Ini_ItemLeft,"\",1,1)-1)) 278 | Menu,%CandyMenu_Ini_ItemLeft_SubMenuName%,Add 279 | Menu,%CandyMenu_Ini_ItemLeft_SubMenuName%,Delete 280 | } 281 | } 282 | Loop, Parse, CandyMenu_Ini_AllItem,`n ;再来刻画菜单 283 | { 284 | If(RegExMatch(A_LoopField,"^\s?-")) ;如果第一个字符是 - 285 | { 286 | Menu,CandyMenu,Add 287 | } 288 | Else 289 | { 290 | CandyMenu_Ini_ItemLeft:=trim(substr(A_LoopField,1,instr(A_LoopField,"=",1,1)-1)) 291 | IfInString,CandyMenu_Ini_ItemLeft,`\ ;包含\则是子菜单 292 | { 293 | CandyMenu_Ini_ItemLeft_SubMenuName:=trim(substr(CandyMenu_Ini_ItemLeft,1,instr(CandyMenu_Ini_ItemLeft,"\",1,1)-1)) 294 | CandyMenu_Ini_ItemLeft_SubMenuItem:=trim(substr(CandyMenu_Ini_ItemLeft,instr(CandyMenu_Ini_ItemLeft,"\",1,1)+1)) 295 | If(RegExMatch(CandyMenu_Ini_ItemLeft_SubMenuItem,"^\s?-")) ;如果子菜单第一个字符是 - 296 | { 297 | Menu,%CandyMenu_Ini_ItemLeft_SubMenuName%,Add 298 | } 299 | Else 300 | { 301 | Menu,%CandyMenu_Ini_ItemLeft_SubMenuName%,Add,%CandyMenu_Ini_ItemLeft_SubMenuItem%,Label_Candy_HandelMenu%i% 302 | Menu,CandyMenu,Add,%CandyMenu_Ini_ItemLeft_SubMenuName%,:%CandyMenu_Ini_ItemLeft_SubMenuName% 303 | } 304 | } 305 | Else ;否则是根菜单 306 | { 307 | Menu,CandyMenu,Add,%CandyMenu_Ini_ItemLeft%,Label_Candy_HandelMenu%i% 308 | } 309 | } 310 | } 311 | } 312 | Menu,CandyMenu,Show 313 | Return 314 | ;================菜单处理================================ 315 | Label_Candy_HandelMenu1: 316 | If A_ThisMenu=CandyMenu ;如果是根菜单 317 | { 318 | IniRead,Candy_Value,%Candy_IniFile1%,%CandyMenu_Ini_Sec_Name1%,%A_ThisMenuItem% 319 | } 320 | Else ;如果不是根菜单 321 | { 322 | IniRead,Candy_Value,%Candy_IniFile1%,%CandyMenu_Ini_Sec_Name1%,%A_ThisMenu%\%A_ThisMenuItem% 323 | } 324 | Goto Label_Candy_RunCommand 325 | Return 326 | Label_Candy_HandelMenu2: 327 | If A_ThisMenu=CandyMenu ;如果是根菜单 328 | { 329 | IniRead,Candy_Value,%Candy_IniFile2%,%CandyMenu_Ini_Sec_Name2%,%A_ThisMenuItem% 330 | } 331 | Else ;如果不是根菜单 332 | { 333 | IniRead,Candy_Value,%Candy_IniFile2%,%CandyMenu_Ini_Sec_Name2%,%A_ThisMenu%\%A_ThisMenuItem% 334 | } 335 | Goto Label_Candy_RunCommand 336 | Return 337 | Label_CopyFullpath: 338 | Clipboard:=CandySelected 339 | Return 340 | 341 | 342 | ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 终极运行 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 343 | Label_Candy_RunCommand: 344 | Splitted_Candy_Value1:= 345 | Splitted_Candy_Value2:= 346 | Splitted_Candy_Value3:= 347 | Splitted_Candy_Value4:= 348 | 349 | ;置粘贴板开关,这是两个开关变量,所以先要剔除 350 | IfInString,Candy_Value,{setclipboard:pure} ;这个指令会预先修改系统粘贴板,而不会对命令行本身起作用 351 | { 352 | Clipboard:=CandySelected 353 | StringReplace,Candy_Value,Candy_Value,{setclipboard:pure},,All 354 | } 355 | IfInString,Candy_Value,{setclipboard:rich} ;同上 356 | { 357 | Clipboard:=Candy_ClipBoard_Rich 358 | StringReplace,Candy_Value,Candy_Value,{setclipboard:rich},,All 359 | } 360 | If Candy_Value= 361 | Return 362 | 363 | ;一些时间参数 364 | IfInString Candy_value,{date: ;新的时间参数定义方法为:{date|yyyy_MM_dd} |后面的部分可以随意定义 365 | { 366 | candy_temp1:=RegExReplace(Candy_value,".*\{date\:(.*?)\}.*","$1") 367 | FormatTime,candy_temp2,%A_now%,%candy_temp1% 368 | StringReplace,Candy_value,Candy_value,{date:%candy_temp1%},%candy_temp2% 369 | } 370 | 371 | ;特别的参数Box 372 | IfInString,Candy_value,{box:input} 373 | { 374 | Gui +LastFound +OwnDialogs +AlwaysOnTop 375 | InputBox, f_input,Candy InputBox,`n`n Please Input your parameter: ,, 285, 175,,,,, 376 | If ErrorLevel 377 | Return 378 | Else 379 | StringReplace,Candy_value,Candy_value,{box:input},%f_input%,All 380 | } 381 | IfInString,Candy_value,{box:password} 382 | { 383 | Gui +LastFound +OwnDialogs +AlwaysOnTop 384 | InputBox, f_password,Candy PasswordInputBox,`n`n Please Input your Password: ,Hide, 285, 175,,,,, 385 | If ErrorLevel 386 | Return 387 | Else 388 | StringReplace,Candy_value,Candy_value,{box:password},%f_password%,All 389 | } 390 | IfInString,Candy_value,{box:filebrowser} 391 | { 392 | FileSelectFile, f_File , , , Select a File, 393 | If f_File <> 394 | StringReplace,Candy_value,Candy_value,{box:filebrowser},%f_File%,All 395 | Else 396 | Return 397 | } 398 | IfInString,Candy_value,{box:folderbrowser} 399 | { 400 | FileSelectFolder, f_Folder , , , Select a folder, 401 | If f_Folder <> 402 | StringReplace,Candy_value,Candy_value,{box:folderbrowser},%f_Folder%,All 403 | Else 404 | Return 405 | } 406 | 407 | If (CandySelected_FileExtension="MultiFiles") 408 | { 409 | Goto Label_Multifiles 410 | Return 411 | } 412 | If(RegExMatch(Candy_Value,"i)^(web\|)")) ;web|p1|p2 413 | { 414 | StringSplit,Splitted_Candy_Value,Candy_Value,| 415 | CandySelected_FileExtension_Enc := SksSub_UrlEncode(CandySelected_FileExtension,Splitted_Candy_Value3) 416 | CandySelected_FileNamenoExt_Enc := SksSub_UrlEncode(CandySelected_FileNamenoExt,Splitted_Candy_Value3) 417 | CandySelected_Enc := SksSub_UrlEncode(CandySelected,Splitted_Candy_Value3) 418 | StringReplace,Candy_Http,Splitted_Candy_Value2,{file:ext},%CandySelected_FileExtension_Enc% 419 | StringReplace,Candy_Http,Candy_Http,{file:namenoext},%CandySelected_FileNamenoExt_Enc% 420 | StringReplace,Candy_Http,Candy_Http,{text:selected},%CandySelected_Enc% ;因为前面两个替换都是针对文件路径的,有了冒号的限制,不会产生二次替换 421 | Candy_Http="%Candy_Http%" 422 | SksSub_WebSearch(Candy_CurrWin_Fullpath,Candy_Http,candy_UserdBrowsers,candy_DefaultBrowser) 423 | Return 424 | } 425 | 426 | If Flag_isFile=1 427 | { 428 | StringReplace,Candy_value,Candy_value,{file:ext} ,%CandySelected_FileExtension%,All ;后缀 429 | StringReplace,Candy_value,Candy_value,{file:pathonly} ,%CandySelected_FilePathOnly%,All ;不带文件名的路径 430 | StringReplace,Candy_value,Candy_value,{file:namenoext} ,%CandySelected_FileNamenoExt%,All ;纯粹的文件名,无后缀,无路径 431 | StringReplace,Candy_value,Candy_value,{file:foldername} ,%CandySelected_FileFolderName_Uplevel%,All ;上级文件夹名 432 | StringReplace,Candy_value,Candy_value,{file:linktarget} ,%Candy_linkTarget%,All ;lnk的目标 433 | StringReplace,Candy_value,Candy_value,{file:pathfull} ,%CandySelected%,All ;全部选中的 434 | } 435 | Else If Flag_isFile=0 436 | { 437 | StringReplace,Candy_value,Candy_value,{text:selected} ,%CandySelected%,All ;全部选中的 438 | } 439 | 440 | 441 | ;---------------------------------------------------------------------------------------------------------- 442 | ;以上替换工作结束,就是运行了 443 | ;---------------------------------------------------------------------------------------------------------- 444 | StringSplit,Splitted_Candy_Value,Candy_Value,| ;对指令进行|分割,分割出的第一个一般来说是指令,除非默认的run 445 | 446 | If(RegExMatch(Candy_Value,"i)^(config\|)")) ;如果是以config|开头,则是编辑配置文件,直接运行结束 447 | { 448 | Goto Label_Candy_Editconfig 449 | } 450 | Else If (RegExMatch(Candy_Value,"i)^(Cando\|)")) ;如果是以Cando|开头,则是运行一些内部程序,方便与你的其它脚本进行挂接 451 | { 452 | Label_Cando=Cando_%Splitted_Candy_Value2% 453 | If IsLabel(Label_Cando) ;程序内置的别名 454 | Goto %Label_Cando% 455 | Else 456 | Goto Label_Candy_ErrorHandle 457 | } 458 | Else If (RegExMatch(Candy_Value,"i)^(Ahk\|)")) 459 | { 460 | IfExist,%Candy_action_p1% ;外部的ahk代码段,你的ahk一般而言可以带参数 461 | Run %程序路径_Autohotkey% %Splitted_Candy_Value2% 462 | Else 463 | Goto Label_Candy_ErrorHandle 464 | } 465 | Else If (RegExMatch(Candy_Value,"i)^(Keys\|)")) ;如果是以keys|开头,则是发热键 466 | { 467 | SendInput {ctrl up}{shift up}{alt up} 468 | SendInput %Splitted_Candy_Value2% 469 | } 470 | Else If (RegExMatch(Candy_Value,"i)^(SetClipBoard\|)")) ;纯粹的置粘贴板动作,这个与前面的{setclipboard:pure}{setclipboard:rich}不一样 471 | { 472 | Clipboard:=Splitted_Candy_Value2 473 | } 474 | Else If (RegExMatch(Candy_Value,"i)^(Run\|)")) ;是运行 475 | { 476 | Run,%Splitted_Candy_Value2% ,%Splitted_Candy_Value3%,%Splitted_Candy_Value4% UseErrorLevel,Candy_PidA ;1:程序 2:工作目录 3:状态 477 | If ErrorLevel = Error ;如果运行出错的话 478 | Goto Label_Candy_ErrorHandle 479 | } 480 | Else ;如果没有以上的指令,说明指令被省略,默认是运行 481 | { 482 | Run,%Splitted_Candy_Value1% ,%Splitted_Candy_Value2%,%Splitted_Candy_Value3% UseErrorLevel,Candy_PidA ;1:程序 2:工作目录 3:状态 483 | If ErrorLevel = Error ;如果运行出错的话 484 | Goto Label_Candy_ErrorHandle 485 | } 486 | Return 487 | 488 | 489 | ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 490 | Label_Candy_Editconfig: 491 | IfnotExist %程序路径_默认文本编辑器% 492 | 程序路径_默认文本编辑器= 493 | If i=0 494 | { 495 | cmd=%程序路径_默认文本编辑器%%A_Space%%Candy_IniFile% 496 | ; MsgBox %cmd% 497 | Run,% trim(cmd),,useerrorlevel 498 | } 499 | Else Loop %i% 500 | { 501 | cmd:=程序路径_默认文本编辑器 A_Space Candy_IniFile%A_index% 502 | Run,% trim(cmd),,useerrorlevel 503 | } 504 | Return 505 | 506 | Label_Candy_ErrorHandle: 507 | IniRead,Flag_ShowCandyError,%Candy_IniFile%,Candy_Settings,ShowError,0 508 | If Flag_ShowCandyError=1 ;看看出错提示开关打开了没有,打开了的话,就显示出错信息 509 | { 510 | MsgBox, 4116,, "Config Error,Check it now?" 511 | IfMsgBox Yes 512 | Goto Label_Candy_Editconfig 513 | } 514 | Return 515 | ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 516 | 517 | #Include Candy_include.ahk 518 | #Include Candy_multifiles.ahk -------------------------------------------------------------------------------- /Candy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/Candy.exe -------------------------------------------------------------------------------- /Candy_include.ahk: -------------------------------------------------------------------------------- 1 | SksSub_WebSearch(s_CurrWin_Fullpath,s_Http,s_UserdBrowsers,s_DefaultBrowser) 2 | { 3 | If s_CurrWin_Fullpath Contains %s_UserdBrowsers% ;第①步,如果当前激活的窗口是浏览器,则就在本浏览器里面打开 4 | { 5 | Run,%s_CurrWin_Fullpath%%A_Space%%s_Http% 6 | Return 7 | } 8 | Else 9 | { 10 | Loop,Parse,s_UserdBrowsers,`, ;第②步,看进程里面有没有浏览器 11 | { 12 | If A_LoopField= 13 | Continue 14 | Process,exist,%A_LoopField% 15 | If ErrorLevel!=0 16 | { 17 | WinGet, Running_Browser_Fullpath,ProcessPath,Ahk_PID %ErrorLevel% 18 | If Running_Browser_Fullpath= 19 | { 20 | Run iexplore.exe %s_Http% 21 | } 22 | Else 23 | { 24 | Run, %Running_Browser_Fullpath%%A_Space%%s_Http% 25 | IfInString Running_Browser_Fullpath,firefox.exe 26 | WinActivate,Ahk_Class MozillaWindowClass 27 | Else 28 | WinActivate Ahk_PID %ErrorLevel% 29 | } 30 | Return 31 | } 32 | } 33 | s_DefaultBrowser_test:= RegExReplace(s_DefaultBrowser, "exe[^!]*[^>]*", "exe") ;第③,都没有则启用默认浏览器了 34 | IfExist %s_DefaultBrowser_test% 35 | { 36 | 37 | ; MsgBox,%s_DefaultBrowser%%A_Space%%s_Http% 38 | Run,%s_DefaultBrowser%%A_Space%%s_Http% 39 | Return 40 | } 41 | Else ;第④步,如果默认浏览器没有定义,则用系统的默认浏览器 42 | { 43 | Run,%s_Http% 44 | Return 45 | } 46 | } 47 | } 48 | 49 | 50 | ;============================================================================================================ 51 | SksSub_UrlEncode(str, enc) 52 | { 53 | If enc= 54 | Return %str% 55 | Else 56 | { 57 | hex := "00", func := "msvcrt\" . (A_IsUnicode ? "swprintf" : "sprintf") 58 | VarSetCapacity(buff, size:=StrPut(str, enc)), StrPut(str, &buff, enc) 59 | While (code := NumGet(buff, A_Index - 1, "UChar")) && DllCall(func, "Str", hex, "Str", "%%%02X", "UChar", code, "Cdecl") 60 | encoded .= hex 61 | Return encoded 62 | } 63 | } 64 | ;============================================================================================================ 65 | 66 | 67 | /* 正则方式在ini文件的某个字段内查找,某Sks_Key,如果找到,则返回这个字段 68 | 找不到,则返回原值 69 | */ 70 | SksSub_Ini_RegexFindKey(Sks_IniFile,Sks_Section,Sks_Key) 71 | { 72 | IniRead,Sks_All_keys,%Sks_IniFile%,%Sks_Section%, ;提取[associations]段里面所有的群组 73 | Loop,Parse,Sks_All_keys,`n 74 | { 75 | StringSplit,line,A_LoopField,= 76 | If(RegExMatch(line1, Sks_Key)) 77 | { 78 | Return,%line1% 79 | Break 80 | } 81 | } 82 | Return %Sks_Key% 83 | /*返回原值,纯粹是为了迎合Candy、Windy的需求 84 | */ 85 | } 86 | 87 | 88 | -------------------------------------------------------------------------------- /Candy_multifiles.ahk: -------------------------------------------------------------------------------- 1 | ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2 | Label_Multifiles: 3 | multifiles_list:= 4 | Array_Mulitfiles_Value1:= 5 | Array_Mulitfiles_Value2:= 6 | Array_Mulitfiles_Value3:= 7 | 8 | Loop,Parse,candyselected,`n,`r 9 | { 10 | IfInString, CandySelected_FileAttrib, D ;Attrib= D ,则是文件夹 11 | { 12 | SplitPath,A_loopfield,,multifiles_filepath,,multifiles_filename, 13 | SplitPath,multifiles_filepath,,,,multifiles_FileFolderName_Uplevel, 14 | } 15 | Else 16 | { 17 | SplitPath ,A_loopfield,,multifiles_filepath,multifiles_ext,multifiles_filename 18 | SplitPath,multifiles_filepath,,,,multifiles_FileFolderName_Uplevel, 19 | } 20 | Break ;只取第一个文件(夹),作为多文件的文件路径 multifiles_filepath,以及其所在的文件夹名称multifiles_FileFolderName_Uplevel 21 | } 22 | If(RegExMatch(Candy_Value,"i)^(run\|)")) ;可以加run|前冠,也可以不加 23 | { 24 | StringReplace ,Candy_Value,Candy_Value,run|,, 25 | } 26 | StringSplit,Array_Mulitfiles_Value,Candy_Value,| 27 | 28 | If(RegExMatch(Array_Mulitfiles_Value2,"i)^(ex:)")) 29 | { 30 | StringReplace ,Array_Mulitfiles_Value2,Array_Mulitfiles_Value2,ex:,, 31 | Loop,Parse,candyselected,`n,`r 32 | { 33 | SplitPath,A_loopfield,,,_ext 34 | If _ext In %Array_Mulitfiles_Value2% ;如果在过滤列表里面,就pass掉 35 | Continue 36 | multifiles_list=%multifiles_list%%A_space%"%A_LoopField%" 37 | } 38 | } 39 | 40 | Else If(RegExMatch(Array_Mulitfiles_Value2,"i)^(in:)")) 41 | { 42 | StringReplace ,Array_Mulitfiles_Value2,Array_Mulitfiles_Value2,in:,, 43 | Loop,Parse,candyselected,`n,`r 44 | { 45 | SplitPath,A_loopfield,,,_ext 46 | If _ext Not In %Array_Mulitfiles_Value2% ;如果不在包含列表里面,就pass 47 | Continue 48 | multifiles_list=%multifiles_list%%A_space%"%A_LoopField%" 49 | } 50 | } 51 | Else 52 | { 53 | Loop,Parse,candyselected,`n,`r 54 | multifiles_list=%multifiles_list%%A_space%"%A_LoopField%" 55 | } 56 | 57 | ; MsgBox %multifiles_list% 58 | StringReplace multifiles_run_str ,Array_Mulitfiles_Value1,{mfile:list},%multifiles_list% 59 | StringReplace multifiles_run_str ,multifiles_run_str,{mfile:pathonly},%multifiles_filepath% 60 | StringReplace multifiles_run_str ,multifiles_run_str,{mfile:foldername},%multifiles_FileFolderName_Uplevel% 61 | Sleep 50 62 | ; MsgBox %multifiles_run_str% 63 | Run,%multifiles_run_str% 64 | Return 65 | ;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -------------------------------------------------------------------------------- /Candy简明帮助.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/Candy简明帮助.chm -------------------------------------------------------------------------------- /ini/Candy1/Candy1.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy1/Candy1.ini -------------------------------------------------------------------------------- /ini/Candy2/Candy2.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy2/Candy2.ini -------------------------------------------------------------------------------- /ini/Candy3/Ahk.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/Ahk.ini -------------------------------------------------------------------------------- /ini/Candy3/Candy3.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/Candy3.ini -------------------------------------------------------------------------------- /ini/Candy3/Dll.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/Dll.ini -------------------------------------------------------------------------------- /ini/Candy3/Exe.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/Exe.ini -------------------------------------------------------------------------------- /ini/Candy3/Ioi.ini: -------------------------------------------------------------------------------- 1 | [Configuration] 2 | truecrypt =z:\kini\vdisk\tc\tc.exe "{file:pathfull}" -------------------------------------------------------------------------------- /ini/Candy3/Iso.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/Iso.ini -------------------------------------------------------------------------------- /ini/Candy3/Pdf.ini: -------------------------------------------------------------------------------- 1 | [Configuration] 2 | foxit editor =z:\kini\office\pdf\foxit editor\pdfedit.exe "{file:pathfull}" 3 | foxit phantom =z:\kini\office\pdf\foxit phantom\foxit phantom.exe "{file:pathfull}" 4 | foxit orgnizer =z:\kini\office\pdf\foxit organizer\fpdfpo.exe "{file:pathfull}" 5 | sumatrapdf =z:\kini\office\pdf\sumatrapdf\sumatrapdf.exe "{file:pathfull}" 6 | -= 7 | pdf2word =z:\kini\office\pdf\pdf toolkit\verypdf pdf2word\pdf2word.exe "{file:pathfull}" 8 | pdfxchanger =Z:\Kini\Office\Pdf\Pdfxcview\PDF Viewer\PDFXCview.exe "{file:pathfull}" 9 | -= 10 | -------------------------------------------------------------------------------- /ini/Candy3/torrent.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/torrent.ini -------------------------------------------------------------------------------- /ini/Candy3/压缩文件.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/压缩文件.ini -------------------------------------------------------------------------------- /ini/Candy3/图标文件.ini: -------------------------------------------------------------------------------- 1 | [Configuration] 2 | icofx1 =z:\kini\image\icon\icofx\icofx1\icofx.exe "{file:pathfull}"|z:\kini\image\icon\icofx\icofx2\icofx1.exe 3 | icofx2 =z:\kini\image\icon\icofx\icofx2\icofx2.exe "{file:pathfull}"|z:\kini\image\icon\icofx\icofx2\icofx2.exe 4 | -= 5 | iconlover =z:\kini\image\icon\iconlover\iconlover\iconlover.exe "{file:pathfull}" 6 | -= -------------------------------------------------------------------------------- /ini/Candy3/图片文件.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/图片文件.ini -------------------------------------------------------------------------------- /ini/Candy3/文件夹.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/文件夹.ini -------------------------------------------------------------------------------- /ini/Candy3/文本文件.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/文本文件.ini -------------------------------------------------------------------------------- /ini/Candy3/短文本.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/短文本.ini -------------------------------------------------------------------------------- /ini/Candy3/磁盘.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/磁盘.ini -------------------------------------------------------------------------------- /ini/Candy3/网址.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/网址.ini -------------------------------------------------------------------------------- /ini/Candy3/视频文件.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/视频文件.ini -------------------------------------------------------------------------------- /ini/Candy3/通用.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/通用.ini -------------------------------------------------------------------------------- /ini/Candy3/通用折叠.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/通用折叠.ini -------------------------------------------------------------------------------- /ini/Candy3/长文本.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy3/长文本.ini -------------------------------------------------------------------------------- /ini/Candy3/音频文件.ini: -------------------------------------------------------------------------------- 1 | [Configuration] 2 | audacity =z:\kini\multimedia\record\audacity\audacity.exe "{file:pathfull}" 3 | meda =z:\kini\multimedia\tool aduio\meda\meda.exe "{file:pathfull}" 4 | mp3mate =z:\kini\multimedia\tool aduio\mp3 splitter & joiner pro\mp3matepro.exe "{file:pathfull}" 5 | directcut =z:\kini\multimedia\tool aduio\mp3directcut\mp3directcut.exe "{file:pathfull}" 6 | mp3gain =z:\kini\multimedia\tool aduio\mp3gain\mp3gaingui.exe "{file:pathfull}" 7 | -= 8 | -------------------------------------------------------------------------------- /ini/Candy4/Candy4.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/ini/Candy4/Candy4.ini -------------------------------------------------------------------------------- /ini/candycfg.ini: -------------------------------------------------------------------------------- 1 | [configuration] 2 | used_browser =firefox.exe,chrome.exe,maxthon.exe,theworld.exe,360se.exe,opera.exe,iron.exe,greenbrowser.exe,iexplore.exe,qqbrowser.exe 3 | default_browser =z:\kini\www\web\firefox\FireFox\firefox.exe -profile z:\kini\www\web\firefox\[yxh_FireFox] /Prefetch:1 4 | default_texteditor =Z:\Kini\Text\Edit\NotepadPP\NotepadPP\notepad++.exe 5 | -------------------------------------------------------------------------------- /v1.73更新内容.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/v1.73更新内容.txt -------------------------------------------------------------------------------- /说明.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hoekey/Candy/e6896c1a4cc9f600137700759b349c45f8951305/说明.txt --------------------------------------------------------------------------------