Page 1 of 1

New scripts in scite/AHK with added settings

Posted: 24 Dec 2023, 18:57
by joed3isme
I searched and I searched but no can find! :headwall:
I want to have all my new scripts open in scite w/AHK with these parameters:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force ; this prevents the script from popping up the dialogue box warning if you start the program without shutting it down.
#MaxMem
DetectHiddenWindows, On ; unnecessary but left just in case of future changes.

I searched for hours to find how to add these to Sciteuser.properties which I believe is where to add the above. I looked at scite site,Googled and AHK Help but darned if I can find it. I am stumped and this is first time on forum.
Please help I would immensely appreciate it!

[Mod action: Moved topic from “Ask for Help (v2)”.]

Re: New scripts in scite/AHK with added settings

Posted: 24 Dec 2023, 22:46
by Datapoint
I just tried this and it seems to work: viewtopic.php?p=480175#p480175

Re: New scripts in scite/AHK with added settings

Posted: 25 Dec 2023, 11:34
by joed3isme
OK-Thanks!

Re: New scripts in scite/AHK with added settings

Posted: 25 Dec 2023, 12:33
by joed3isme
Hi
Question is there not a way to edit the current default template for a new script in scite/AHK ,if so where is that located ???
Thanks

Re: New scripts in scite/AHK with added settings

Posted: 25 Dec 2023, 23:24
by Datapoint
Look in C:\Windows\ShellNew\Template.ahk

Re: New scripts in scite/AHK with added settings

Posted: 26 Dec 2023, 18:41
by joed3isme
Hi
Thanks ,I edited that template before this question and it still comes up blank-untitled with SCite4AHK but the scriplet utility works, for pasting in to the blank script. I'll go with that for now! I'm just trying to get my bearings straight navigating through the folders and figuring out the whole scheme of things. I do appreciate your help, always!
Thanks so much!!
Joe

Re: New scripts in scite/AHK with added settings  Topic is solved

Posted: 26 Dec 2023, 19:39
by Datapoint
I was able to get it to work in SciTE4AutoHotkey. For what it's worth, my files are in the following locations.
  • C:\Users\MYUSERNAME\Documents\AutoHotkey\SciTE\NewAhk.lua

    Code: Select all

    -- https://www.autohotkey.com/board/topic/54431-scite4autohotkey-v3004-updated-aug-14-2013/page-62#entry568765
    if props["FileNameExt"] == "" and editor.Length == 0 and not buffer.templateLoaded then
        f = io.open(os.getenv("windir").."\\ShellNew\\Template.ahk", "r")
        if f then
            t = f:read("*all")
            if t:sub(1, 3) == "\239\187\191" then  -- UTF-8 BOM
                t = t:sub(4)
                scite.MenuCommand(IDM_ENCODING_UTF8)
            end
            editor:append(t)
            editor:EmptyUndoBuffer()
            editor:SetSavePoint()
            f:close()
        end
        buffer.templateLoaded = true
    end
  • C:\Users\MYUSERNAME\Documents\AutoHotkey\SciTE\SciTEUser.properties

    Code: Select all

    extension.*.ahk=$(SciteUserHome)\NewAhk.lua
  • C:\Windows\ShellNew\Template.ahk

    Code: Select all

    ; AHK script template
    ...

Re: New scripts in scite/AHK with added settings

Posted: 27 Dec 2023, 13:19
by joed3isme
BINGO!!! :superhappy:
That did it! I'm not sure why I couldn't grasp it from your previous link?? Brain freeze or old age possibly :D .
I created the NewAhk.lua, copied the info in to that and added the SciTEUser.properties info in "docs\AHK\scite" and viola .
I spent pretty much since Christmas afternoon till now , just couldn't seem to decipher all I searched and your very helpful instruction
but when I saw your last post it clicked. So I had no link basically to C:\Windows\ShellNew\Template.ahk now I can edit that.
THANK YOU SO SO MUCH!!!
Joe