Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* INFO
- NAJEEB RUN SCRIPT DIRECTLY
- Written by: Najeeb Shah Khan (najeebshahkhan@gmail.com)
- Last Modified: 3-25-2023
- */
- ;#warn
- #NoEnv
- #SingleInstance
- ;#NoTrayIcon
- SetWorkingDir, %A_WorkingDir% ;%A_ScriptDir%
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- FileCreateDir, %A_ScriptDir%\DATA
- FileInstall , RUN-SCRIPT-DIRECTLY.ahk, %A_ScriptDir%\DATA\RUN-SCRIPT-DIRECTLY.ahk, 1
- FileSetAttrib +HS, %A_ScriptDir%\DATA\RUN-SCRIPT-DIRECTLY.ahk, 2
- FileSetAttrib +HS, %A_ScriptDir%\DATA, 2
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ClipSaved =
- ScriptText =
- F1:: ; F1 only: Run highlighted text
- ControlGetText, URL, Edit1, ahk_class IEFrame
- ClipSaved := ClipboardAll
- Send, ^c
- ifExist AHKscript.ahk
- FileDelete AHKscript.ahk
- ScriptText = `; %URL%`r`n`; `r`n%Clipboard%
- FileAppend, %ScriptText%`r`n, AHKscript.ahk
- Clipboard := ClipSaved
- ClipSaved =
- ScriptText =
- run, AHKscript.ahk
- Return
- F2:: ; F2: Edit then run
- ControlGetText, URL, Edit1, ahk_class IEFrame
- ClipSaved := ClipboardAll
- Send, ^c
- ifExist AHKscript.ahk
- FileDelete AHKscript.ahk
- ScriptText = `; %URL%`r`n`; `r`n%Clipboard%
- FileAppend, %ScriptText%`r`n, AHKscript.ahk
- Clipboard := ClipSaved
- ClipSaved =
- ScriptText =
- runwait, edit AHKscript.ahk
- run, AHKscript.ahk
- Return
- F3:: ; F3: Save last script
- IfExist AHKscript.ahk
- {
- FileSelectFile, destination, S16, %A_Desktop%, Save Script:, Autohotkey Scripts (*.ahk)
- If ERRORLEVEL
- Msgbox, Script not saved.
- Else
- {
- IfNotInString, destination, .ahk
- destination = %destination%.ahk
- FileCopy, AHKscript.ahk, %destination%, 1
- }
- }
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement