cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

How to write a JSL implementation in JMP 17 to run another JSL on computer in JMP 16 that is already open?

If I have two different versions of JMP processes open at the same time in Windows 10.
I:\00\jmp17\jmp.exe
I:\00\jmp16\jmp.exe
JMP 17 is opened first.
How to write a JSL implementation in JMP 17 to run another JSL on computer in JMP 16 that is already open?
Note To speed up the response, it is required to run another JSL in JMP 16 that is already open
This screenshot is of JMP 16 already open

Thanks!

2023-11-14_10-30-34.png

3 REPLIES 3
peng_liu
Staff

Re: How to write a JSL implementation in JMP 17 to run another JSL on computer in JMP 16 that is already open?

There are a couple of options that I can think of:

1. Use Socket (check it out from Scripting Index). So, your JMP17 will talk to a port, and your JMP16 will listen to a port, and react accordingly.

2. Use "Run Program" (check it out from Scripting Index). For this, the JMP16 does not know the existence of JMP17.

 

Curious, why JMP17 and JMP16. Why not JMP17 and JMP17? Sounds like there is some inconvenience that you want to get around. What is that?

lala
Level VII

Re: How to write a JSL implementation in JMP 17 to run another JSL on computer in JMP 16 that is already open?

 
Yes, I often have multiple JMP processes open at the same time.
Use JMP16 and 17 simultaneously.It makes it easier to click.
 

Is it easier to listen if both processes are JMP 17?

How to implement it with JSL?

 

I am now using AutoHotkey to assist in the implementation.

Thanks Experts!

peng_liu
Staff

Re: How to write a JSL implementation in JMP 17 to run another JSL on computer in JMP 16 that is already open?

I don't think there is anything to stop you from running two or more JMP17 at the same time, other than resource consumption concerns. Having two JMP of the same version, save you some headaches from unexpected but possible compatibility issues.

 

Here is an example based on the example from OSI > Socket > Listen.

This is the script on the JMP that listens:

skt = socket();
skt << bind( "localhost", "80" );
skt << ioctl( FIONBIO, 1 );
skt << listen();

while ( 1,
	Wait( 1 );
	rc = skt << accept();
	If( Starts With( rc[2], "WOULDBLOCK" ),
		Print( "no connect attempt yet" )
	,
		If( rc[2] == "ok",
			remoteaddr = rc[3];
			Write( "\!nConnection from ", remoteaddr );
			conskt = rc[4]; 
			rc = conskt << recv( 1000 );
			show(rc);
			msg = Blob To Char( rc[3], encoding= "utf-8" );
			show(msg);
			if (msg=="Stop Listening", 
				skt << close(); 
				stop()
			);
			continue();
		,
			Show( rc );
			skt << close();
			stop();
		)
	);
);

This is the script on the JMP that talks:

skt = socket();
skt << connect( "localhost", "80" );
skt << send(Char to Blob("Hello world!"));
skt << close();


skt = socket();
skt << connect( "localhost", "80" );
skt << send(Char to Blob("Stop Listening"));
skt << close();

This is an example using Run Program:

Save Text File( "$TEMP/listener.jsl", "\[Show("Hello World!")]\" );
Open("$TEMP/listener.jsl");
rp = Run Program(
		Executable("...path to your \Jmp.exe"),
		Options({"-FILE \!"" || substr(Get Path Variable( "TEMP" ),2) || "listener.jsl\!""});
	);
rp << Is Read EOF;
wait(0);