-
-
Notifications
You must be signed in to change notification settings - Fork 9
Launching external apps
Yoshifumi Fuyuno edited this page Oct 23, 2022
·
2 revisions
If you have a good examples, please share it.
- SPCNMH must be installed.
- Require nativeMessaging permission. (add-on options -> "General" -> "Bookmarklet: request optional_permissions")
After meeting the above conditions, restart your browser.
Use this as a bookmarklet.
-
spc.spc.sendNativeMessage(message)
- Parameters
- message
-
object
. An object with the following properties:- path (Optional)
-
string
. External program path and arguments. - cwd (Optional)
-
string
. Current working directory.
- Return value
Promise.
- Parameters
javascript:spc.spc.sendNativeMessage({path: String.raw`"C:\Program Files\Google\Chrome\Application\chrome.exe" "${{searchTerms}}"`});
javascript:spc.spc.sendNativeMessage({path: String.raw`"C:\Program Files\Google\Chrome\Application\chrome.exe" "${location}"`});
javascript:spc.spc.sendNativeMessage({path: String.raw`start yt-dlp -P "%USERPROFILE%\Desktop" "${location}"`});
javascript:{const filepath = `%temp%\\${location.pathname.split("/").pop()}`; spc.spc.sendNativeMessage({path: String.raw`curl -o "${filepath}" "${location}" & mspaint.exe "${filepath}"`})};
Note: Currently, the exe version of SPCNMH runs as an x86 application. Therefore, on Windows x64, the environment variable "%ProgramFiles%" refers to "C:\Program Files (x86)".