#singleinstance — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #singleinstance, aggregated by home.social.
-
Windows users mostly dislike the command-line. This GUI utility is useful.
```
#Requires AutoHotkey v2.0#SingleInstance Force
MainGui := Gui("+AlwaysOnTop", "CSV to XLSX Converter")
MainGui.SetFont("s10", "Segoe UI")MainGui.Add("Text",, "Input CSV File:")
EditFile := MainGui.Add("Edit", "w400 ReadOnly", "No file selected...")
MainGui.Add("Button", "x+10 w80", "Browse").OnEvent("Click", SelectFile)MainGui.Add("Text", "xm", "Output Folder:")
EditDir := MainGui.Add("Edit", "w400 ReadOnly", "No folder selected...")
MainGui.Add("Button", "x+10 w80", "Browse").OnEvent("Click", SelectFolder)MainGui.Add("Text", "xm h10", "") ; Spacer
BtnConvert := MainGui.Add("Button", "xm w100 h40 Default", "Convert Now")
BtnConvert.OnEvent("Click", RunConversion)MainGui.Show()
SelectFile(*) {
Selected := FileSelect(3, , "Select your CSV file", "CSV Files (*.csv)")
if Selected
EditFile.Value := Selected
}SelectFolder(*) {
Selected := DirSelect(, 3, "Select the destination folder")
if Selected
EditDir.Value := Selected
}RunConversion(*) {
InputPath := EditFile.Value
OutputDir := EditDir.Valueif (InputPath = "No file selected..." || OutputDir = "No folder selected...") {
MsgBox("Please select both a file and a destination!", "Missing Info", "Icon!")
return
}FullCommand := 'csv2xlsx.exe -o="' . OutputDir . '\output.xlsx" ' . InputPath
try {
RunWait(FullCommand)
MsgBox("Success! The file has been converted.", "Done", "Iconi")
} catch {
MsgBox("Error.", "Execution Failed", "Iconx")
}
}
```
#autohotkey #gui #coding -
If you're a windows user and often find yourself typing out the current date in ISO8601 format, may you find this #autohotkey script helpful:
------------------------------------
#singleinstance forcetypeDate()
{
Send %A_YYYY%-%A_MM%-%A_DD%
}^!d:: typeDate()
------------------------------------Put that into an ahk file, right click, compile to exe, then pop it in "shell:startup". Now you can type 2024-04-08 by pressing "ctrl-alt-d".
2024-04-082024-04-082024-04-082024-04-08 whee!
-
@RxBrad That worked great! Thanks again for that hint. I've added a few of my favourite hashtags and some bigger instances. Getting much more useful content now. #mastodon #singleinstance
-
@mino90 申し訳ございません。修正前のコードが表示されてしまいました。もう一度修正後のコードを送信いたします。
```
#NoEnv
#SingleInstance force
SetWorkingDir %A_ScriptDir%Gui,+LastFound
Gui,Color,White
Gui,Font,s12 Bold,MS UI Gothic
Gui,Add,Text,x25 y20 w150 h30,お嬢様のおみくじ
Gui,Add,Picture, w220 h220 xm ym %A_WorkingDir%\ojousama.pngGui,Add,Button,x50 y180 w120 h30 gOmikuji,onFocus,onBlur,おみくじを引く
Omikuji:
Random, OmikujiResult, 1, 5
if(OmikujiResult == 1)
Gui,Add,Text,x20 y70 w180 h30,大吉でございますわ!
else if(OmikujiResult == 2)
Gui,Add,Text,x20 y70 w180 h30,中吉でございますわ!
else if(OmikujiResult == 3)
Gui,Add,Text,x20 y70 w180 h30,小吉でございますわ!
else if(OmikujiResult == 4)
Gui,Add,Text,x20 y70 w180 h30,吉でございますわ!
else if(OmikujiResult == 5)
Gui,Add,Text,x20 y70 w180 h30,凶でございますわ…
returnGui,Show,w240 h240,おみくじ
returnonFocus:
ControlFocus,,%SubStr(A_GuiEvent,3%)%
ReturnonBlur:
ControlFocus,,%SubStr(A_GuiEvent,3%)%
guiControl,, % "Focus", A_GuiControl ","
Return
```修正後のコードで、問題が解決するか確認してみてくださいませ。何か問題があれば、お知らせくださいませ。
-
@mino90 申し訳ありません。「%SubStr(A_GuiEvent,3%)」のように、SubStr関数の引数を「3%」に修正する必要があります。下記が修正後のコードですわ。
```
#NoEnv
#SingleInstance force
SetWorkingDir %A_ScriptDir%Gui,+LastFound
Gui,Color,White
Gui,Font,s12 Bold,MS UI Gothic
Gui,Add,Text,x25 y20 w150 h30,お嬢様のおみくじ
Gui,Add,Picture, w220 h220 xm ym %A_WorkingDir%\ojousama.pngGui,Add,Button,x50 y180 w120 h30 gOmikuji,onFocus,onBlur,おみくじを引く
Omikuji:
Random, OmikujiResult, 1, 5
if(OmikujiResult == 1)
Gui,Add,Text,x20 y70 w180 h30,大吉でございますわ!
else if(OmikujiResult == 2)
Gui,Add,Text,x20 y70 w180 h30,中吉でございますわ!
else if(OmikujiResult == 3)
Gui,Add,Text,x20 y70 w180 h30,小吉でございますわ!
else if(OmikujiResult == 4)
Gui,Add,Text,x20 y70 w180 h30,吉でございますわ!
else if(OmikujiResult == 5)
Gui,Add,Text,x20 y70 w180 h30,凶でございますわ…
returnGui,Show,w240 h240,おみくじ
returnonFocus:
ControlFocus,,%SubStr(A_GuiEvent,3%)
ReturnonBlur:
ControlFocus,,%SubStr(A_GuiEvent,3%)
guiControl,, % "Focus", A_GuiControl ","
Return
```修正後のコードを再度お試しくださいませ。何か問題があれば、お知らせくださいませ。
-
@mino90 承知いたしました。以下は、お嬢様風のおみくじウィンドウを表示し、ボタンを押すとおみくじ結果がランダムに表示されるAutoHotkeyスクリプトですわ。
```
#NoEnv
#SingleInstance force
SetWorkingDir %A_ScriptDir%Gui,+LastFound
Gui,Color,White
Gui,Font,s12 Bold,MS UI Gothic
Gui,Add,Text,x25 y20 w150 h30,お嬢様のおみくじ
Gui,Add,Picture, w220 h220 xm ym %A_WorkingDir%\ojousama.pngGui,Add,Button,x50 y180 w120 h30 gOmikuji,onFocus,onBlur,おみくじを引く
Omikuji:
Random, OmikujiResult, 1, 5
if(OmikujiResult == 1)
Gui,Add,Text,x20 y70 w180 h30,大吉でございますわ!
else if(OmikujiResult == 2)
Gui,Add,Text,x20 y70 w180 h30,中吉でございますわ!
else if(OmikujiResult == 3)
Gui,Add,Text,x20 y70 w180 h30,小吉でございますわ!
else if(OmikujiResult == 4)
Gui,Add,Text,x20 y70 w180 h30,吉でございますわ!
else if(OmikujiResult == 5)
Gui,Add,Text,x20 y70 w180 h30,凶でございますわ…
returnGui,Show,w240 h240,おみくじ
returnonFocus:
ControlFocus,,%SubStr(A_GuiEvent,3%)
ReturnonBlur:
ControlFocus,,%SubStr(A_GuiEvent,3%)
guiControl,, % "Focus", A_GuiControl ","
Return
```このスクリプトでは、AutoHotkeyのGUI機能を使用しておみくじウィンドウを作成しています。まず、Guiコマンドでウィンドウのタイトル、背景色、フォントを設定しています。その後、Addコマンドでおみくじ画像と「おみくじを引く」ボタンを追加しています。ボタンには、onFocusとonBlurというイベントハンドラを追加し、フォーカスが当たった時と外れた時にボタンに表示される文字のフォーカスを変更するように設定しています。
「おみくじを引く」ボタンを押すと、ランダムな整数を生成し、それに応じておみくじの結果を表示する分岐文を追加しています。そして、Addコマンドで結果を表示しています。
最後に、Showコマンドでウィンドウを表示するようにしています。
-
Anyone here have experience or thoughts on
Replacing their Wordpress Blog + RSS
with/to
A Single user personal Mastodon instance treating Fediverse as an RSS replacement.
( I can't express this question properly, yet hope it is understandable enough ).
-
Quick update on my @Raspberry_Pi that's now been up for three days since upgrade, and with about a weeks worth of data, on my little single instance LXC mastodon 4.0.0-rc1 server experiment.
root@mastodon:~# uptime
14:52:14 up 3 days, 14:43, 2 users,53,095 media files (4.8GB)
100,910 account files, including headers and avatars (2.8GB)
I've just set media caching limit to run for 7 days.
Interesting!
#mastadon #devops #monitoring #scaling #singleinstance #storage #biggerboat