| Title: | -={ H A C K E R S }=- | 
| Notice: | Write locked - see NOTED::HACKERS | 
| Moderator: | DIEHRD::MORRIS | 
| Created: | Thu Feb 20 1986 | 
| Last Modified: | Mon Aug 03 1992 | 
| Last Successful Update: | Fri Jun 06 1997 | 
| Number of topics: | 680 | 
| Total number of notes: | 5456 | 
  I'm connected to a LAT or DECserver and have running 
  2 data entry sessions simultanously on my terminal.
  Now I want to go from one session into the other and back and forth.
  I do that in issueing the Break key and the <Ctrl> W . 
  Is there a better way, I would like to have that sequence just
  assigned to one key without changing any code of the 2 applications.
  Thanks 
         Ulrich    
| T.R | Title | User | Personal Name | Date | Lines | 
|---|---|---|---|---|---|
| 620.1 | Use <Ctrl>~ | SHIRE::MORIAUD | Jean-Charles, Geneva Mgt. Science | Fri Dec 04 1987 06:04 | 9 | 
| 
    At the Local> prompt just enter:
    
    Local> Set Forward <Ctrl>~
    
    Thus pressing <Ctrl>~ at any time will forward you to your next session.
    
    Jean-Charles.
    
 | |||||
| 620.2 | again | KBOV06::KRATZ | Ulrich Kratz - Technical IS , KBO | Fri Dec 04 1987 07:54 | 5 | 
|     Yes, that's what I'm doing but in addition I have to refresh my
    data entry Screens. Now is there a way to define just one key for
    the <Ctrl>~ and <Ctrl> w, without having to change my TDMS code.
    
    Ulrich
 | |||||
| 620.3 | Unless you are using a VT52 maybe? | NIGEL::ROBERTS | Same procedure as every year | Fri Dec 04 1987 08:20 | 7 | 
|     How about using UDKs? If you have a modern terminal (i.e. one with
    an LK-201 keyboard) you can have User Defined Keys. Take a look
    at the VT200 Programmer's manual. (Can't find mine right now, otherwise
    I'd post the escape sequences here).
    
    Good luck,
    	Nigel.
 | |||||
| 620.4 | SNDCSL::SMITH | William P.N. (WOOKIE::) Smith | Fri Dec 04 1987 10:51 | 4 | |
|     Or get a really modern terminal like a VT330 that will run multiple
    sessions.  Or hack a VT-240 into an -MX to make it support sessions.
    
    Willie
 | |||||
| 620.5 | Here's some code to DO it | THE780::MESSENGER | Things fall apart-it's scientific | Fri Dec 04 1987 18:31 | 152 | 
|     
    I have a program that will load the UDKs on a VT-2xx terminal:
    (following the form-feed)
    
/*
*	controls.c -- program vt220 special function keys
*/
#include stdio
#include ctype
#define TRUE -1
#define FALSE 0
main()
{
	char line[80], prefix;
	int good, key;
	
        good	= FALSE;
	while(!good)
	{
		printf("Enter key to program (Fxx): ");
		gets(line);
		if(strlen(line) == 0 || strcmp(line, "exit") == 0 ||
			strcmp(line,"EXIT") == 0)
		{
			good	= TRUE;
			continue;
		}
		if(strcmp(line,"clear") == 0 || strcmp(line,"CLEAR") == 0)
		{
			clearkeys();
			continue;
		}
		if(strcmp(line,"lock") == 0 || strcmp(line,"LOCK") == 0)
		{
			lockkeys();
			continue;
		}         
		key	= keyeval(line);
		printf("Enter value to program into that key: ");
		gets(line);
		cook(line); 
		tohex(line);
		program_key(key, line);
	}                               
}
                            
clearkeys()
{
	printf("\033P0;1|\033\\");
}                                       
                   
program_key(key, string)
	int key;
	char *string;
{
	printf("\033P1;1|%d/%s\033\\", key, string);
}
lockkeys()
{
	printf("\033P1;0|\033\\");
}                                       
int keyeval(string)
	char *string;
{
        int num, retval;
	num	= atoi(string);
	retval	= num + 11 + ((num>10) ? 1 : 0) + ((num>14) ? 1 : 0);
 	return(retval);
}	
tohex(string)
	char *string;
{
	char retn[80];
	int i;
	strcpy(retn, string);
	for(i=0; i<strlen(retn); i++)
		sprintf(string+i*2, "%02x", (unsigned char)retn[i]);
	string[i*2+1]	= 0;
}                                               
cook(string)
	char *string;
{
	char save[80], obuf[4];
	int i, j, k;
	strcpy(save, string);
	j	= 0;
	for(i=0; i<strlen(save); i++)
	{
		if(save[i] != '\\')
		{
			string[j++]	= save[i];
			continue;
		}
		++i;
		switch(save[i])                         
		{
			case 'r':
			case 'R':			
		 		string[j++]	= '\r';
				break;
    			case 'e':
			case 'E':
				string[j++]	= '\033';
				break;
			case 'n':
			case 'N':
				string[j++]	= '\n';
				break;
			case 't':
			case 'T':
				string[j++]	= '\t';
				break;
			case 'v':
			case 'V':
				string[j++]	= '\v';
				break;
			case 'f':
			case 'F':
				string[j++]	= '\f';
				break;
			case '\\':
				string[j++]	= '\\';
				break;
			case '\'':
				string[j++]	= '\'';
				break;
			default:
				if(!isdigit(save[i]))
				      	break;
				k	= 0;
				while(k != 3 && isdigit(save[i]))
					obuf[k++] = save[i++];
				--i;                           
				obuf[k]	= 0;
   				string[j++]	= (unsigned char)atoi(obuf);
		}
	}
	string[j]	= 0;
}
				
    
 | |||||
| 620.6 | CTRL/BREAK works for me. | COL01::LELIE | PLUGH! -- nothing happens. | Mon Dec 07 1987 06:28 | 14 | 
| re < Note 620.2 by KBOV06::KRATZ "Ulrich Kratz - Technical IS , KBO" >
                                   -< again >-
>    ...Now is there a way to define just one key for
>    the <Ctrl>~ and <Ctrl> w, without having to change my TDMS code.
Go into terminal SETUP/KEYBOARD/ANSWERBACK (assuming that you use a
VT200 series terminal) and set the answerback message to <CTRL>~ <CTRL>W
(and save that). Now when you want to change the session, just type
<CTRL><F5>. That sends the answerback message to the host and does what
you want. 
Regards,
	-Peter
 | |||||