Scripting in QWS3270P Pulse mainframes. - shell

I'm using qws3270P emulator to interact with mainframe. I just want to build/develop some script files. So that i can do 30m long repetitive process just by running the script file. The file format the emulator is accepting is .scr format. I have done a lot of research on it but i could not conclude with one. My interface has 3 screen to go to ISPF utilities. In first screen i need to type k, then enter, then next screen a, then next screen i need to enter User name and password, then enter then i will land to ISPF utilities
key "enter"
type "k"
Key "enter"
type "a"
key "enter"
type "username"
key "Tab"
key "password"
key "enter"
type "ispf"
In that emulator i could not able to go ispf. All the thing are projecting in Very first screen itself. Can anyone help me with this scripting code ?. i tried by using wait syntax also

Related

How to setup Toggle Key to display the shell script output during execution?

In my team they have asked me to create a shell script with toggle key option to display the command output/errors when a arrow key is pressed. And it need to hide the output when the same arrow key is pressed. Is there a way we can achieve this using a shell script?
I don't have a solution yet but the script which we are using now is throwing so many output and its making the screen loaded without so many lines of std output/errors during execution. And we would like to hide the output using the toggle key and when needed if we press a key it needs to display the output during execution.
No idea on how to start with this. Need some idea or thoughts on how to achieve this?
Expected:
Shrink the output using toggle key (say for example UP arrow key) and when needed if we press the same UP arrow key it need to display the output again.
Actual:
No code available as of now to do this function.

How to keep terminal input always at bottom in Golang?

I am trying to create a program which will have live updates from some data source. And I also want to wait for user input just like a normal terminal. Right now, whenever there is update, I will print the content and print the prompt message for input again which create something like this:
Enter command >
This is a live update message
Enter command >
This is a multi-line li......
......ve update message
Enter command > quit
Bye bye!
The problem is that for every live message I received, I will print it and the "Enter command >" will be displayed again again and again, which is not desired. I want the live update to be update on the main part of the terminal, while the "Enter command >" always stay at the bottom
The closest package I can found on Github is https://github.com/gizak/termui but most of the examples inside is trying to display text, gauge and graphs. So I am not quite sure how to get started.
Is there any package or example of the termui package to achieve this? Thank you.
With github.com/gizak/termui you're heading in the correct direction.
To understand why you can't get that
I want the live update to be update on the main part of the terminal, while the "Enter command >" always stay at the bottom
part sorted out, a little excursion to the history of computing is due. ;-)
The thing is, the mode your teminal emulator¹ works by default originated
in how computers would communicate to the operator in the era which predated
alphanumeric displays — they would print their responses using a line printer. Now think of it: a line printer works like this: it prints whatever is sent to it on a roll of paper. What was output, was output.
The new output always appears physically below the older.
When alphanumeric displays (screens) came into existence they
naturally continued to support this mode:
the line text to be output was rendered at the bottom of the screen
with the text above it scrolled upwards.
That's what you see in your typical terminal emulator all the time when you're working in the command line of a shell (such as bash) running by the emulator window.
This, default, work mode of a terminal is called "canonical" or "cooked".
Then came more advanced displays, for which it was possible to change
individual positions on the screen — identified by their column and
row numbers.
This changed the paradigm of how the information was output: the concept
of a so-called "full-screen application" was born.
Typical examples of them are text editors such as Vim and Emacs.
To support full-screen text output, terminals (and terminal emulators)
were adapted by implementing certain extensions to their protocols.
A full-screen application first requests the terminal to switch into another
mode called "raw", in which the terminal sends most of what is input by the
user directly to the program running on the terminal.
The program handles this input and orders the terminal where and what
to draw.
You can read this good summary
of the distinction between the both modes.
As you are supposedly suspecting by now, to be able to keep some block
of information at a certain fixed place of the terminal's text screen,
you want your program to be a full-screen program and use the terminal's
raw mode and its special commands allowing you to directly modify
text at certain character cells.
Now the problem is that different terminals (and terminal emulators)
have different commands to do that, so there exist libraries to isolate
the programs from these gory details. They rely on the special "terminal
information databases" to figure out what capabilities a terminal has
and how to make it do what the program asks.
See man terminfo for more background.
The most widely known such library (written in C) is called ncurses,
and there exist native solutions for Go with supposedly the most visible
one being github.com/nsf/termbox-go.
The github.com/gizak/termui makes use of termbox-go but for you it might
suffice to use the latter directly.
¹ Chances are very high you're not sitting at
a real hardware terminal
connected to a UNIX® machine but are rather working in a GUI application
such as GNOME Terminal or xterm or Termial.app etc.
These are not "terminals" per se but are rather
terminal emulators —
that is, pieces of software emulating a hardware terminal.

Hotkey field in XUL for Firefox

I have a Firefox extension written in XUL. It takes a hotkey. I want to have an input field where the user can press any key and I can programmatically determine what key was pressed.
I don't care about key combos which have meta meanings inside the OS (I don't need to capture Ctrl + Alt + Del).
If the key is already defined by Firefox, I'm OK with not capturing it (for instance, if the user presses F1 and help pops up instead of the key being captured, I'm fine).
I would also love to have some way to determine programmatically whether the key pressed already has some other meaning inside of Firefox, but that is likely out of scope for this request. I just mention it in case it's easy.
My current solution, which seems to have been adopted by a number of add-ons, is to provide a text box where the user can type a printable character and then a series of check boxes for modifier keys. This solution is barely workable but terrible for a number of reasons (it doesn't allow users to use non-printing keys such as function keys in their combos, it allows the user to input invalid characters (such as Unicode characters with no physical key on the keyboard), and it's just awkward to use).
Thanks!
You can use Inline Options
https://developer.mozilla.org/en-US/Add-ons/Inline_Options
You can detect the key pressed in the text input and write your modifiers like accel or alt.
Source example:
http://git.io/vez1o

Gnu Screen asks for password when I close a screen: what password does it want?

I have multiple screens running the same long process.
When I try to close one (C-a, x), I get a blank screen with:
Key: •
When I type anything and press return, I get:
Again: •
If it's different, I get "Passwords don't match" and if it's the same I get:
Screen used by Andrew Swift <local>.
Password:•
My administrator password doesn't work.
How can I close the screen correctly?
The CTRL-A x - mean "lock the screen".
So, it asking you for the locking password (of course twice). You can enter any string. Of course, when they did't matches it says mischmah.
After you locked the screen session, you need enter the password again for unlock the session. Simply enter the chosed password again.
Instead of locking, you can "detach the screen" session (CTRL-A D) or you simply use CTRL-D for ending the running shell..
C-a x is the default combination for "lock screen", not "close". It's asking for a password twice to set that password, so that you have to type it again to get back in.
The normal way to close a screen window is to exit the shell at its root, usually by typing exit. Pressing C-d (which sends an EOF character) may also work, depending on the shell.
I just came upon this "cheatsheet", which summarises the various commands quite well: http://aperiodic.net/screen/quick_reference

Type a pre defined text when a shortcut key is pressed in Windows 7

I work on mainframes and don't have much knowledge about windows other than playing warcraft :-) hence pardon me if I ask something nooby/silly.
I have a requirement to enter a particular long-text in the current position of a cursor whenever a shortcut key is pressed.
I am thinking of creating a bat file and assigning a windows keyboard shortcut to the bat file and whenever I have requirement to enter the long text, I press the windows shortcut key
and the long text gets typed in the current position of the cursor.
The current position of the cursor can be in any application, like Excel, Word or notepad or Windows dialog prompts.
Could you please let me know if this is possible and point me where I could get some information about this "technique".
Thanks & Regards,
Vasanth.S
To make a single key combo do what you are asking, you may need another program. You can make a link to a batch file, hook up a shortcut and then use the clip command to copy text from a file onto the clipboard. That would require the shortcut and then a Ctrl+V to paste. The batch file would look like this:
clip < c:\SomeDir\sometext.txt
You might like to look at using a clipboard manager - which saves a history of clipboard entries, can search for an entry, and paste it at the cursor.
Ditto and CLCL are both useful and free - which one you use depends on your windows version.
They are hotkey driven for ease of use, but mouse can be used.

Resources