Hello all,
I'm a new textmate user- my intention is to use it for web development. one of the most useful bundle commands, obviously, would be the "open document in running browsers".
however, when i run that command, absolutely nothing happens. textmate just sits there, staring at me.
am i missing something? to me, it would seem that if i'm working on an html document, if i were to run that command, it would have safari (which is already running) open the document to show me what it would look like. same goes for firefox or IE (shudder).
i've searched through the archives of this list and no one seems to mention my problem. also- this has happened on two seperate computers, so i don't think this is a local system issue.
i should mention that i'm mostly familiar with html/css code - hardly low-level stuff. so bear with me.
any help would be greatly appreciated. thanks!
chippper
Chip,
On Feb 3, 2007, at 11:23 AM, Chip Cullen wrote:
I'm a new textmate user- my intention is to use it for web development. one of the most useful bundle commands, obviously, would be the "open document in running browsers".
however, when i run that command, absolutely nothing happens. textmate just sits there, staring at me.
am i missing something? to me, it would seem that if i'm working on an html document, if i were to run that command, it would have safari (which is already running) open the document to show me what it would look like. same goes for firefox or IE (shudder).
I've only lurked on the list so far, and I'm not a Textmate expert, but I do know how to read code...
If you use the bundle editor to look at the command, you will see that the command uses applescript to get a list of running applications. Then it tries to match against this list of names (Webkit, Safari, Shiira, Firefox, Internet Explorer, OmniWeb, Camino and Xyle scope). In the case of Firefox, the internal app name is 'firefox-bin' which doesn't match the name the script is looking for if the match is case sensitive. Also, in firefox's case it tells the app to add a tab to window 1 to show the url in. If there is no open window, this will fail.
This brings me to my newbie question. What is the best method for submitting suggested patches to bundles?
On Feb 4, 2007, at 10:56 AM, Roger Roelofs wrote:
This brings me to my newbie question. What is the best method for submitting suggested patches to bundles?
Just send them to this list, almost all bundle developers read it to some extend. Or, if the bundle is a really obscure one, you can try contacting the bundle developer (usually found by doing an svn log on the bundle and seeing who committed the most to it., then using the aliases page to locate them, when possible: http://macromates.com/ wiki/Main/Aliases ).
Welcome aboard!
Haris
well, i don't know what to do with getting textmate to work with safari. am i the only one who is running into this problem? i feel like it can't just be me.
Roger, thanks for your insight. do you have any idea what safari's 'real name' would be?
is this bundle command actually working for anyone else??
please let me know. thanks!
On 2/4/07, Charilaos Skiadas skiadas@hanover.edu wrote:
On Feb 4, 2007, at 10:56 AM, Roger Roelofs wrote:
This brings me to my newbie question. What is the best method for submitting suggested patches to bundles?
Just send them to this list, almost all bundle developers read it to some extend. Or, if the bundle is a really obscure one, you can try contacting the bundle developer (usually found by doing an svn log on the bundle and seeing who committed the most to it., then using the aliases page to locate them, when possible: http://macromates.com/ wiki/Main/Aliases ).
Welcome aboard!
Haris
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Feb 5, 2007, at 2:02 AM, Chip Cullen wrote:
well, i don't know what to do with getting textmate to work with safari. am i the only one who is running into this problem? i feel like it can't just be me.
I just use the built in preview (ctrl-cmd-opt-P), which uses webkit anyway, so it should look exactly like safari would show it.
The built in previous is also "live" as far as html and internal css goes. External css is another story.
(I guess I get by with cmd+tab plus cmd-R when actually using a browser to preview. Saving one keystroke just isn't worth it that much. YMMV)
Haris
On 5 Feb 2007, at 07:02, Chip Cullen wrote:
well, i don't know what to do with getting textmate to work with safari. am i the only one who is running into this problem? i feel like it can't just be me.
Hi Chip,
I thought I'd have a little dig around, as I am experiencing the same problem. First, I tested the code that appears in the bundle item, and got the following error;
129:130: syntax error: No user interaction allowed. (-1713)
This usually means that the applescript code in the osascript call is trying to do something like display a dialog, which it can't do when it is called as a shell command.
So, I took the osascript calls and turned them in to a standard applescript in script editor. When I tried to compile, it asked me to locate the app 'Webkit' on my machine. This is where I'm not sure what should happen: as Webkit is a framework rather than an app, surely it can't be called with a 'tell app' applescript command?
Anyway, editing the osascript calls in the bundle item to remove the Webkit related items is a workaround. If you open the bundle item, select the 'Open Document in Running Browsers' command and replace the block of code below the line that says:
##Safari or Webkit
with this:
[[ $(ps -xc|grep Safari) ]] && osascript -e 'tell app "System Events"' -e 'set proclist to name of every application process' -e 'if proclist contains "Safari" then' -e 'tell app "Safari"' -e activate -e "make new document" -e "set the URL of document 1 to "$activeURL"" -e 'end tell' -e 'end if' -e 'end tell'
...then the preview command will work correctly. It will also work for Firefox and the other browsers listed - the reason it wasn't before was because of the error in this block of code, which was preventing the rest of the preview code from being executed.
Perhaps someone more knowledgeable could chime in with why the Webkit bit isn't working & whether it needs to be there before we submit a patch to the bundle.
cheers Ben
On Feb 6, 2007, at 8:47 AM, Ben Edwards wrote:
So, I took the osascript calls and turned them in to a standard applescript in script editor. When I tried to compile, it asked me to locate the app 'Webkit' on my machine. This is where I'm not sure what should happen: as Webkit is a framework rather than an app, surely it can't be called with a 'tell app' applescript command?
Webkit is the name of the developer versions of the Safari browser, as well as the name of the framework that is used. You can get Webkit nightlies over here I think: http://webkit.org/
I think Kevin Ballard was the last one to mess with this command, perhaps he can shed some more light into it.
cheers Ben
Haris
Hrm...
Ben- thank you so much for looking into this. Unfortunately, I did what you suggested and still nothing. What i'm thinking i may have done was try to fiddle with the bundle previously, and that's why your fix may not be working. is there anywhere i can get the default bundle short of a re-install? not that it's a big deal, just wondering. thanks!!
Chip
On 2/6/07, Charilaos Skiadas skiadas@hanover.edu wrote:
On Feb 6, 2007, at 8:47 AM, Ben Edwards wrote:
So, I took the osascript calls and turned them in to a standard applescript in script editor. When I tried to compile, it asked me to locate the app 'Webkit' on my machine. This is where I'm not sure what should happen: as Webkit is a framework rather than an app, surely it can't be called with a 'tell app' applescript command?
Webkit is the name of the developer versions of the Safari browser, as well as the name of the framework that is used. You can get Webkit nightlies over here I think: http://webkit.org/
I think Kevin Ballard was the last one to mess with this command, perhaps he can shed some more light into it.
cheers Ben
Haris
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Chip Cullen wrote:
Hrm...
Ben- thank you so much for looking into this. Unfortunately, I did what you suggested and still nothing. What i'm thinking i may have done was try to fiddle with the bundle previously, and that's why your fix may not be working. is there anywhere i can get the default bundle short of a re-install? not that it's a big deal, just wondering. thanks!!
Chip
It should be enough to remove the ~/Library/Application Support/TextMate/Bundles directory. This will remove *all* modifications you made (using the Bundle Editor of TextMate).
If you just want to remove modifications of the HTML bundle, then remove the file HTML.tmbundle in ~/Library/Application Support/TextMate/Bundles
Hope this helps, Simon - -- + privacy is necessary + using http://gnupg.org + public key id: 0x6115F804EFB33229
Simon,
That did indeed restore the default bundle- thanks! However, I tried Ben's suggestion and it still isn't working. It just sits there.
?????
Thanks for everyone's help so far!
Chip
On 2/6/07, Simon Ruderich simon@ruderich.com wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Chip Cullen wrote:
Hrm...
Ben- thank you so much for looking into this. Unfortunately, I did what you suggested and still nothing. What i'm thinking i may have done was try to fiddle with the bundle previously, and that's why your fix may not be working. is there anywhere i can get the default bundle short of a re-install? not that it's a big deal, just wondering. thanks!!
Chip
It should be enough to remove the ~/Library/Application Support/TextMate/Bundles directory. This will remove *all* modifications you made (using the Bundle Editor of TextMate).
If you just want to remove modifications of the HTML bundle, then remove the file HTML.tmbundle in ~/Library/Application Support/TextMate/Bundles
Hope this helps, Simon
- privacy is necessary
- using http://gnupg.org
- public key id: 0x6115F804EFB33229
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (Darwin)
iD8DBQFFyKnYYRX4BO+zMikRCtlmAJ9VJFm4zUkLr2FY0lK8GJAUbv4YKQCfSzT9 bR3nuKK9OCjjgjyRmEYWaHA= =QYyk -----END PGP SIGNATURE-----
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Chip,
On Feb 5, 2007, at 2:02 AM, Chip Cullen wrote:
well, i don't know what to do with getting textmate to work with safari. am i the only one who is running into this problem? i feel like it can't just be me.
Roger, thanks for your insight. do you have any idea what safari's 'real name' would be?
Chip and list,
I played with the code for this command and have something that works on my machine. Could some of yo q a it and make sure I haven't done something stupid :-)
---------------- Code for: Open Document(s) in Running Browser ---------- ### Preview in All Active Browsers ### v1.0. 2005-03-29 ### v1.1. 2005-12-04 ### v2.2. 2006-11-03 ### v3.0. 2007-02-08 ### ### CONFIG OPTION:: Set TM_PROJECT_SITEURL in your TM Project Window Info Button in the following form: [ http://your.site.ext/ ] ###
# 1. Check if we have a SITE_URL if [[ -n "$TM_PROJECT_SITEURL" ]] then activeURL="$TM_PROJECT_SITEURL${TM_FILEPATH## $TM_PROJECT_DIRECTORY}" else activeURL="file://$TM_FILEPATH" fi
osascript <<"APPLESCRIPT" - "$activeURL" on run(argv) set activeURL to item 1 of argv set startFrag to "on run(argv)" & return & "tell app " set makedoc to " to make new document with properties {URL: item 1 of argv}" & return & "end run" set mbrowsers to {"Webkit", "Safari", "Shiira"} set gurl to " to Get URL (item 1 of argv)" & return & "end run" set gbrowsers to ["Camino", "Xyle scope", "firefox-bin"] set gurl2 to " to GetURL (item 1 of argv)" & return & "end run" set g2browsers to ["Omniweb", "Opera"] tell application "System Events" to set proclist to name of every application process repeat with browser in mbrowsers if proclist contains browser then set cmd to startFrag & """ & browser & """ & makedoc run script cmd with parameters {activeURL} end if end repeat repeat with browser in gbrowsers if proclist contains browser then set cmd to startFrag & """ & browser & """ & gurl run script cmd with parameters {activeURL} end if end repeat repeat with browser in g2browsers if proclist contains browser then set cmd to startFrag & """ & browser & """ & gurl2 run script cmd with parameters {activeURL} end if end repeat
-- I don't know what this does, so i left it in if proclist contains "$1" then run script "on run(argv)" & return & "tell app "$1" to `pbpaste`" & return & "end run" with parameters {activeURL} end if
-- ie could also use GetuRL but then you can't tell it to ignore the cache if proclist contains "Internet Explorer" then run script "on run(argv)" & return & "tell app "Internet Explorer " to activate OpenURL (item 1 of argv) toWindow 0 Flags 1" & return & "end run" with parameters {activeURL} end if end run APPLESCRIPT ------------------------- end code -------------
Watch for line breaks when copying.
Thanks!