MeowClock2

デスクトップにお気に入りの写真で時計を表示

初期値:60秒ごとに写真を切り替え

「MeowNorify.exe」を起動しておく。

  • 「image」フォルダにお気に入りの写真を保存。

  • 「Create_imageList.bat」を実行。
    imageList.js が作成されます。

  • 「MeowClock2.bat」を実行。

デスクトップにWindowが表示されます。
※ウインドウは手動で移動可能。

ウインドウの初期表示位置を変更

MeowClock2.bat をメモ帳などで開き、Location : X, Y の値を変更して下さい。

MeowClock2.html

<html><head> <meta charset="utf-8"> <style> body { margin: 0; padding: 0; } img { width: 294px; height: 121px; border: 0px; position: relative; top: 0px; left: 0px; z-index: 0; } .contain { object-fit: contain; font-family: 'object-fit: contain;'; /*IE対策*/ } .text { position: absolute; bottom: 5px; left: 5px; z-index: 1; font-size: 36px; text-shadow: white 1px 1px 0px, white -1px 1px 0px, white 1px -1px 0px, white -1px -1px 0px; } </style></head><img id='img' src='./image/straw-field-hair-nature-157728.jpeg' class='contain'><div class='text' id='text'> DATE</div></img><script src="./js/ofi.js"></script><script src="./imageList.js"></script><script>
if (window.File && window.FileReader && window.FileList && window.Blob) { // Great success! All the File APIs are supported.} else { alert('The File APIs are not fully supported in this browser.');}

var dir='../image/'; /*var imgList=["04c4ed7ddd30fa33e3fe5b11549ba416.jpg"];*/ objectFitImages(); function foo(x) { return (x < 10) ? '0' + x : x; } function clock() { var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); var s = now.getSeconds(); var t = foo(h) + ':' + foo(m); document.getElementById('text').innerText = t; } setInterval(clock, 10000); window.onload = clock;
function UpdatedBeauty(){ var r = Math.random()*(imgList.length-1); var index=Math.round(r); console.log(Math.round(r)); document.getElementById('img').src=dir + imgList[index]; } setInterval(UpdatedBeauty, 60000); </script> </html>

MeowClock2.bat

set THIS_PATH=%~dp0set THIS_PATH=%THIS_PATH:\=/%MeowNotify "{\"Location\":{\"X\":10,\"Y\":10},\"Title\":\"Meow Clock 2\",\"Url\":\"%THIS_PATH%MeowClock2.html\"}"

Create_imageList.bat

@echo offset THIS_PATH=%~dp0cd %THIS_PATH%powershell.exe -NoProfile -ExecutionPolicy Unrestricted .\Create_imageList.ps1

Create_imageList.ps1

if ($MyInvocation.MyCommand.CommandType -eq "ExternalScript") { $ScriptPath = Split-Path -Path $MyInvocation.MyCommand.Definition; } else { $ScriptPath = Split-Path -Path ([Environment]::GetCommandLineArgs()[0]); if (!$ScriptPath){ $ScriptPath = "." } }$parentDir = Split-Path $ScriptPath -Parent;$imageList=@(Get-ChildItem -File "$parentDir/image").name;"var imgList=[`n'"+($imageList -join "',`n'")+"']" | set-content -Path 'imageList.js';

imageList.js

var imgList=['04c4ed7ddd30fa33e3fe5b11549ba416.jpg','2fd734066fa7b089b8aebdab49a254c7.jpg','5221d725ea61da45e3194d8fcbbf8ab0.jpg','71854cd1a1f10c687d4745246a9b5daf.jpg','8c9701a0d69ae0a5bd168aca7b05f651.jpg','c2bc989c2d68c55fdab5cdff7639ca54.jpg','d72642a2a44607814cff28a3ab33dc6d.jpg','fbc0385065101616067334bd68a90f09.jpg','gettyimages-1084665006-612x612.jpg','gettyimages-652924830-612x612.jpg','straw-field-hair-nature-157728.jpeg']