claudiodangelis / qrcp

:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.
https://qrcp.sh
MIT License
9.89k stars 524 forks source link

How to create contextmenu of any file to show qrcode in Mac?? #306

Closed ilaoyao closed 7 months ago

ilaoyao commented 7 months ago

I'm opening this issue because:

How to create contextmenu of any file to show qrcode in Mac??

claudiodangelis commented 7 months ago

Hello, this would be a very cool feature, but at this time I don't have a solution for it.

Let's see, maybe other users have found a nice solution and will post it here.

Thanks for the nice suggestion! Claudio

ilaoyao commented 7 months ago

I tried to use Mac OS Automator, add shell script to built it, when executed through the context menu of any file, it can open the terminal normally, but the subsequent qcrp /path/filename.ext command cannot succeed.

i used one app named easyshare for mac, it can show a qrcode by click MacOS's sevices context menu.

thx u reply. ilaoyao

claudiodangelis commented 7 months ago

Ah, interesting. Do you mind sharing the Automator code here? Maybe we can have a look together, thanks!

ilaoyao commented 7 months ago

Ah, interesting. Do you mind sharing the Automator code here? Maybe we can have a look together, thanks!

Automator --> quick action --> run shell script --> files & folders , Finder , and pasted the scropt blow:

for f in "$@"
do
    open -a "Terminal" "/user/my/qrcp/qrcp" "$f"
done

/user/my/qrcp/qrcp is the qrcp bin-file.

save as qrcpopen name and choose a file or folder right click, and choose the qrcpopen name, the terminal open, but pop a windows says: qrcp need at least one arg....ect.

so i failed. :-(

ilaoyao commented 7 months ago

Ah, interesting. Do you mind sharing the Automator code here? Maybe we can have a look together, thanks!

Finally, I complete this job alone. cos my english is poor, so i type with chinese blow:

首先将qrcp所在的目录添加到系统的path路径下

1)首先打开mac的自动操作- Automator,新建一个程序; 2)在左侧顶部搜索 “ applescript脚本”,添加进右侧 3)在代码区域复制以下代码:

on run {input, parameters}
    tell application "Finder"
        set myWin to window 1
        set filePath to (quoted form of POSIX path of (the selection as alias))
        if application "Terminal" is running then
            tell application "Terminal"
                do script "qrcp  " & filePath
                activate
            end tell
        else
            tell application "Terminal"
                do script "qrcp  " & filePath in window 1
                activate
            end tell
        end if
    end tell
end run

4)保存为程序 5)打开Finder访达程序,自定义工具栏,将刚才的程序拖进顶部工具栏 6)选择一个文件测试即可。我已经测试通过~

不过,感觉在同一个局域网下面,在windows系统下的传输速度比在mac系统下的传输速度要快。

附图如下:

iShot_2023-12-07_19 41 01
claudiodangelis commented 7 months ago

Ok, very good! Can we close this issue now? Thanks!!