Creating arrow key navigation in a command line application? [duplicate] - ruby

This question already has an answer here:
How can I capture terminal arrow keys in Ruby?
(1 answer)
Closed 8 years ago.
I'm trying to dynamically generate a list from file names in a directory using Ruby.
I already have all the code, but my problem is the user interface. In programs such as "testdisk" and "photorec", menu navigation is done via the arrow keys and the enter key alone, without having to type out the name of the option.
Is there a way to reproduce this behavior in a Ruby program?

Ruby Toolbox is a great resource for finding gems that you can use, the link here pointing toward the search for 'curses'.
ncurses should work with any ANSI/Posix compliant system.

Related

How to grab keystrokes in Gnome Shell

I'm trying to write my first Shell extension and - as every blog post out there - I am too struggling with the lack of up-to-date documentation...
Namely I am trying to grab all key strokes from the keyboard, and - looking at code online and old mailing list messages - it seems that until recently the correct way of doing was:
const Shell = imports.gi.Shell;
global.set_stage_input_mode(Shell.StageInputMode.FULLSCREEN);
global.stage.connect('key-press-event', myCallbackHere);
However this doesn't seem to work. Both the function set_stage_input_mode and the property StageInputMode seem to have gone, at least on my Fedora 24 running GTK 3.20.6.
What is the correct, current way to have my extension grabbing all keystrokes performed by the user?
I don't think there is a correct way to do this at the moment. You could hack something together that is either X specific or Wayland specific or maybe you could patch Gnome Shell to provide this information.
For Wayland you could start at https://github.com/MaartenBaert/wayland-keylogger and for X you could start by looking at reusing the key detection from autokey (https://github.com/autokey/autokey/blob/master/src/lib/interface.py).
I can guess this is not the answer you were hoping for, because on IRC you wrote that you want to write a replacement for autokey. For getting input from an external program you can use GLib.spawn_async_with_pipes (https://people.gnome.org/~gcampagna/docs/GLib-2.0/GLib.spawn_async_with_pipes.html).
I wrote some time ago some Shell extension code to poll xinput test and log roughly what's happening (think any alphanumeric key vs left ctrl vs return key). You can look at that code here: https://gist.github.com/daniellandau/7679741bf8bbc5c345591593ca05e9f6. It's not robust enough for doing any kind of macro expansion so I'd recommend reusing the detection code from autokey.
In general the docs at https://people.gnome.org/~gcampagna/docs are the place to find API references for libraries usable from Gnome Shell extensions. I hope you get ahead with your project. Starting out writing extensions is frustrating but eventually very fun once you get the hang of it.

SAS Enterprise 5.1 Entering variable values via a GUI [duplicate]

This question already has answers here:
How to add input box to sas sql query which ask user about parameter?
(2 answers)
Closed 7 years ago.
I have several programs in SAS for database access and I was asked if I can put a GUI on top so that some "Analysts" can also use my programs without using code. I know this can be done in SAS. But how?
They basically want to change variables like start_date or other parameters and then hit a run button :-)
This can be done with prompts.
Right click your code in Enterprise Guide, then Properties.
You will then need to go to the prompt manager from there, and after creating the fields, you have to add them to your code.
There is a way to create this via base language, but I cannot test it, since it's not supported in my SAS environment.
Edit: THIS question has an example of how to do it with BASE. Written by SMW.

Where canI find AppleScript scriptable references? [duplicate]

This question already has answers here:
Applescript API documentation
(4 answers)
Closed 8 years ago.
I am reading an excellent article http://www.macosxautomation.com/applescript/features/system-prefs.html. The examples are good and easy to understand.
But now I have a question. The article only lists a few 'tell's, where can I find the complete references to those scriptable objects?
In your Applescript editor, you will find in the leftmost menu some reference named "Dictionaries".
Keep in mind that those are present only if the application you want to pilot via applescript is open.
I use Satimage's Smile to develop/debug my applescripts, but the native editor is OK as well.
You'll also receive help reading articles from places like MacScripter, Satimage's site, AppleScript Support COmmunities... and SOF :)

Localizing the display name of Windows Start Menu shortcuts

I want to allow the displayed name of my application's shortcut in the start menu to appear in the user's local language, if we have a string available for it.
I have found a question that deals with how the localized strings are referenced in storage, but while I could just muck around editing the desktop.ini file directly, I would highly prefer a fully programmatic interface for solving this issue, i.e. an API similar to the IShellLink and related interfaces already used to set up shortcuts. IShellFolder::SetNameOf initially sounded like it would be able to deal with this, but on my second read of that page, it seems it will always rename the physical file.
My application already uses indirect strings for having file associations localised in the shell, this wasn't a major issue setting up since it is well enough documented, but I can't seem to find much documentation on display names of shell links.
I am using InnoSetup for my installer.
That's almost embarrassing, right after posting the question I did another search on MSDN, and found this:
SHSetLocalizedName Sets the localized name of a file in a Shell folder.

How to create a system restore point? [duplicate]

This question already has answers here:
How to create a system restore point programmatically?
(3 answers)
Closed 2 years ago.
Installing paint.net, I found a string Creating system restore point...
I guess it is creating a restore point for Volume Shadow Service. -Isn't it? I'm not sure.
If I'm right, how do I do this in my app?
Let me know please if there are proper Apis.
You can do this using the System Restore API.
See the documentation for the SRSetRestorePoint function, along with adetailed example.

Resources