Function create unique ID

function createUUID(){

var dt = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (dt + Math.random()*16)%16 | 0;
dt = Math.floor(dt/16);
return (c=='x' ? r :(r&0x3|0x8)).toString(16);
});
return uuid;
}

value = createUUID();



Add hours to timestamp

var deadLineDate = new Date();
deadLineDate.setHours(deadLineDate.getHours() + 24);


document.write(deadLineDate);

Generate password

var alpha = 'abcdefghijklmnpqrstuvwxyz';
var calpha = 'ABCDEFGHIJKLMNPQRSTUVWXYZ';
var num = '123456789';
var specials = '!@#$%&';
var options = [alpha, alpha, alpha, calpha, calpha, num, num, specials];
let opt, choose;
let pass = "";
for ( let i = 0; i < 8; i++ ) {
opt = Math.floor(Math.random() * options.length);
choose = Math.floor(Math.random() * (options[opt].length));
pass = pass + options[opt][choose];
options.splice(opt, 1);
}
console.log(pass);



Get number with RegEx from string

var regex = /\d{8}/g;
var string = "First number is 50011122 and second number is 98765432 END";
var matches = string.match(regex); // creates array from matches

console.log(matches[0]); //pick first choice (50011122)

Function to return fullpath

// input = "c:\temp\myfile.pdf"

// output = "c:\temp"


function GetFullPathToFile(path)
{
var n = path.substring(0, path.lastIndexOf("\\"))
return n
}