Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sites= Winmove|WinMaximize|WinMinimize|WinClose
- ;file menu
- Menu, FileMenu, Add, Run F1, runnow
- Menu, FileMenu, Add, Clear F2, clearall
- Menu, FileMenu, Add,
- Menu, FileMenu, Add, Save Ctrl+s, savenow
- Menu, FileMenu, Add, Exit F12, GuiClose
- ;sample menu
- Menu, SampleMenu, Add, Toggle If, togglesample1
- ;Menu, SampleMenu, Add, Toggle While, togglesample2
- ;aboutmenu
- Menu, AboutMenu, Add, Info, infobox
- ; Attach the sub-menus that were created above.
- Menu, MyMenuBar, Add, File, :FileMenu
- Menu, MyMenuBar, Add, Samples, :SampleMenu
- Menu, MyMenuBar, Add, About, :AboutMenu
- Gui, Menu, MyMenuBar ; Attach MyMenuBar to the GUI
- Gui, Add, Edit, x12 y9 w440 h350 vcodestring +Multi +WantTab,
- Gui, Add, Button, x12 y369 w70 h50 grunnow, RUN
- Gui, Add, Button, x92 y369 w70 h50 gclearall, CLEAR
- Gui, Add, ListBox, x462 y9 w200 h354 vcommandlookup, %sites%
- Gui, Add, Button, x462 y359 w90 h30 gDOCgo, DOC
- Gui, Add, Button, x572 y359 w90 h30 gYTgo, YT
- Gui, Add, Edit, x462 y399 w200 h20 gsearchchange vSearch,
- Gui, Add, Text, x182 y389 w260 h20 vsynhelp ginputsyn, %synhelp%
- Gui, Add, GroupBox, x172 y369 w280 h50 , Syntax Helper --- Click to auto fill
- Gui, Show, x615 y348 h432 w682, Code Tester v.1.1
- Return
- ;==================================================
- ;save code
- ;==================================================
- savenow:
- Gui,Submit,NoHide
- InputBox, filename, Enter File Name, Name your file and will be saved at desktop as AHK file.
- FileAppend, %codestring%, %A_Desktop%\%filename%.ahk
- Return
- ;==================================================
- ;syntx helper
- ;==================================================
- :*?b0:msgbox::
- GuiControl, , synhelp, MsgBox , Options, Title, Text, Timeout
- synhelp=, Options, Title, Text, Timeout
- Return
- inputsyn:
- Gui,Submit,NoHide
- send %synhelp%
- Return
- ;==================================================
- ;Sample drop down
- ;==================================================
- togglesample1:
- sampleshow =
- (
- Toggle := !Toggle`r
- If Toggle`r
- msgbox,T=1`r
- else`r
- msgbox,T=0`r
- return
- )
- clipboard = %sampleshow%
- msgbox, Copied to clipboard `n`n`n %sampleshow%
- Return
- sampleshow:
- Gui,Submit,NoHide
- ;Toggle if
- if samplepick = Toggle If
- {
- sampleshow =
- (
- Toggle := !Toggle`r
- If Toggle`r
- msgbox,T=1`r
- else`r
- msgbox,T=0`r
- return
- )
- clipboard = %sampleshow%
- msgbox, Copied to clipboard `n`n`n %sampleshow%
- Return
- }
- Return
- ;==================================================
- ;search updater
- ;==================================================
- ; on edit change
- searchchange:
- Gui,Submit,NoHide
- if !(InStr(sites, commandlookup, false)) {
- #Persistent
- GuiControl, , commandlookup
- return
- }
- sitesArr := StrSplit(sites, "|")
- newArr := []
- newStr := ""
- for k,v in sitesArr
- {
- if InStr(v, Search, false)>0
- {
- newArr.push(v)
- }
- }
- for k,v in newArr
- newStr .= "|" v
- GuiControl, , commandlookup, % newStr
- GuiControl, Choose, commandlookup, 1
- Return
- ;==================================================
- ;YouTube links
- ;==================================================
- YTgo:
- gui, submit, nohide
- if commandlookup = Winmove
- {
- run, "https://www.youtube.com/watch?v=bQmfe04o1uI&list=PLfHPAKSz_DJqmJJIW1P3DM9hMlaP24ivp&index=7&t=146s"
- }
- gui, submit, nohide
- if commandlookup = WinMaximize
- {
- run, https://www.youtube.com/watch?v=bQ
- }
- gui, submit, nohide
- if commandlookup = WinMinimize
- {
- run, https://www.youtube.com/watch?v=bQ
- }
- gui, submit, nohide
- if commandlookup = WinClose
- {
- run, https://www.youtube.com/watch?v=bQ
- }
- Return
- ;==================================================
- ;AHK doc links
- ;==================================================
- DOCgo:
- gui, submit, nohide
- if commandlookup = Winmove
- {
- run, https://www.autohotkey.com/docs/commands/WinMove.htm
- }
- if commandlookup = WinMaximize
- {
- run, https://www.autohotkey.com/docs/commands/WinMaximize.htm
- }
- if commandlookup = WinMinimize
- {
- run, https://www.autohotkey.com/docs/commands/WinMinimize.htm
- }
- if commandlookup = WinClose
- {
- Run, https://www.autohotkey.com/docs/commands/WinClose.htm
- }
- return
- ;==================================================
- ;random gui contrals
- ;==================================================
- GuiClose:
- ExitApp
- clearall:
- GuiControl,, codestring,
- GuiControl, , synhelp,
- Return
- infobox:
- infoshow=
- (
- v1.1
- by TAB Nation
- Much to be done so let me know of any bugs at tadamm88@gmail.com
- ToDo:
- change between v1 and v2 code (v1 only right now)
- make pretty
- add all v1 commands to list with links
- add all commands to helper
- add syntax highlighting
- )
- msgbox, %infoshow%
- ;==================================================
- ;test run the code
- ;==================================================
- runnow:
- gui, submit, nohide
- ;InputBox, codestring, Enter code, Enter one line code
- PipeRun(codestring)
- return ; End of auto-execute
- PipeRun(Script) {
- pipe := "\\.\pipe\AHK" A_TickCount
- loop 2 {
- pipe%A_Index% := DllCall("Kernel32\CreateNamedPipe", "Str",pipe, "UInt",2
- , "UInt",0, "UInt",255, "UInt",0, "UInt",0, "UInt",0, "Ptr",0)
- }
- if (pipe1 = -1 || pipe2 = -1) {
- ErrorLevel := -1
- return false ; Couldn't create pipes
- }
- Run % A_AhkPath " " pipe,, UseErrorLevel
- if (ErrorLevel) {
- ErrorLevel := -2
- return false ; Couldn't run the pipe
- }
- DllCall("Kernel32\ConnectNamedPipe", "Ptr",pipe1, "Ptr",0)
- DllCall("Kernel32\CloseHandle", "Ptr",pipe1)
- DllCall("Kernel32\ConnectNamedPipe", "Ptr",pipe2, "Ptr",0)
- if (!FileOpen(pipe2, "h", "UTF-8").Write(Script)) {
- ErrorLevel := -2
- return false ; Couldn't write to pipe
- }
- DllCall("Kernel32\CloseHandle", "Ptr",pipe2)
- return true
- }
Add Comment
Please, Sign In to add comment