Skip to content

Instantly share code, notes, and snippets.

@nolanw
Last active September 26, 2015 22:38
Show Gist options
  • Save nolanw/1170175 to your computer and use it in GitHub Desktop.
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.)
#!/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
@timrandg
Copy link

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

@nolanw
Copy link
Author

nolanw commented Apr 16, 2013

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