Skip to content

Instantly share code, notes, and snippets.

@nolanw nolanw/fscript.rb
Last active Sep 26, 2015

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

timrandg commented Dec 12, 2011

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

This comment has been minimized.

Copy link
Owner 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
You can’t perform that action at this time.