Skip to content

Instantly share code, notes, and snippets.

from playwright.sync_api import sync_playwright
from playwright.sync_api import Page, expect
import re
import time
# def get_exhibit_items()
def main():
with sync_playwright() as p:
browser=p.chromium.launch(headless=False,timeout=0)
# page=browser.new_page()
@valuex
valuex / PDFTitle_byMaxFont.py
Created June 5, 2024 12:37
Get PDF Title by Max Font Size
import pdfplumber
import os
def get_max_font_text(file_path):
max_font_text=""
with pdfplumber.open(file_path) as pdf:
page1=pdf.pages[0]
page1_content=page1.chars
font_size_list=[item['size'] for item in page1_content]
max_font_size=max(font_size_list)
@valuex
valuex / PaddleOCR.ahk
Created February 17, 2024 12:57
Autohotkey OCR with Paddle
/*
author: telppa(空)(autohotkey v1, and credit goes to him :-D )
github: https://github.com/telppa/PaddleOCR-AutoHotkey
modified by: Valuex (convert to autohotkey v2)
version: 2024.02.17
*/
#Requires AutoHotkey v2
PaddleOCR(Image, Configs:=Object())
@valuex
valuex / VBA_Chrome.vbs
Created February 11, 2024 12:53
using vba to control Chrome by UIA
' tools -> reference -> UIAutomationClient
Function GetChrome(ByRef uia As CUIAutomation) As IUIAutomationElement
'Dim uia As New CUIAutomation
Dim el_Desktop As IUIAutomationElement
Set el_Desktop = uia.GetRootElement
Dim el_ChromeWins As IUIAutomationElementArray
Dim el_ChromeWin As IUIAutomationElement
@valuex
valuex / AHK_ChineseCharacter2PinYin.ahk
Created December 27, 2023 12:26
AHK 汉字转拼音
; https://www.autohotkey.com/boards/viewtopic.php?t=1629
zh2py(str)
{
; 从 php 转换而来的 (http://www.sjyhome.com/php/201311170606.html)
; 根据汉字区位表,(http://www.mytju.com/classcode/tools/QuWeiMa_FullList.asp)
; 我们可以看到从16-55区之间是按拼音字母排序的,所以我们只需要判断某个汉字的区位码就可以得知它的拼音首字母.
; 区位表第一部份,按拼音字母排序的.
; 16区-55区
@valuex
valuex / HH_AHKHelp.ahk
Created September 10, 2023 13:05
Search in Autohotkey.chm
F1::
{
UserKeyWords:="StrSplit"
HH_AHKHelp(UserKeyWords)
}
HH_AHKHelp(UserKeyWords)
{
Win_AHK_Help:="AutoHotkey v2 Help ahk_exe hh.exe"
if (!WinExist(Win_AHK_Help))
@valuex
valuex / SendTCCommand.ahk
Created August 3, 2023 11:55
Send Message to Total Commander
; Script name: SendTCCommand.ahk
; Sends a Total Commander command to a TC instance.
; Can be used from the scheduler for example.
; Specify the TC command as command line parameter for example:
; AutoHotkey.exe SendTCCommand.ahk cm_FtpNew
; Or if the script is compiled:
; SendTCCommand.exe cm_FtpNew