Hi Rainer,

This script looks for the existence of an optional *.rainer.conf* file in 
the parent directories.
If the file exists it reads it, parses it and acts in consequence.

Same logic could be applied based on project window names, document file 
types, document file languages, etc.

HTH

Jean Jourdain

--

    on readRainerConf(aFile)
        set vRainerConf to ".rainer.conf"
        tell application "Finder"
            set vContainer to container of file aFile
            repeat while true
                try
                    if exists file vRainerConf of vContainer then
                        set vConfFile to (file vRainerConf of vContainer) 
as alias
                        set vConfig to read vConfFile
                        return vConfig
                    end if
                    set vContainer to container of vContainer
                on error
                    exit repeat
                end try
            end repeat
            return missing value
        end tell
    end readRainerConf

    tell application "BBEdit"
        set vDocument to first document of first window
        if not vDocument's on disk then
            return
        end if
        -- Check for a configuration file.
        set vConfig to my readRainerConf(vDocument's file)
        -- Parse the the config and act appropriately.
        if vConfig contains "optionA" then
            set vCommand to "do A command"
        else if vConfig contains "optionB" then
            set vCommand to "do B command"
        else
            set vCommand to "do default command"
        end if
        display dialog vCommand
    end tell

On Thursday, February 3, 2022 at 3:48:38 PM UTC+1 Rainer Krug wrote:

> Hi
>
> Is it possible, to run project / folder specific keyboard shortcuts?
>
> In different projects I do different things regularly and would like to 
> put these in the same keyboard shortcut.
>
> Thanks,
>
> Rainer
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/adda5f27-59ec-4297-bff8-e91dc9eac85en%40googlegroups.com.

Reply via email to