Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find easier way to inject into app without menubar #16

Open
diimdeep opened this issue Jan 29, 2015 · 9 comments
Open

Find easier way to inject into app without menubar #16

diimdeep opened this issue Jan 29, 2015 · 9 comments

Comments

@diimdeep
Copy link

Currently I am using modified shell script(opens browser after load) and manually invoke it with pid

#!/bin/bash
lldb --attach-pid "$1" <<EOF
p (char)[[NSBundle bundleWithPath:@"/Library/Frameworks/FScript.framework"] load]
p (void)[FScriptMenuItem insertInMainMenu]
p (void)[[FSInterpreter interpreter] browse]
detach
quit
EOF

I tried to invoke it with service trough global hotkey but it not work everywhere.

tell application "System Events"
    set pid to unix id of the first process whose frontmost is true
end tell

do shell script POSIX path of (path to current user folder) & "Library/Services/fscript-inject " & pid with administrator privileges

Maybe write helper app to choose from list of process to inject into ?

@Kentzo
Copy link
Owner

Kentzo commented Feb 25, 2015

Automator allows you to program simple dialog boxes. Popup button would be sufficient in this case. But again, service requires an active app and context to be executed. Separate script is preffered for this approach.

@perfaram
Copy link

You could use EasySIMBL, that's what I do

@diimdeep
Copy link
Author

@perfaram Nice, can you share your solution ?

@perfaram
Copy link

Yep, gonna post it this evening (I'll make a repo)

@perfaram
Copy link

Steps :

  1. Download EasySIMBL (https://github.com/norio-nomura/EasySIMBL/releases)
  2. Extract and move EasySIMBL.app into /Applications or ~/Applications
  3. Launch EasySIMBL.app and check Use SIMBL, then quit EasySIMBL.app
  4. Download FScript (https://github.com/Kentzo/F-Script/releases) and put it in /Library/Frameworks/
  5. Use my very own SIMBL plugin that loads FScript (https://github.com/perfaram/SIMBL-fscript)
  6. Compile it (xCode)
  7. Add it into EasySIMBL's Plugin Folder (usually, `~/Library/Application Support/SIMBL/Plugins/"
  8. Activate it in EasySIMBL
  9. Profit !
  10. Star my repo ⭐

NB : This will load FScript into all applications. To load it into one specific app, open my project in xCode, and edit Info.plist's BundleIdentifier key (into SIMBLTargetApplications array) to match your app's identifier.

@diimdeep
Copy link
Author

Thanks, I see it use insertInMainMenu but some apps don't have main menu to inject into, background or menubar icon only.

@perfaram
Copy link

Then, wait a minute. I'm gonna add something to my repo

@perfaram
Copy link

Okay, thougher than expected... Currently trying to work with shortcuts.
EDIT : OKAY !! Shortcuts added !
⌘ + ⌥ + ⇧ + C to show console, ⌘ + ⌥ + ⇧ + O to show Object explorer.
In my repo as always : https://github.com/perfaram/SIMBL-fscript

@perfaram
Copy link

Finally, if you're not pleased with shortcuts, then use the UDP socket at port 7138 :

echo -n "console" | nc -4u -w0 localhost 7138

Replace console by browser if needed ;-)

@Kentzo Kentzo mentioned this issue Oct 22, 2015
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants