Skip to content

Instantly share code, notes, and snippets.

@NeuroWinter
Created February 18, 2015 00:27
Show Gist options
  • Save NeuroWinter/fc12b7523257038c5678 to your computer and use it in GitHub Desktop.
Save NeuroWinter/fc12b7523257038c5678 to your computer and use it in GitHub Desktop.
displayPDF
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
//go full screen.
self.moveTo(0,0);
self.resizeTo(screen.width,screen.height);
</SCRIPT>
<style type="text/css">
/* Full Screen The Page Fix*/
body {
margin: 0cm
}
</style>
</head>
<title>Steel Plant Performance Dashboard</title>
<p align = centre><iframe name="baseFrame" src="hello.htm" style="border: 0; width: 100%; height: 100%" scrolling="no" ></iframe></p>
<script language="javascript">
// Getting all files in FSo object
var maxFileNumber=0;
var fileNumber=0;
displayNew();
function displayNew(){
try{
var Fo = new ActiveXObject("Scripting.FileSystemObject");
var FoN = new Enumerator(Fo.GetFolder("C:\\trial\\").Files);
maxFileNumber = 0;
for (i=0;!FoN.atEnd();FoN.moveNext()){
maxFileNumber = maxFileNumber + 1;
}
FoN.moveFirst();
for(i=0;i<fileNumber;i++){
FoN.moveNext();
}
fileNumber = fileNumber + 1;
if(fileNumber == maxFileNumber){
fileNumber = 0;
}
if (!(/gif|html|pdf|bmp|png/).test(getFileExtention(FoN.item()))) {
//This means that is it not one of the files we want
throw "Incorrect File Type";
}
baseFrame.location.href = FoN.item();
}catch (err){
//alert("error caught");
}finally{
setTimeout(function() { displayNew(); },500);
Fo = null;
FoN = null;
}
}
function getFileExtention(fileName) {
return String(fileName).split('.').pop();
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment