Access the internet through a proxyHas anyone successfully downloaded a file (without opening it as a data table) using a script from the internet through a proxy using JMP? If so how did you do it?
For example, how could I download the SAS logo to a file on my computer while behind a proxy?
Re: Access the internet through a proxyBrilliant, I will even accept your downloading JMP's logo instead of SAS's. This also seems to work in scripts called from task scheduler. For my simple requirement here is what I landed on:
FileDownload = Function( { sourceurl, destpath },
{ download, temppath, result},
result = 0; //Set to 1 if successfull
Try(
// Download file as a zip (saves the file to a temporary
// location and waits for commands)
download = Open( sourceurl , zip );
// grab the temporary filename
temppath = Parse( Regex( Char( download ), "\!"[^\!"]+\!"" ) );
// Move the file to its new location
If( Move File( temppath, destpath ) == 1, result = 1 );
);
return(result);
);
FileDownload( "https://www.sas.com/profile/ui/images/logos/jmp.png", "$temp/jmplogo.png" );
Open( "$temp" );Thanks @Craige_Hales and @Justin_Chilton
Re: Access the internet through a proxyTry this; it will not work before JMP 12, but appears to work in both 12 and 13. It uses a side effect @Justin_Chilton pointed out to me recently. You should make a function out of this if you need to call it from more than one place.
// work-around. Load Text File("https:...", blob) should be able to
// do this, but currently the blob support only works for disk files.
//
// pretend the file is a zip file. it will be downloaded to await
// zip archive commands, but we won't actually use them.
download = Open( "https://www.sas.com/profile/ui/images/logos/jmp.png", zip );
// grab the temporary filename
file = Parse( Regex( Char( download ), "\!"[^\!"]+\!"" ) );
// *now* use Load Text File to access the binary data
binary = Load Text File( file, blob );
// the open function can use a binary blob if it is told the type
image = Open( binary, "png" );
// finally, show the image
New Window( "image", image );Re: Access the internet through a proxyHello Peter,
I should have specified that I am looking for a scripting solution to download a file rather than open it, I updated the question to reflect that. The Internet Open does appear to get proxy info from Internet Explorer but in this case I need to manipulate the file before I can open it.
Re: Access the internet through a proxyI'm not sure this is what you are after, but the general JMP system documentation for downloading a file from the internet or remote computer are contained here in the JMP online system documentation:
http://www.jmp.com/support/help/13-2/Import_Data_from_the_Internet_or_a_Remote_Comput.shtml