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

What can I do if the temporary file name is the same during concurrent downloads using JMP 17?

Hello!

I used JMP 17 for a concurrent download, which resulted in temporary files with the same name, files being overwritten over and over, and only one file.
How do you handle the downloaded code?

2023-03-21_14-57-31.png

	rqs = New Multi HTTP Request();
	For( i = 1, i <= N Items( u ), i++,
		rq = New HTTP Request( Method( "GET" ), URL( u[i] ), Timeout( 0.1 ) );
		txt = rq << Send;
		rqs << Add( rq );
	);
	hh = rqs << Get Requests();
	da = rqs << Download( "show progress", "detailed" );
5 REPLIES 5
lala
Level VII

回复: What can I do if the temporary file name is the same during concurrent downloads using JMP 17?

Can I save the results of each download in a memory variable? For example,

 

I do 100 downloads at the same time and save the results of each download separately txt1 -- txt100 out of 100 variables, right?

 

Thanks!

回复: What can I do if the temporary file name is the same during concurrent downloads using JMP 17?

For MultiHTTPRequest, Add takes an optional "label" parameter (the Scripting Index has the details)

The label will be used to create the filename for the download.

lala
Level VII

回复: What can I do if the temporary file name is the same during concurrent downloads using JMP 17?

Thanks Experts!

  • I tried to fix it, but it didn't work.

2023-04-15_09-33-16.png

	rqs = New Multi HTTP Request();
	For( i = 1, i <= N Items( u ), i++,
		rq = New HTTP Request( Method( "GET" ), URL( u[i] ), Timeout( 0.1 ) );
		rqs << Add( rq, "test" || Char( i ) );
	);
	hh = rqs << Get Requests();
	da = rqs << Download( "show progress", "detailed" );
Craige_Hales
Super User

回复: What can I do if the temporary file name is the same during concurrent downloads using JMP 17?

Seems to work:

progress window uses the labels too.progress window uses the labels too.

the variable named data holds

{"C:\Users\v1\AppData\Local\Temp\111(1).jmp",
"C:\Users\v1\AppData\Local\Temp\222(1).jmp"}

Apparently it automatically adds the (1) to make a new name since this was the second time.

Without the label parameter I get

{"C:\Users\v1\AppData\Local\Temp\BlueBirds(2).jmp",
"C:\Users\v1\AppData\Local\Temp\dataSepsis_2(2).jmp"}

After running three times.

 

 

View more...
Names Default To Here( 1 );

requests = New Multi HTTP Request();
requests << Add(
	New HTTP Request(
		Method( "GET" ),
		URL( "https://community.jmp.com/kvoqx44227/attachments/kvoqx44227/sample-data/49/1/BlueBirds.jmp" )
	),
	"111.jmp"
);

requests << Add(
	New HTTP Request(
		Method( "GET" ),
		URL( "https://community.jmp.com/kvoqx44227/attachments/kvoqx44227/sample-data/177/2/dataSepsis_2.jmp" )
	),
	"222.jmp"
);

data = requests << Download( "show progress", "detailed" );
http_requests = requests << Get Requests();
For( i = 1, i <= N Items( http_requests ), i++,
	Show( http_requests[i] << Get Mime Type() )
);

dt = Open( data[2] );

 

 

Craige

回复: What can I do if the temporary file name is the same during concurrent downloads using JMP 17?

Thanks Craige!

I'll make sure the label gets eval-ed.