I created a bundle command to open a file from a repository directory, based on the selected text. It was put in the Text bundle, with no particular context.
Here's my current (working) command.
open "file:///path/to/repository/volume/$TM_SELECTED_TEXT.pdf"
This will open the PDF file with the selected filename. (I use open since I want to see the PDF in Acrobat, not TextMate.)
However, now there's arbitrary (unknown) text attached to the filename, so I want to use a wildcard in this command.
I got a suggestion to use an unquoted * as a wildcard. But if AAAA is selected, this command:
open "file:///path/to/repository/$TM_SELECTED_TEXT"*
will open a file in Textmate named AAAA*, which is not what I want: I want AAAA.pdf and AAAA-morestuff.pdf to open.
Any help is appreciated.
Thanks
Darryl
[I originally had this question attached as a comment to a TextMate blog entry, where Allen Odegaard posted the * wildcard suggestion, but it didn't work in this context.]
On Nov 15, 2007, at 11:04 AM, dzurn wrote:
However, now there's arbitrary (unknown) text attached to the filename, so I want to use a wildcard in this command. I got a suggestion to use an unquoted * as a wildcard. But if AAAAis selected, this command: open "file:///path/to/repository/$TM_SELECTED_TEXT"* will open a file in Textmate named AAAA*, which is not what I want: I want AAAA.pdf and AAAA-morestuff.pdfto open.
The `open` command will handle local files just fine without the "file://" protocol specified. This worked for me to open `textmate.pdf`:
open "/Users/rob/Documents/Books/textmate"*
Note that the * wild-card is interpreted by the shell and the result is then passed to `open`. Your shell doesn't see any files named "file://something", so it bails. Basically, the * means nothing to the `open` command and "file://" means nothing to your shell. A plain old file path is something they both understand, which is why the above command works.
--- Rob McBroom http://www.skurfer.com/ I didn't "switch" to Apple... my OS did.
Rob McBroom wrote:
On Nov 15, 2007, at 11:04 AM, dzurn wrote:
The `open` command will handle local files just fine without the "file://" protocol specified. This worked for me to open `textmate.pdf`:
open "/Users/rob/Documents/Books/textmate"*
Note that the * wild-card is interpreted by the shell and the result is then passed to `open`. Your shell doesn't see any files named "file://something", so it bails. Basically, the * means nothing to the `open` command and "file://" means nothing to your shell. A plain old file path is something they both understand, which is why the above command works.
Rob McBroom
Odd. I couldn't get the open command to work without the file:// protocol. However, I found that the problem I was having was due to my encoding the spaces as "%20" in the open command. Once I got rid of the file:// and the %20 (replaced with spaces) then the * wildcard would work.
Thanks a lot! Darryl Zurn
what is useful this for?
On Nov 20, 2007 6:09 PM, dzurn daz-macromates@zzzurn.com wrote:
Rob McBroom wrote:
On Nov 15, 2007, at 11:04 AM, dzurn wrote:
The `open` command will handle local files just fine without the "file://" protocol specified. This worked for me to open `textmate.pdf`:
open "/Users/rob/Documents/Books/textmate"*
Note that the * wild-card is interpreted by the shell and the result is then passed to `open`. Your shell doesn't see any files named "file://something", so it bails. Basically, the * means nothing to the `open` command and "file://" means nothing to your shell. A plain old file path is something they both understand, which is why the above command works.
Rob McBroom
Odd. I couldn't get the open command to work without the file:// protocol. However, I found that the problem I was having was due to my encoding the spaces as "%20" in the open command. Once I got rid of the file:// and the %20 (replaced with spaces) then the * wildcard would work.
Thanks a lot! Darryl Zurn -- View this message in context: http://www.nabble.com/Re%3A-A-TextMate-command-to-open-an-arbitrary-PDF-file... Sent from the textmate users mailing list archive at Nabble.com.
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
I made this command since I always have TextMate running, and get requests where I need to look up a part number's history in a (PDF) file, all stored in a particular directory on the network.
Using this command, I can copy from an email the ten or so part numbers into TextMate, and quickly display the corresponding PDFs, if they exist.
The PDF filename can contain other informative text, and now using this textMate command I can open *any* PDF files in Acrobat that start with this part number.
Darryl
what is useful this for?
On Nov 20, 2007 6:09 PM, dzurn daz-macromates@zzzurn.com wrote:
Rob McBroom wrote:
...
open "/Users/rob/Documents/Books/textmate"*
i see. do you use windows? because mac users have spotlight wich at least me, i don't see how anything else can be faster.
On Nov 20, 2007 8:45 PM, dzurn daz-macromates@zzzurn.com wrote:
I made this command since I always have TextMate running, and get requests where I need to look up a part number's history in a (PDF) file, all stored in a particular directory on the network.
Using this command, I can copy from an email the ten or so part numbers into TextMate, and quickly display the corresponding PDFs, if they exist.
The PDF filename can contain other informative text, and now using this textMate command I can open *any* PDF files in Acrobat that start with this part number.
Darryl
what is useful this for?
On Nov 20, 2007 6:09 PM, dzurn daz-macromates@zzzurn.com wrote:
Rob McBroom wrote:
...
open "/Users/rob/Documents/Books/textmate"*
-- View this message in context: http://www.nabble.com/Re%3A-A-TextMate-command-to-open-an-arbitrary-PDF-file...
Sent from the textmate users mailing list archive at Nabble.com.
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 Nov 20, 2007, at 2:19 PM, Baluta Cristian wrote:
i see. do you use windows? because mac users have spotlight wich at least me, i don't see how anything else can be faster.
A wild-card match on file names in a particular directory is going to be a shit-load faster than Spotlight (and that's what he wants to do). It also won't return a bunch of noise he isn't interested in, so I can see why he's going this route.
--- Rob McBroom http://www.skurfer.com/ I didn't "switch" to Apple... my OS did.
The directory is on a network (SMB) mount, with thousands and thousands of files in it. The Finder is very very slow dealing with large directories, and with network shares. Combining the two is a recipe for long wait times. You also have to play around to get Spotlight to index network shares.
And yes, this is much faster than Spotlight, even if it was on a local drive. And all the filename matches are opened at once, with one keyboard shortcut.
What's not to love?
Darryl
Rob McBroom wrote:
On Nov 20, 2007, at 2:19 PM, Baluta Cristian wrote:
i see. do you use windows? because mac users have spotlight wich at least me, i don't see how anything else can be faster.
A wild-card match on file names in a particular directory is going to be a shit-load faster than Spotlight (and that's what he wants to do). It also won't return a bunch of noise he isn't interested in, so I can see why he's going this route.
Rob McBroom http://www.skurfer.com/ I didn't "switch" to Apple... my OS did.
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