<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Shortcut Creator</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="MSThemeCompatible" content="yes">
<script type="text/javascript">
(function(){
var w = 370,
h = 175;
window.resizeTo(w, h);
window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
})();
</script>
<hta:application id="oHta"
applicationname="ShortCutCreator"
version="1.0"
caption="yes"
icon=""
sysmenu="yes"
maximizebutton="no"
minimizebutton= "yes"
borderstyle="normal"
border="dialog"
innerborder="no"
contextmenu="no"
navigable="no"
showintaskbar="yes"
singleinstance="yes"
windowstate="normal">
</hta:application>
<style type="text/css">
html,
body {
margin: 0;
padding: 0;
overflow: hidden;
}
body {
font: 12px "Segoe UI", Tahoma, sans-serif;
background: threedface;
}
fieldset {
width: 300px;
margin: 12px auto 0;
padding: 6px 12px 0px;
}
#inpProjectNo {
width: 200px;
margin-left: 5px;
vertical-align: middle;
}
.buttons {
margin: 16px 0 12px;
padding-top: 12px;
border-top: 1px solid #fff;
text-align: center;
}
.buttons button {
width: 75px;
}
button:focus {
outline: none;
}
</style>
<script type="text/javascript">
var startFolder = "F:\\mappe",
elmProjectNum = null;
function createShortCut() {
var val, pfx, num, folderPath, oWS, shortCutPath,
oFso, oFldr, oFile, linkPath, oLink;
val = elmProjectNum.value;
pfx = val.substr(0, 2);
num = val.substr(2);
folderPath = startFolder + "\\" + pfx + (num - (num % 5000)) + "\\" + val;
oFso = new ActiveXObject("Scripting.FileSystemObject");
if (!oFso.folderExists(folderPath)) {
alert("Mappen kan ikke findes:\n"+folderPath);
elmProjectNum.select();
oFso = null;
return false;
}
oWS = new ActiveXObject("WScript.Shell");
shortCutPath = oWS.SpecialFolders("Desktop") + "\\" + val;
if (oFso.folderExists(shortCutPath)) {
alert("Genvejen findes allerede:\n"+shortCutPath);
elmProjectNum.select();
oFso = oWS = null;
return false;
}
oFldr = oFso.CreateFolder(shortCutPath);
oFile = oFso.CreateTextFile(shortCutPath + "\\Desktop.ini", true);
oFile.WriteLine("[.ShellClassInfo]");
oFile.WriteLine("CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}");
oFile.WriteLine("Flags=2");
oFile.Close();
oFile = oFso.GetFile(shortCutPath + "\\Desktop.ini");
oFile.attributes = 38;
oFile = oFso.GetFolder(shortCutPath);
oFile.attributes = 1;
linkPath = shortCutPath + "\\target.lnk";
oLink = oWS.CreateShortcut(linkPath);
oLink.TargetPath = folderPath;
oLink.WorkingDirectory = shortCutPath;
oLink.Save();
elmProjectNum.value = "";
elmProjectNum.focus();
oFso = oWS = oFldr = oFile = oLink = null;
}
function init() {
elmProjectNum = document.getElementById("inpProjectNo");
elmProjectNum.focus();
}
window.onload = init;
</script>
</head>
<body>
<fieldset>
<legend>Opret Genvej</legend>
<label>Projektnummer: <input id="inpProjectNo" type="text"></label>
<div class="buttons">
<button onclick="createShortCut()" type="button">Opret</button>
<button onclick="window.close()" type="button">Fortryd</button>
</div>
</fieldset>
</body>
</html>