Change the default title "image.png" to "timestampe.png" or "random-string.png" pasting from clipboard

60 views
Skip to first unread message

Zheng Bangyou

unread,
Jan 12, 2022, 11:04:45 PM1/12/22
to TiddlyWiki
I am using the tiddlywiki 5 on node.js, but require to frequently paste screenshots from other programs for notes. On node.js I can store images into a specific folder.

However, the default title is "image.png" after pasting from clipboard. I have to change it to different name, otherwise the old image will be overwrite.  It would spend lots of time to change file name.

How could I config the default title "image.png" into the current timestamp or  a random string?

Zheng Bangyou

unread,
Feb 1, 2022, 11:59:42 PM2/1/22
to TiddlyWiki
I get a temp solution with autohotkey and vimium plugin in chrome.  It only works for Chrome with vimium installed.


This script check whether an active window with title "My TiddlyWiki" in chrome.exe and clipboard has a image. 

This script send keystrokes into Tiddlywiki. Caution to use this script as it might cause some unexpected results.  Best to test line by line.


ClickFromLeft(_X,_Y){
        CoordMode, mouse, Relative
        WinGetActiveStats, Title, width, height, x,y
        _X := _X
        _Y := height / 2
        Click %_X%, %_Y%
}

setTitleMatchMode 1
#IfWinActive, ahk_exe chrome.exe
#IfWinActive, My TiddlyWiki
#f::

if DllCall("IsClipboardFormatAvailable", "Uint", 2)        ;2:CF_BITMAP
{        
        send ^v
        sleep 1000
        ClickFromLeft(50,1)
        sleep 100
        send /
        sleep 100
        send image.png
        Sleep 100
        Send {Enter}
        Sleep 100
        Send {Tab}
        Sleep 100
        Send {Enter}
        Sleep 100
        Send {Tab}
        Sleep 100
        FormatTime, time, A_now, yyyyMMddHHmmss
        Send image%time%.png
        Sleep 1000
        Send {Tab}
        Sleep 100
        Send {Tab}
        Sleep 100
        Send {Enter}
        Sleep 100
        Send {Tab}
        Sleep 100
        Send {Tab}
        Sleep 100
        Send {Enter}

}
else
{
        msgbox Please copy a image
}

return
#IfWinActive
#IfWinActive

Télumire

unread,
Feb 2, 2022, 9:18:47 PM2/2/22
to TiddlyWiki
I'm not sure how but you probably need to modify the tiddler $:/core/ui/ImportListing
Reply all
Reply to author
Forward
0 new messages