Last active
September 26, 2015 22:38
-
-
Save nolanw/1170175 to your computer and use it in GitHub Desktop.
Inject F-Script into any app on OS X 10.7 or 10.8.
(Yet another F-Script Anywhere replacement.)
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
#!/usr/bin/env ruby | |
FSCRIPT_PATH = "/Library/Frameworks/FScript.framework" | |
if ARGV.empty? | |
puts "Usage: #{$0} process_name" | |
exit | |
end | |
GDB = IO.popen("gdb", 'w') | |
def gdb(cmd) | |
GDB.puts cmd | |
GDB.flush | |
end | |
gdb "attach '#{ARGV[0]}'" | |
gdb "p (char)[[NSBundle bundleWithPath:@\"#{FSCRIPT_PATH}\"] load]" | |
gdb "p (void)[FScriptMenuItem insertInMainMenu]" | |
gdb "detach" | |
gdb "quit" | |
GDB.close | |
puts |
Good call. Also fixed injecting into apps with spaces in their name.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I appended a single line to the end.
STDOUT.puts #this puts the command line prompt back on its own line.
Thanks for the code, cool wrapper.
Tim