Last active
December 28, 2023 06:38
-
-
Save CannoHarito/e64199abc59b18f01a61f6af6b522c28 to your computer and use it in GitHub Desktop.
Windows版iTunesで再生中の楽曲を#NowPlayingをつけてツイートするページを開く cmd版,WSH(JScript)版,Powershell版
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell (New-Object -C 'iTunes.Application').CurrentTrack^|%%{start('https://twitter.com/intent/tweet?text='+[Uri]::EscapeDataString(\"#NowPlaying $($_.Name) - $($_.Artist) ($($_.Album))\"))} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var t=new ActiveXObject("iTunes.Application").CurrentTrack; | |
new ActiveXObject("WScript.Shell").Run("https://twitter.com/intent/tweet?text="+encodeURIComponent("#NowPlaying "+t.Name+" - "+t.Artist+" (Album: "+t.Album+")")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $t=(New-Object -Com "iTunes.Application").CurrentTrack; | |
# Add-Type -AssemblyName ($w="System.Web"); | |
# $w="$w.HttpUtility" -as [type]; | |
# start ("https://twitter.com/intent/tweet?text="+$w::UrlEncode("#NowPlaying $($t.Name) - $($t.Artist) (Album: $($t.Album))")) | |
# System.Uri の方で十分であった | |
# $t = (New-Object -Com "iTunes.Application").CurrentTrack; | |
# start ("https://twitter.com/intent/tweet?text=" + [System.Uri]::EscapeDataString("#NowPlaying $($t.Name) - $($t.Artist) (Album: $($t.Album))")) | |
# ついでに一行にする | |
(New-Object -Com "iTunes.Application").CurrentTrack | % { start ("https://twitter.com/intent/tweet?text=" + [System.Uri]::EscapeDataString("#NowPlaying $($_.Name) - $($_.Artist) (Album: $($_.Album))")) } |
短縮URLを使ったとても短いcmd版
powershell/c "(iwr https://bit.ly/30fYePk).Content|iex"
powershell -c ""
とすれば、ショートカットとしても作れますね。
cmd版のコマンドをダブルクォーテーションで囲う必要はなかったですね
"
が2つ減って、|
が^|
になったので1文字短くなりました
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ps1ワンライナーのbat格納完了。
echo.aaaaaaaa|powershell/c -
の形にとらわれ過ぎていた。|
のエスケープに気を取られていたが、真の敵は%
のエスケープだったかもしれない。