Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Excel Labels - hotkeys 2016-02-01
- ;adds bookmark functionality in Notepad2 style
- ;requires ExcelGetCell() function to be accessible in Local Library
- ;------------------------------------------------------------------
- ;Ctrl+F1 ustaw zakładkę [set]
- ;F1 idź do następnej zakładki [go next]
- ;Shift+F1 idź do poprzedniej zakładki [go prev]
- ;----------------------------------------------------
- ;Select Load Settings from tray to LOAD
- ;Reload the script to RESET
- ;Reload twice to delete history
- ;--------------------------------------
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #LTrim ; Allows continuation sections to be indented. Positional. May be turned off via #LTrim Off
- #KeyHistory 0 ; Disable keyboard and mouse event history.
- #SingleInstance force
- #Warn ;requires ahk_L
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- Menu,tray,icon,C:\PATHTOYOUREXCEL\Microsoft Office\Office12\EXCEL.EXE,4
- Menu,tray,add
- Menu,tray,add,Load Settings,LoadSettings
- Menu,tray,add,Display,display
- StringTrimRight,file_ini,A_ScriptFullPath,3
- file_ini.="ini"
- list:=Array()
- i=0
- ;Gosub,LoadSettings ;uncomment this to always load previous settings on startup
- OnExit,ExitSub
- return ;autoexec
- GoThere:
- cell:=list[i]
- Send ^g
- ;this next line must be sendraw because of "!"
- SendRaw, % cell
- Send {ENTER}
- return
- ExitSub:
- FileDelete,%file_ini%
- s=
- Loop, % list.MaxIndex()
- s.=list[A_Index] . "`n"
- if StrLen(s)>4
- FileAppend,%s%,%file_ini%
- ExitApp
- return
- LoadSettings:
- Loop, Read, %file_ini%
- if StrLen(A_LoopReadLine)>=2
- list.Insert(A_LoopReadLine)
- return
- display: ;[display]
- s=
- Loop, % list.MaxIndex()
- s.=list[A_Index] . "`n"
- MsgBox, % s
- return
- #IfWinActive Microsoft Excel ahk_class XLMAIN
- F1::
- ;następna zakładka [next]
- i++
- if (i>list.MaxIndex())
- i:=list.MinIndex()
- GoSub,GoThere
- return
- +F1::
- ;poprzednia zakładka [prev]
- i--
- if (i<list.MinIndex())
- i:=list.MaxIndex()
- GoSub,GoThere
- return
- ^F1::
- ;ustaw zakładkę [set]
- cell:=ExcelGetCell()
- ;dbg InputBox,cell,,edit cell,,,,,,,,%cell%
- if cell
- {
- list.Insert(cell)
- TrayTip,Dodano zakładkę, % "[" . list.MaxIndex() . "]`t" . cell ;bookmark added
- } else {
- TrayTip,%A_ScriptName%,Nie znaleziono pozycji ;position not found
- }
- SetTimer,cls,-5000
- return
- cls:
- TrayTip
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement