標籤

bat (52) 作品 (38) python (21) shell (17) windows (11) 虛擬機 (11) php (10) CPP (6) KMS (6) 程式設計 (6) docker (5) 使用教學 (5) xoops (4) 公文 (4) Apache2 (3) Excel (3) juniper (3) 資料庫 (3) mysql (2) 免動手 (2) 資料結構 (2) 軟體廣播 (2) 電腦維修 (2) Android Studio (1) Apple IPAD管理 (1) Arduino (1) CSS (1) LAMP (1) NAS (1) Ubuntu (1) VHD (1) Windows Server (1) 原因 (1) 程式應用 (1) 程式積木 (1) 編輯器 (1) 雲端硬碟 (1)

2022年12月19日 星期一

只要點兩下,就能讓Win10擁有相片檢視器且完成觀看LINE下載圖片的設定


       自從發表只要變更設定,就能讓相片顯示器可以看LINE下載的圖片後,心想可不可以[只要點兩下,就能讓Win10擁有相片檢視器且完成後續設定]。不然,經過系列文章1、2之後,點完兩下後,還要做設定。覺得很麻煩,一點都不方便。有沒有更快的方法?
下載檔案解壓密碼:demo1234
使用步驟教學:

       看完資料來源1.[Fix] Error “Windows Photo Viewer can’t display this picture”後,發現底下有一行字關於Registry。其內容如下:
Windows Registry Editor Version 5.00

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles]
"sRGB"="RSWOP.icm"
好奇的我就同時打開Regedit,將HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles貼上

 
與控制台->色彩管理->進階,進行比對。
比對之後,發現 
,這樣我真的太高興了,這樣我就可以寫進BAT。
 
程式目的:只要點兩下,就能讓Win10擁有相片檢視器且完成後續設定
檔案名稱:PhotoViewerAndColorManagementSetting.BAT
檔案內容:
 @echo off
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
REM 設定照片檢視器 PhotoViewerSetting
set regpath=HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations
@reg add "%regpath%" /v ".jpeg" /d "PhotoViewer.FileAssoc.Tiff" /t REG_SZ /f
@reg add "%regpath%" /v ".jpg" /d "PhotoViewer.FileAssoc.Tiff" /t REG_SZ /f
@reg add "%regpath%" /v ".png" /d "PhotoViewer.FileAssoc.Tiff" /t REG_SZ /f
@reg add "%regpath%" /v ".bmp" /d "PhotoViewer.FileAssoc.Tiff" /t REG_SZ /f
REM 設定顏色管理 ColorManagementSetting
set regpath=HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles
@reg add "%regpath%" /v "sRGB" /d "RSWOP.icm" /t REG_SZ /f
pause
exit

資料來源:
1.[Fix] Error “Windows Photo Viewer can’t display this picture”
https://www.winhelponline.com/blog/error-windows-photo-viewer-cant-display-this-picture-no-memory/

2022年12月17日 星期六

只要變更設定,就能讓相片檢視器可以看LINE下載的圖片

       自從發表了只要點兩下,就能讓Windows 10 擁有Windows 7 的相片檢視器,很多網友分享問題與建議。問題是無法檢視LINE傳來的圖片,建議則是改用其他圖片檢視器,如Honeyview、Imagine看圖軟體、內建的相片等。那我要如何解決這個問題?找大神的結果是Windows 相片檢視器對於 jpg 圖片檔案 icc_profile 相容性問題。那只要一次設定即可。

       照片檢視器無法檢視從LINE下載的圖片,會出現這樣的畫面:

       影片教學:

       解決方式:

設定完成後,就可以看到圖片了





2022年12月15日 星期四

只要點兩下,就能讓Windows 10 擁有Windows 7 的相片檢視器

系列文章:
https://skjhcreator.blogspot.com/2022/12/win10.html
4.只要點兩下,免傳輸線,就能讓學生透過QRcode來傳送IPAD或平板內的檔案
 
       最近同事問我,在Windows 10 的桌機,怎麼找不到照片檢視器?有沒有辦法讓其有照片檢視器。沒有照片檢視器,只能用小畫家,感覺很不方便。
        為了解決這個問題,找了大神幫忙。大神找到資料來源1.Windows相片檢視器下載安裝、設定方法教學 在Win 10找回Win 7相片檢視器。看完之後,要設定Registry。但是,步驟很多而且要仔細看,才能完成設定。希望能用滑鼠點兩下,就完成設定。

        A colleague recently asked me, why can't I find the photo viewer on my Windows 10 desktop? Is there a way to make it have a photo viewer. Without a photo viewer, you can only use Little Painter, which feels very inconvenient.
        In order to solve this problem, I asked God for help. God found the source of the information 1. Windows photo viewer download and installation, setting method teaching Retrieve Win 7 photo viewer in Win 10. After reading, to set the Registry. However, there are many steps and you have to watch carefully to complete the setup. I hope to complete the setting with two clicks of the mouse.
下載檔案解壓密碼:demo1234
使用步驟教學:

程式說明:只要點兩下,就能讓Windows 10  擁有Windows 7 的照片檢視器
檔案名稱:PhotoViewerSetting.bat
檔案內容:
@echo off
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
REM 設定照片檢視器
set regpath=HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations
@reg add "%regpath%" /v ".jpg" /d "PhotoViewer.FileAssoc.Tiff" /t REG_SZ /f
@reg add "%regpath%" /v ".png" /d "PhotoViewer.FileAssoc.Tiff" /t REG_SZ /f
@reg add "%regpath%" /v ".bmp" /d "PhotoViewer.FileAssoc.Tiff" /t REG_SZ /f
pause
exit



2022年12月6日 星期二

只要點兩下就能一次完成安裝所有印表機與設定所有印表機

系列文章:

        感恩頂番國小的資訊組長-李清展老師的分享。使用圖形介面匯出、匯入所有印表機安裝與設定。如果能夠用批次檔匯入匯出會更好。換言之,只要點兩下就能完成所有印表機安裝與設定。
        原本用BAT一鍵完成印表機安裝驅動,讓學校老師在自己的筆電可以快速安裝印表機。但隨著印表機設定越來越複雜,老師安裝完印表機後還要調整印表機設定。原本BAT卻不能讓老師省卻印表機設定的步驟。因此,需要更方便的方法,讓老師能夠一次完成所有的設定。
下載檔案解壓密碼:demo1234
使用步驟教學:

單機測試步驟:
1.下載檔案,解壓縮。解壓密碼:demo1234
2.匯出印表機設定檔->點選ExportPrinterConf.BAT
3.刪除印表機
4.匯入印表機設定檔->點選ImportPrinterConf.BAT

使用步驟:
1.在樣本機安裝所有的印表機與完成印表機的設定
2.在樣本機,下載InstallPrinter並完成解壓縮。
3.在InstallPrinter資料夾內(亦有可能為InstallPrinter\InstallPrinter資料夾內),對ExportPrinterConf.BAT點兩下,匯出印表機設定檔到config資料夾
3.將整個資料夾InstallPrinter帶到新的電腦的桌面
4.在InstallPrinter資料夾內(亦有可能為InstallPrinter\InstallPrinter資料夾內),對ImportPrinterConf.BAT點兩下,匯入config資料夾內的印表機設定檔


程式目的:匯出所有印表機設定檔到所在的資料夾內的config
程式名稱:ExportPrinterConf.BAT
程式內容:
@echo off
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
%SystemRoot%\System32\spool\tools\PrintBrm.exe -b -f %~dp0\config\AllPrinterConfig

程式目的:匯入config資料夾內所有印表機設定檔
程式名稱:ImportPrinterConf.BAT
程式內容:
@echo off
REM ---------------以下是程式碼,不需更改---------------
REM :: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
REM :: BatchGotAdmin (Run as Admin code ends)
REM :: Your codes should start from the following line
%SystemRoot%\System32\spool\tools\PrintBrm.exe -r -f %~dp0\config\AllPrinterConfig


資料來源:

2022年11月26日 星期六

只要點兩下,就能離開位子。讓電腦依照規劃自動下載臉書的影片

下載檔案解壓密碼:demo1234
使用步驟教學:

        最近同事問我,可不可以下載FaceBook的影片作為教學影片?於是就開始嘗試去寫程式來完成這件事。 
        更由於先前的程式可以依照規劃與公開的PlayList來下載YouTube多媒體,網友提供了Youtube-dl 這個套件可以下載FB的影片。後來找Google大神,發現Youtube-dl功能很強大。原始網站https://github.com/ytdl-org/youtube-dl 提供了命令列功能與支援的網站https://github.com/ytdl-org/youtube-dl/blob/master/docs/supportedsites.md。但是我卻想要用Python程式來試試。可是問題來了,我該怎麼在Python用Youtube-dl這個套件?於是找大神,關鍵字是python youtube-dl example,沒想到找到資料來源1.Python youtube_dl.YoutubeDL() Examples。那我就開始測試,第一個測試程式如下:
程式目的:測試Youtube-dl是否能下載FB多媒體
程式名稱:test.py
程式內容:
import youtube_dl

ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://fb.watch/h21zao5IVE/'])
結果:
        很開心,發現可以下載FB多媒體。
        那要如何取得FB多媒體的網址呢?
        以FireFox為例,如下所示:


程式目的:下載FB多媒體
程式名稱:FbMp4Download.py
程式內容:
import youtube_dl
import os
from ClassFunc import OpenFiles

fcl = OpenFiles('下載名單.txt','').FileContentList()
ydl_opts = {
    'noplaylist': True
}
for i in fcl:
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download([i])

程式目的:常用程式類別
程式名稱:ClassFunc.py
程式內容:
import os

class OpenFiles():
    #開啟檔案

    def __init__(self,FileName,FolderName):
        self.FileName = FileName
        self.FolderName = FolderName
   
    def FileContentList(self):
        #設定信件內容檔名並取得檔案內容並回傳List
        ContentFileName = str(os.path.abspath(os.getcwd()))+"\\"+self.FileName
        ContentFile = open(ContentFileName,'r')
        FileContentList = ContentFile.readlines()
        ContentFile.close()
        return FileContentList
   
    def GetFolderPath(self):
        #取得資料夾路徑
        if os.path.exists(self.FolderName):
            FolderPath = str(os.path.abspath(os.getcwd()))+"\\"+self.FolderName
        else:
            os.mkdir(self.FolderName)
            FolderPath = str(os.path.abspath(os.getcwd()))+"\\"+self.FolderName
        return FolderPath



資料來源:




2022年11月24日 星期四

利用虛擬機來實作Veyon 軟體廣播安裝教師機與學生機

 
       最近要在電腦教室讓老師們實作Veyon 軟體廣播安裝。希望老師能夠利用眼前的電腦,來完成實作。可是Veyon 軟體廣播安裝實作,需要有教師機與學生機。於是便想到虛擬機,其規劃如下:

實作步驟:

2.教師機安裝

3.教師機設定--公鑰要保留,等下還要匯入學生機

4.學生機安裝

    整個安裝過程跟教師機安裝大致相同,唯一的差別在:

5.學生機設定

    接下來,要匯入教師機的公鑰

    接下來,要查詢學生機的IP,並記住IP。要到教師機設定。

6.教師機監看學生機的設定
    開始監看


資料來源:

利用虛擬機來實作Veyon 軟體廣播安裝教師機與學生機-事前準備工作

 
       最近要在電腦教室讓老師們實作Veyon 軟體廣播安裝。希望老師能夠利用眼前的電腦,來完成實作。可是Veyon 軟體廣播安裝實作,需要有教師機與學生機。於是便想到虛擬機,其規劃如下:

事前準備:

準備步驟:
1.在教師機(Host) 安裝 VM workstation player
2.在VM workstation player 安裝Windows 10 虛擬機
3.用小畫家做出[教師機.bmp]與[學生機.bmp],其畫面如下:



4.對[教師機.bmp]按滑鼠右鍵,出現下拉式選單。選擇設成桌面背景

5.在Windows 10 虛擬機內,對[學生機.bmp]按滑鼠右鍵,出現下拉式選單。選擇設成桌面背景

2022年11月7日 星期一

只要點兩下,就能離開位子。讓電腦依照公開的PlayList自動下載YT多媒體

        由於在學校分享了只要點兩下,就能離開位子。讓電腦依照規劃自動下載YouTube影片。學校同事希望可以貼上公開的PlayList網址與Mp3 或Mp4 ,接下來就是點兩下,離開座位,讓電腦依照PlayList自動下載YouTube多媒體(Mp3或Mp4)。
        開發過程中,發現下載YouTube多媒體後,儲存在電腦內的檔案會有編碼問題,導致下載中斷。YouTube多媒體的名稱會有簡體字、\ 等問題,導致編碼問題。那就等整個下載完畢後,再利用Python來處理檔案名稱,沒想到還是編碼問題。想了四天,苦思無解。主要原因是無法繞過檔案名稱的編碼問題。
        後來,為了能夠做到[只要點兩下,就讓電腦教室學生機可以解除網站鎖定]。讓電腦教室也能讓教師研習使用,必須解除網站鎖定,免得研習無法進行。進行BAT的開發,沒想到發現了
ren *.mp4 *.mp3 。原因是 * 在BAT 是萬用字元,就可以繞過檔案名稱的編碼問題。

下載檔案。解壓密碼:demo1234

使用步驟教學:

檔案名稱:P002.py
檔案內容:
from pytube import Playlist
from ClassFunc import OpenFiles
from ClassFunc import YouTubeDownloader

gfp = OpenFiles('','download').GetFolderPath()
fcl = OpenFiles('YouTubePlayList.txt','').FileContentList()
TempType = OpenFiles('Mp3orMp4.txt','').FileContentList()
TempType.pop(0)
print(TempType)
for i in fcl:
    TempPlayList = Playlist(i)
    if TempPlayList.video_urls == []:
        print("您的playlist 可能是私有 或是 不公開")
    else:
        for j in TempPlayList.video_urls:
            for k in TempType:
                if k.upper() =='MP3':
                    YouTubeDownloader(j,gfp).YTMp3Downloader()
                elif k.upper() =='MP4':
                    YouTubeDownloader(j,gfp).YTDownloader()

for i in TempType:
    if i.upper() =='MP3':
        print("**************************************************")
        print("您選擇下載mp3檔案,由於編碼的關係,下載時檔案為mp4")
        print("請您於下載完畢後,點選[轉換副檔名為mp3.bat]")
        print("[轉換副檔名為mp3.bat]會完成轉換副檔名由mp4改為mp3")
        print("*************************************************")

os.system("pause")
os.system("exit")


檔案名稱:ClassFunc.py
檔案內容:
from pytube import YouTube
import os

class YouTubeDownloader:
    def __init__(self,URL,FolderPath):
        self.Url = URL
        self.FolderPath = FolderPath
   
    def onProgress(self,stream,chunk,remains):
        total = stream.filesize
        percent = (total-remains)/total*100
        print(f'下載中… {percent:05.2f}%', end='\r')

    def YTDownloader(self):
        yt = YouTube(self.Url,on_progress_callback=self.onProgress)
        print(yt.title+".mp4"+" downloading....")
        yt.streams.filter().get_highest_resolution().download(self.FolderPath)
        print("Download "+".mp4"+yt.title+".mp4"+" OK!")
   
    def YTMp3Downloader(self):
        yt = YouTube(self.Url,on_progress_callback=self.onProgress)
        print(yt.title+".mp4"+" downloading....")
        yt.streams.filter().get_audio_only().download(self.FolderPath)
        print("Download "+yt.title+".mp4"+" OK!")

class OpenFiles():
    #開啟檔案

    def __init__(self,FileName,FolderName):
        self.FileName = FileName
        self.FolderName = FolderName
   
    def FileContentList(self):
        #設定信件內容檔名並取得檔案內容並回傳List
        ContentFileName = str(os.path.abspath(os.getcwd()))+"\\"+self.FileName
        ContentFile = open(ContentFileName,'r')
        FileContentList = ContentFile.readlines()
        ContentFile.close()
        return FileContentList
   
    def GetFolderPath(self):
        #取得資料夾路徑
        if os.path.exists(self.FolderName):
            FolderPath = str(os.path.abspath(os.getcwd()))+"\\"+self.FolderName
        else:
            os.mkdir(self.FolderName)
            FolderPath = str(os.path.abspath(os.getcwd()))+"\\"+self.FolderName
        return FolderPath

檔案名稱:轉換副檔名為mp3.bat
檔案內容:
@echo off 
REM 讀取檔案

for /f "skip=1 delims=" %%a in (Mp3orMp4.txt) do (
    set mp3txt=%%~a
)
echo %mp3txt%
if "%mp3txt%"=="mp3" (
cd  %~dp0\download\
ren *.mp4 *.mp3
)

PAUSE
EXIT


資料來源:
1.Using Playlists
2.下載 Youtube 清單中所有影片
3.只要點兩下,就能離開位子。讓電腦依照規劃自動下載YouTube影片


2022年11月3日 星期四

只要點兩下,就能離開位子。讓電腦依照規劃自動下載YT影片


        由於教學上需要,需要從YouTube下載影片。希望能夠做到只要點兩下,就能離開位子。讓電腦依照規劃自動下載YouTube影片。網路上有許多教學如下:
1.Kej's FLV Retriever:
使用Kej's FLV Retriever 將影片網址貼上,按下RETRIEVE NOW! 按鈕後,就會出現下載網址,點選下載網址就可以下載了。但是卻遇到這個畫面:
2.將YouTube影片網址去除ube:
將YouTube影片網址去除ube,就會進到https://yout.com/的網站,選擇所需的格式,就可以下載了,只是下載次數有限制且下載速度慢。但是未來還要收費。
3.使用Youtube Downloader HD程式:
只要將影片網址,按下按鈕,就可以下載。若有一大堆影片需要下載,就要一個一個地下載。不能設定好網址後,批次下載。
        整理一下自己的需求。若自己看到好的教學影片,只要將影片網址記錄在一個TXT檔,只要點兩下,就能依照TXT的規劃,自動地一個一個地下載。換句話說,只要規劃好TXT,點兩下,就可以離開位子,讓電腦自動下載。
下載檔案。解壓密碼:demo1234
使用步驟:

檔案名稱:P001.py
檔案內容:
from pytube import YouTube
from pytube.cli import on_progress
import os

class YouTubeDownloader:
    def __init__(self,URL,FolderPath):
        self.Url = URL
        self.FolderPath = FolderPath
   
    def onProgress(self,stream,chunk,remains):
        total = stream.filesize
        percent = (total-remains)/total*100
        print(f'下載中… {percent:05.2f}%', end='\r')

    def YTDownloader(self):
        yt = YouTube(self.Url,on_progress_callback=self.onProgress)
        print(yt.title+" downloading....")
        yt.streams.filter().get_highest_resolution().download(self.FolderPath)
        print("Download "+yt.title+" OK!")

class OpenFiles():
    #開啟檔案

    def __init__(self,FileName,FolderName):
        self.FileName = FileName
        self.FolderName = FolderName
   
    def FileContentList(self):
        #設定信件內容檔名並取得檔案內容並回傳List
        ContentFileName = str(os.path.abspath(os.getcwd()))+"\\"+self.FileName
        ContentFile = open(ContentFileName,'r')
        FileContentList = ContentFile.readlines()
        ContentFile.close()
        return FileContentList
   
    def GetFolderPath(self):
        #取得資料夾路徑
        if os.path.exists(self.FolderName):
            FolderPath = str(os.path.abspath(os.getcwd()))+"\\"+self.FolderName
        else:
            os.mkdir(self.FolderName)
            FolderPath = str(os.path.abspath(os.getcwd()))+"\\"+self.FolderName

        return FolderPath
   
fcl = OpenFiles('下載名單.txt','').FileContentList()
gfp = OpenFiles('','download').GetFolderPath()
for i in fcl:
    temp=i.replace('\n','')
    YouTubeDownloader(temp,gfp).YTDownloader()

os.system("pause")
os.system("exit")

資料來源:

只要點兩下,傳統右鍵選單改回Win11右鍵選單

系列文章: 1. 只要點兩下,就能將Win11 右鍵選單 回復 傳統右鍵選單 2. 只要點兩下,傳統右鍵選單改回Win11右鍵選單 上一篇提到只要點兩下,就能將Win11選單回到傳統選單。但是有沒有方法能夠回到Win11選單呢?                    ...