Make a PFKEY (Fnn key) always available in new session?
4 posts
• Page 1 of 1
Make a PFKEY (Fnn key) always available in new session?
I'm using Dyalog APL version 18.2 under Windows. Is there a way, in particular a "best" way, to pre-define a PFKEY (function key) so that it's always available when a new APL session starts? For example, if I want the characters "ABCDE" to be displayed when F9 is pressed, I could enter:
'ABCDE' ⎕PFKEY 9
while in an APL session. But I don't want to have to set the value of F9 every time I start an APL session. I want it to be already set whenever a session starts. I've looked at Options > Configure > Keyboard Shortcuts and don't see any way to set such a thing up there. I've looked at modifying the en-US.din file in the C:\Program Files\Dyalog\UnicodeIME\aplkeys directory, but can't find any documentation on how to set such a thing up there. I thought of using the ⎕SE.onCreate event (which runs when a session starts), but that is already set to call function ⎕SE.Dyalog.Callbacks.SECreate. I can modify that function to add a line to set ⎕PFKEY 9, but that seems somewhat dangerous to be modifying a function that could be changed by Dyalog in the future.
If there is a good way to do this, I'd like it to be something that can be set up under program control within an APL function, not something which would require a user to hand-modify some sort of configuration file.
Thanks for any thoughts / Rav
'ABCDE' ⎕PFKEY 9
while in an APL session. But I don't want to have to set the value of F9 every time I start an APL session. I want it to be already set whenever a session starts. I've looked at Options > Configure > Keyboard Shortcuts and don't see any way to set such a thing up there. I've looked at modifying the en-US.din file in the C:\Program Files\Dyalog\UnicodeIME\aplkeys directory, but can't find any documentation on how to set such a thing up there. I thought of using the ⎕SE.onCreate event (which runs when a session starts), but that is already set to call function ⎕SE.Dyalog.Callbacks.SECreate. I can modify that function to add a line to set ⎕PFKEY 9, but that seems somewhat dangerous to be modifying a function that could be changed by Dyalog in the future.
If there is a good way to do this, I'd like it to be something that can be set up under program control within an APL function, not something which would require a user to hand-modify some sort of configuration file.
Thanks for any thoughts / Rav
- Rav
- Posts: 31
- Joined: Tue Jul 25, 2023 4:41 pm
Re: Make a PFKEY (Fnn key) always available in new session?
Hi Rav
Your best bet is to create a function called "Setup" (the name is important) along the lines of
and then run
This will create the (text) file C:\Users\<your username>\Documents\MyUcmds\Setup.dyalog which will be run each time you start Dyalog APL.
You can edit Setup.dyalog as and when you want alter or extend the PFKEY definitions - or since it's just an APL function, do whatever you will when starting Dyalog APL. If you right click on the filename in Windows Explorer you'll be given the option to edit it in the Dyalog editor, but you can use whatever editor you prefer to use.
I assigned the result of ⎕pfkey solely to suppress it.
I can't take credit for most of this .. thanks goes to Adam in his post https://forums.dyalog.com/viewtopic.php?f=12&t=1332#p5332
Your best bet is to create a function called "Setup" (the name is important) along the lines of
Setup;sink
sink←'ABCDE' ⎕PFKEY 9
and then run
⎕SE.SALT.Save 'Setup ',⎕SE.SALTUtils.USERDIR,'MyUcmds\ -makedir'
This will create the (text) file C:\Users\<your username>\Documents\MyUcmds\Setup.dyalog which will be run each time you start Dyalog APL.
You can edit Setup.dyalog as and when you want alter or extend the PFKEY definitions - or since it's just an APL function, do whatever you will when starting Dyalog APL. If you right click on the filename in Windows Explorer you'll be given the option to edit it in the Dyalog editor, but you can use whatever editor you prefer to use.
I assigned the result of ⎕pfkey solely to suppress it.
I can't take credit for most of this .. thanks goes to Adam in his post https://forums.dyalog.com/viewtopic.php?f=12&t=1332#p5332
-
AndyS|Dyalog - Posts: 263
- Joined: Tue May 12, 2009 6:06 pm
Re: Make a PFKEY (Fnn key) always available in new session?
Just an additional reference. Adám also wrote a blog post:
https://www.dyalog.com/blog/2018/09/enh ... tion-keys/
https://www.dyalog.com/blog/2018/09/enh ... tion-keys/
- RichardP|Dyalog
- Posts: 33
- Joined: Fri Oct 12, 2018 3:05 pm
Re: Make a PFKEY (Fnn key) always available in new session?
This is great, thanks. One more question: Can there only be ONE named function, ∇Setup, which will automatically be run when Dyalog APL starts, or can there be others? The reason I ask is that I'm creating ∇Setup under program control, and if there's already one there (that presumably someone else wrote that does other types of setup) I don't want to stomp over it by overwriting it with my ∇Setup. And I'm not sure it would be safe to try to modify (under program control) a ∇Setup that someone else has already written to add what my ∇Setup does. If there's a way to have multiple ∇Setup-type functions that all get run when Dyalog APL starts, then if I detect that there's already an existing ∇Setup program I could just call mine something else. Thanks.
- Rav
- Posts: 31
- Joined: Tue Jul 25, 2023 4:41 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: Bing [Bot] and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group