From tmtxpstuff@consking.com Wed Aug 9 02:53:03 2006 From: marios To: textmate@lists.macromates.com Subject: [TxMt] drag commands Date: Wed, 09 Aug 2006 01:02:08 +0300 Message-ID: <44D909E0.6000300@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5145078308127450582==" --===============5145078308127450582== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit I have the following drag command for zip files to be inserted as snippet: echo -n "\${3:"$TM_DROPPED_FILE"}" This will insert a download snippet for a default URL on a live server. However, I would like to strip the path somehow from the variable. Does anyone know how to do this,through a substitution reg ex maybe ? Additionally a variable named $TM_FILE_NAME (That would just insert the name of the file instead of $TM_DROPPED_FILE would make much sense here for such a drag command, where you don't care so much about the path. regards, marios --===============5145078308127450582==-- From torsten.becker@gmail.com Wed Aug 9 11:50:49 2006 From: Torsten Becker To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Wed, 09 Aug 2006 13:50:45 +0200 Message-ID: In-Reply-To: <44D909E0.6000300@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4207354875174257505==" --===============4207354875174257505== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit marios wrote: > I have the following drag command for zip files to be inserted as snippet: > > echo -n " title=\"\${2:"$TM_DROPPED_FILE"}\">\${3:"$TM_DROPPED_FILE"}" > > This will insert a download snippet for a default URL on a live server. > > However, I would like to strip the path somehow from the variable. > > > Does anyone know how to do this,through a substitution reg ex maybe ? ruby can do this for you: echo -n "\${3:\$2}" -- Torsten --===============4207354875174257505==-- From tmtxpstuff@consking.com Wed Aug 9 15:03:10 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Wed, 09 Aug 2006 18:02:58 +0300 Message-ID: <44D9F922.5070902@consking.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8124379249853212638==" --===============8124379249853212638== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Torsten Becker wrote: > marios wrote: >> I have the following drag command for zip files to be inserted as >> snippet: >> >> echo -n "> title=\"\${2:"$TM_DROPPED_FILE"}\">\${3:"$TM_DROPPED_FILE"}" >> >> This will insert a download snippet for a default URL on a live server. >> >> However, I would like to strip the path somehow from the variable. >> >> >> Does anyone know how to do this,through a substitution reg ex maybe ? > > ruby can do this for you: > > echo -n " title=\"\${2:`ruby -e 'print > ENV['\''TM_DROPPED_FILE'\''].gsub(/^(.*\/)/, > String.new)'`}\">\${3:\$2}" > I tried the above, but String.new outputs nil instead. (My SupportFolder is updated through subversion) regards, marios --===============8124379249853212638==-- From torsten.becker@gmail.com Wed Aug 9 18:23:20 2006 From: Torsten Becker To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Wed, 09 Aug 2006 20:23:17 +0200 Message-ID: In-Reply-To: <44D9F922.5070902@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2983425042625872687==" --===============2983425042625872687== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit marios wrote: > I tried the above, but String.new outputs nil instead. (My SupportFolder > is updated through subversion) > > regards, marios Hmm, I did check it again (with Tiger's ruby) and I just get nil in the output if I don't have everything in one line, please try to put the above in just one line and it should work. (Take care that you don't accidently remove a \ or so .. they are important :>) I also attached the snippet maybe you want to use this instead of copy and pasting. :) -- Torsten --===============2983425042625872687== Content-Type: application/octet-stream Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ZipDrag.tmDragCommand" MIME-Version: 1.0 PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHBsaXN0IFBV QkxJQyAiLS8vQXBwbGUgQ29tcHV0ZXIvL0RURCBQTElTVCAxLjAvL0VOIiAiaHR0cDovL3d3dy5h cHBsZS5jb20vRFREcy9Qcm9wZXJ0eUxpc3QtMS4wLmR0ZCI+CjxwbGlzdCB2ZXJzaW9uPSIxLjAi Pgo8ZGljdD4KCTxrZXk+YmVmb3JlUnVubmluZ0NvbW1hbmQ8L2tleT4KCTxzdHJpbmc+bm9wPC9z dHJpbmc+Cgk8a2V5PmJ1bmRsZVVVSUQ8L2tleT4KCTxzdHJpbmc+MjhERUE4NTYtMDRGOS0xMURC LUFCMjUtMDAxMTI0MkU0MTg0PC9zdHJpbmc+Cgk8a2V5PmNvbW1hbmQ8L2tleT4KCTxzdHJpbmc+ ZWNobyAtbiAiJmx0O2EgaHJlZj1cImh0dHA6Ly8kVE1fUkVNT1RFX1VSTC9maWxlX2Rvd25sb2Fk L1wkezE6ZmlsZV9pZH1cIiB0aXRsZT1cIlwkezI6YHJ1YnkgLWUgJ3ByaW50IEVOVlsnXCcnVE1f RFJPUFBFRF9GSUxFJ1wnJ10uZ3N1YigvXiguKlwvKS8sU3RyaW5nLm5ldyknYH1cIiZndDtcJHsz OlwkMn0mbHQ7L2EmZ3Q7Ijwvc3RyaW5nPgoJPGtleT5kcmFnZ2VkRmlsZUV4dGVuc2lvbnM8L2tl eT4KCTxhcnJheT4KCQk8c3RyaW5nPnR4dDwvc3RyaW5nPgoJCTxzdHJpbmc+emlwPC9zdHJpbmc+ Cgk8L2FycmF5PgoJPGtleT5pbnB1dDwva2V5PgoJPHN0cmluZz5zZWxlY3Rpb248L3N0cmluZz4K CTxrZXk+bmFtZTwva2V5PgoJPHN0cmluZz5aaXAgRHJhZzwvc3RyaW5nPgoJPGtleT5vdXRwdXQ8 L2tleT4KCTxzdHJpbmc+aW5zZXJ0QXNTbmlwcGV0PC9zdHJpbmc+Cgk8a2V5PnV1aWQ8L2tleT4K CTxzdHJpbmc+Qzg5M0I0MjAtMjc5Qi0xMURCLThDQzctMDAxMTI0MkU0MTg0PC9zdHJpbmc+Cjwv ZGljdD4KPC9wbGlzdD4K --===============2983425042625872687==-- From tmtxpstuff@consking.com Thu Aug 10 09:41:28 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Thu, 10 Aug 2006 12:41:22 +0300 Message-ID: <44DAFF42.1030806@consking.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4126946088236187929==" --===============4126946088236187929== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Torsten Becker wrote: > marios wrote: >> I tried the above, but String.new outputs nil instead. (My SupportFolder >> is updated through subversion) >> >> regards, marios > > Hmm, I did check it again (with Tiger's ruby) and I just get nil in > the output if I don't have everything in one line, please try to put > the above in just one line and it should work. (Take care that you > don't accidently remove a \ or so .. they are important :>) > > I also attached the snippet maybe you want to use this instead of copy > and pasting. :) > > ------------------------------------------------------------------------ > > > ______________________________________________________________________ > For new threads USE THIS: textmate(a)lists.macromates.com > (threading gets destroyed and the universe will collapse if you don't) > http://lists.macromates.com/mailman/listinfo/textmate Yes, that works. There where three newline characters, in my code sample. One more useful keyboard shortcut, that I need to remember in all those cases: option command I (Show invisibles ) Your code sample works as expected. Thanks many. I am happy. I also took a look, at Alan's Drag Example that uses Perl instead, as part of the Documentation, but as he mentioned : Slightly complex. regards, marios --===============4126946088236187929==-- From tmtxpstuff@consking.com Sat Sep 30 20:38:37 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Sat, 30 Sep 2006 23:38:20 +0300 Message-ID: <451ED5BC.6030704@consking.com> In-Reply-To: <44DAFF42.1030806@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1739160161293609462==" --===============1739160161293609462== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Hi, again. I had a look again today at the drag commands documentation (man sec 11) " TM_MODIFIER_FLAGS — the modifier keys which were held down when the file got dropped. This is a bitwise OR in the form: SHIFT|CONTROL|OPTION|COMMAND (in case all modifiers were down). " However, I couldnt' figure this one out. What I would like to do , is to make the command conditional, so it will do a different thing with the URL holding option and command. How do I change the code, so it uses a different Variable in these cases ? (for instance, in this case, using a different variable like $TM_LOCAL_URL instead of $TM_REMOTE_URL) This is the current drag command: echo -n "\${3:\$2}" Also , I tried to modify the code so it strips off the file-extension from the third variable doing the usual TM Transformation, but then I get an Error , gsub complaining. Thanks again, regards, marios --===============1739160161293609462==-- From throw-away-1@macromates.com Sun Oct 1 09:40:32 2006 From: Allan Odgaard To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Sun, 01 Oct 2006 11:40:26 +0200 Message-ID: <3D025D31-76B4-4AFD-BC08-7ACBE43036EE@macromates.com> In-Reply-To: <451ED5BC.6030704@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7116471769284440839==" --===============7116471769284440839== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On 30/9/2006, at 22:38, marios wrote: > [...] How do I change the code, so it uses a different Variable in > these cases ? > (for instance, in this case, using a different variable like > $TM_LOCAL_URL instead of $TM_REMOTE_URL) You can do something like: if [[ "$TM_MODIFIER_FLAGS" = *OPTION* ]] then BASE="$TM_LOCAL_URL" else BASE="$TM_REMOTE_URL" fi Then in your command use "$BASE" (which will be the local URL when ⌥ is down). > echo -n " title=\"\${2:`ruby -e 'print > ENV['\''TM_DROPPED_FILE'\''].gsub(/^(.*\/)/,String.new)'`}\">\${3:\ > $2}" > > Also , I tried to modify the code so it strips off the file-extension > from the third variable doing the usual TM Transformation, > but then I get an Error , gsub complaining. Just paste an example of the desired result. --===============7116471769284440839==-- From tmtxpstuff@consking.com Sun Oct 1 12:26:46 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Sun, 01 Oct 2006 15:26:24 +0300 Message-ID: <451FB3F0.6040604@consking.com> In-Reply-To: <3D025D31-76B4-4AFD-BC08-7ACBE43036EE@macromates.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0006463592237803772==" --===============0006463592237803772== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Allan Odgaard wrote: > On 30/9/2006, at 22:38, marios wrote: > >> [...] How do I change the code, so it uses a different Variable in >> these cases ? >> (for instance, in this case, using a different variable like >> $TM_LOCAL_URL instead of $TM_REMOTE_URL) > > You can do something like: > > if [[ "$TM_MODIFIER_FLAGS" = *OPTION* ]] > then BASE="$TM_LOCAL_URL" > else BASE="$TM_REMOTE_URL" > fi > > Then in your command use "$BASE" (which will be the local URL when ⌥ > is down). > Wonderful. I've got this working now, except, there is one peculiar thing happening, that's not directly related with this. When I use option, and drag the File, The document window looses focus and disappears under the cursor, when the file gets dropped in the document window, so I changed the whole thing to use Shift instead, where I get the expected behavior. This is what I have so far using your recommendation: if [[ "$TM_MODIFIER_FLAGS" = *SHIFT* ]] then BASE="$TM_LOCAL_URL" else BASE="$TM_REMOTE_URL" fi echo -n "\${3:\$2}" >> echo -n "> title=\"\${2:`ruby -e 'print >> ENV['\''TM_DROPPED_FILE'\''].gsub(/^(.*\/)/,String.new)'`}\">\${3:\$2}" >> >> >> Also , I tried to modify the code so it strips off the file-extension >> from the third variable doing the usual TM Transformation, >> but then I get an Error , gsub complaining. > > Just paste an example of the desired result. This is the output that I have using the above modification. test.abc test.abc What I am trying to achieve is this: test test ,where test is a transformation of $TM_DROPPED_FILE getting stripped off both the relative path AND the file extension .abc I had a look also, at http://macromates.com/blog/archives/2005/09/26/shell-variables/, Is there a shorthand way, also to strip both, at the end and the beginning, using this method ? regards, marios > > > --===============0006463592237803772==-- From throw-away-1@macromates.com Mon Oct 2 02:11:17 2006 From: Allan Odgaard To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Mon, 02 Oct 2006 04:11:06 +0200 Message-ID: <6583E5A3-AB8F-4074-BD6C-91C2C5E591FD@macromates.com> In-Reply-To: <451FB3F0.6040604@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3012096336640570552==" --===============3012096336640570552== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On 1/10/2006, at 14:26, marios wrote: > [...] When I use option, and drag the File, The document window > looses focus and disappears under the cursor, when the file gets > dropped in the document window, so I changed the whole thing to use > Shift instead, where I get the expected behavior. What’s happening here is, that if you ⌥-click another application, your active application will hide. So you need to first drag the icon, then press ⌥. > [...] This is the output that I have using the above modification. > > title="test.abc">test.abc > title="test.abc">test.abc > > What I am trying to achieve is this: > > title="test">test > title="test">test > > ,where test is a transformation of $TM_DROPPED_FILE getting > stripped off > both the relative path AND the file extension .abc > > I had a look also, at > http://macromates.com/blog/archives/2005/09/26/shell-variables/, > Is there a shorthand way, also to strip both, at the end and the > beginning, using this method ? The easiest is to use the regexp substitution capabilities of TextMate snippets. So use something like ${TM_DROPPED_FILE/.*\/|\..+//g} — that ought to strip both the leading directories and the trailing extension. --===============3012096336640570552==-- From tmtxpstuff@consking.com Thu Oct 5 03:19:23 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Thu, 05 Oct 2006 06:19:13 +0300 Message-ID: <452479B1.4040108@consking.com> In-Reply-To: <6583E5A3-AB8F-4074-BD6C-91C2C5E591FD@macromates.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6394696571642177681==" --===============6394696571642177681== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Allan Odgaard wrote: > On 1/10/2006, at 14:26, marios wrote: > >> [...] When I use option, and drag the File, The document window >> looses focus and disappears under the cursor, when the file gets >> dropped in the document window, so I changed the whole thing to use >> Shift instead, where I get the expected behavior. > > What’s happening here is, that if you ⌥-click another application, > your active application will hide. So you need to first drag the icon, > then press ⌥. > > Ok, I see. thanks a lot. > The easiest is to use the regexp substitution capabilities of TextMate > snippets. > > So use something like ${TM_DROPPED_FILE/.*\/|\..+//g} — that ought to > strip both the leading directories and the trailing extension. > > > > I still couldn't get the above going, I tried to escape also the above variable and if I do echo the above snippet, as a drag command causes a crash. Shouldn't really get my fingers on this too much, since it is not possible to show the output as a tooltip, tends to be a little dangerous. If I just wanted to echo the filename and strip all the rest off, so I can reuse it and store it in a variable, what would be the best approach ? regards, marios --===============6394696571642177681==-- From tmtxpstuff@consking.com Thu Oct 5 03:32:43 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Thu, 05 Oct 2006 06:32:38 +0300 Message-ID: <45247CD6.3050101@consking.com> In-Reply-To: <452479B1.4040108@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6988648897709936460==" --===============6988648897709936460== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit marios wrote: > Allan Odgaard wrote: > >> On 1/10/2006, at 14:26, marios wrote: >> >> >>> [...] When I use option, and drag the File, The document window >>> looses focus and disappears under the cursor, when the file gets >>> dropped in the document window, so I changed the whole thing to use >>> Shift instead, where I get the expected behavior. >>> >> What’s happening here is, that if you ⌥-click another application, >> your active application will hide. So you need to first drag the icon, >> then press ⌥. >> >> >> > Ok, I see. thanks a lot. > >> The easiest is to use the regexp substitution capabilities of TextMate >> snippets. >> >> So use something like ${TM_DROPPED_FILE/.*\/|\..+//g} — that ought to >> strip both the leading directories and the trailing extension. >> >> >> >> >> Sorry,again Lets say, in the above example leaving Thorsten Beckers excellent Ruby solution in place, in order to strip off hte file exension, would one need to expand $TM_DROPPED_FILE first again, before the pattern match and replacement take place ? I tried to play around with it in UNIX scope, to avoid typos, but no luck. regards, marios --===============6988648897709936460==-- From throw-away-1@macromates.com Thu Oct 5 11:09:51 2006 From: Allan Odgaard To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Thu, 05 Oct 2006 13:09:45 +0200 Message-ID: <0637C230-1427-45ED-B57C-F42D35879F0B@macromates.com> In-Reply-To: <452479B1.4040108@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7677493308473673487==" --===============7677493308473673487== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On 5. Oct 2006, at 05:19, marios wrote: >> The easiest is to use the regexp substitution capabilities of >> TextMate >> snippets. >> >> So use something like ${TM_DROPPED_FILE/.*\/|\..+//g} — that ought to >> strip both the leading directories and the trailing extension. > I still couldn't get the above going, I tried to escape also the above > variable and if I do echo the above snippet, as a drag command causes > a crash. Please paste the code you tried, and certainly also the one which lead to a crash. --===============7677493308473673487==-- From tmtxpstuff@consking.com Thu Oct 5 12:39:22 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Thu, 05 Oct 2006 15:39:17 +0300 Message-ID: <4524FCF5.9060403@consking.com> In-Reply-To: <0637C230-1427-45ED-B57C-F42D35879F0B@macromates.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3442599612596330190==" --===============3442599612596330190== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Filed a ticket better, although I'm pretty sure that I used some wrong syntax anyway. regards, marios > > Please paste the code you tried, and certainly also the one which lead > to a crash. > --===============3442599612596330190==-- From tmtxpstuff@consking.com Sun Oct 8 17:50:07 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Sun, 08 Oct 2006 20:49:46 +0300 Message-ID: <45293A3A.7010702@consking.com> In-Reply-To: <4524FCF5.9060403@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6623883019430718238==" --===============6623883019430718238== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit I finally could figure out how to do this, without using the Ruby code, thanks to Allan's excellent documentations.: base=${TM_DROPPED_FILE%.*} title="${base##*/}" echo -n "\${3:$title}" However, in order to work this correctly, the file must be dragged slowly. If I drag the file to fast, then the regions for the tab stop variables 1, 2 and 3 will loose track and cease to function correctly, since they are highlighted at unproper positions. The command is attached. regards, marios --===============6623883019430718238== Content-Type: application/zip Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ZipDragcommand.tmDragCommand.zip" MIME-Version: 1.0 UEsDBBQACAAIABWlSDUAAAAAAAAAAAAAAAAeABAAWmlwIERyYWcgY29tbWFuZC50bURyYWdDb21t YW5kVVgMAEk4KUUZOClF9QH1AW1SXW/aMBR9Xn6F57I+VEoMAcpHA1WCYwkpHREND5uQUJoYsJbY UeIMOsR/nwODibQvkXN87jn3Xh/reZ8m4DfNCyb4CLaMJgSURyJmfDOCi4Doffg81qyveDYJfvgu yBJWSOAvHG86AVBHyM6yhIKJSLNS0hwhHGDge9PXACgxhNzvEMCtlNkQod1uZ4QV3YhEWhEL5Oci o7l895SqrgqMWMZQ+Z1tbvpSaMwiOda+WL/o+/iNrkVO5yXnqlVln4Y8tlB1owiFzBU65iKz0L/z pazkcUIXiymuk12C22Ybm3p3QgZ6x2019YHdJ+pDTHPQcZwWbtbVos9938KCjhqH4GWF5zPfd/GK TD33m/Fw1CSTCR3BxqHi3N09oCPUaLQVQOcA3ifyKQTbnK5Hy8vSGkpl7r7MAne1mHtozRK6isWO JyKM0bJxaA1PEIuPSwjO6kuocHPYOP0p+H4jnxTSviCVDQorFGr1ieI83GxoTJSmu5eUV/svrvOF eR5Wh+ukf9jNhtGFcNJiXGWivpuCJjSSSrXuzMOU1sk/WQaw6ghcF31bI0r5iQXjhcqUXbxylmVU 1ouKSGWuXiPpXhpbmSaG3H8ITVmyD29sE0Ic+9HRe91uW++YtqPbPRvrA0Jc4jr4sdfv/9ex0Dm7 Fjole6z9BVBLBwj1iD4e9QEAAHkDAABQSwECFQMUAAgACAAVpUg19Yg+HvUBAAB5AwAAHgAMAAAA AAAAAABApIEAAAAAWmlwIERyYWcgY29tbWFuZC50bURyYWdDb21tYW5kVVgIAEk4KUUZOClFUEsF BgAAAAABAAEAWAAAAFECAAAAAA== --===============6623883019430718238==-- From tmtxpstuff@consking.com Mon Oct 9 09:39:17 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Mon, 09 Oct 2006 12:39:08 +0300 Message-ID: <452A18BC.7080701@consking.com> In-Reply-To: <45293A3A.7010702@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6684010734234017729==" --===============6684010734234017729== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Regarding to the previous drag command: In order for this to work correctly, freehand editing mode must not be enabled while dragging. (Thanks Allan) Then it works right out of the box, even while dragging fast. However, I wanted to have the command, so it also strips off double and triple file extensions for the title attribute, as often the case with archive files, changing the code a little in the substitution pattern. I inserted also an additional tab stop value for the URL and added a fall-back value(www.exampe.com) in case $TM_REMOTE_URL is unset. A newline is also inserted after the last tab-trigger. base="${TM_DROPPED_FILE/%.*/}" title="${base##*/}" url2="www.example.com" url1="${TM_REMOTE_URL:-$url2}" echo -n "\${4:$title} " Command is attached. I was thinking, that it would be terrific, to make those commands, so the can do bulk inserting as well. May be that would be possible, by setting a counter for the tab-stop variables so they increment automatically for each bulk dropped file. regards, marios --===============6684010734234017729== Content-Type: application/zip Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ZipDragcommand2.tmDragCommand.zip" MIME-Version: 1.0 UEsDBBQACAAIAORiSTUAAAAAAAAAAAAAAAAgABAAWmlwIERyYWcgY29tbWFuZCAyLnRtRHJhZ0Nv bW1hbmRVWAwAFBUqRfsUKkX1AfUBbVPRbtowFH1evsJ1WR8mJSYhLEADFeBEQqIlouFhExJKEwPW EjtKnEFX8e+zA1Rr1pfIOffcc66Or92HY5aC36QoKWdDaBptCAiLeULZbghXoa/34MNIc2/wYhr+ CDyQp7QUIFhN5rMpgDpC4zxPCZjyLK8EKRDCIQbBfPYcAimGkPcEAdwLkQ8QOhwORqToRswzRSxR UPCcFOJ1LlV12WAkIoHS72zzYS6JJjQWI+2L+4u8jl7IlhdkWTEmR5X2WcQSF6mKJJSikOiI8dxF l/O1rWJJSlarGW6SPR93rA629O7U7+u2Z7b1/rjny49vWX17MjFxu6kWf+77EpVkCFtv4eMGLxdB 4OGNP5t76KvxDZ2gJqhI67ri3d7WWFWk1hCqhMgxyi4Z1bB5UVp6j4vQ26yW84HeUnTZReI9BzoD 8C4V9xHYF2Q7XF/jXrfezIFimie0pSnZJPzAUh4lqmINaogmpzUE54HWUOKdQav+k/DdTtxLxL4i ygNFCtWgpjWjSIpotyOJL1W9oyBMXVz5HkxUFJE6vEf0h364GnQl1FqUyWVqhlqSlMRCqjadWZSR JvknzQGWE4HLDQGr2cUr8YkJZaVcx3H5zGieE9FsKmO5rs0eQY7C2IssbbKriv63GhMHOw4eO7rj tH25Zbirjz3c1s1e357aVvf7xP5nVBedV95F9YMYaX8BUEsHCDSSQBkNAgAAsAMAAFBLAQIVAxQA CAAIAORiSTU0kkAZDQIAALADAAAgAAwAAAAAAAAAAECkgQAAAABaaXAgRHJhZyBjb21tYW5kIDIu dG1EcmFnQ29tbWFuZFVYCAAUFSpF+xQqRVBLBQYAAAAAAQABAFoAAABrAgAAAAA= --===============6684010734234017729==-- From tmtxpstuff@consking.com Wed Oct 11 22:07:11 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Thu, 12 Oct 2006 01:07:06 +0300 Message-ID: <452D6B0A.2050903@consking.com> In-Reply-To: <452A18BC.7080701@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2878960674308830992==" --===============2878960674308830992== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit I had forgotten to include the modifier key flags. Also to make this command a little bit more useful, I added a Filetype variable that can be used, to add some extra text behind the title. It uses shift to distinguish between the base Urls, which when not set up will default to example.com. base="${TM_DROPPED_FILE/%.*/}" title="${base##*/}" FILETYPE=" Download" url2="www.example.com" url1="${TM_REMOTE_URL:-$url2}" url="${TM_LOCAL_URL:-$url2}" if [[ "$TM_MODIFIER_FLAGS" = *SHIFT* ]] then BASE="$url" else BASE="$url1" fi echo -n "\${4:$title}$FILETYPE " I'm trying to figure out, how it can be done, so it does bulk inserting as well, in spite the fact, that they have tab stop variables, but still no go. (May be with sed ?) regards, marios --===============2878960674308830992== Content-Type: application/zip Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ZipDragcommand3.tmDragCommand.zip" MIME-Version: 1.0 UEsDBBQACAAIABAFTDUAAAAAAAAAAAAAAAAgABAAWmlwIERyYWcgY29tbWFuZCAzLnRtRHJhZ0Nv bW1hbmRVWAwA32QtRdBkLUX1AfUBbVNdc5pAFH0uv2K7sXnIDK6IwY+AGRRomSHVUXxoY8YhsOpO YWFgqaYZ/3t3CWYSEp7gnnPPudwP/faYxOAvzguSUgMq7Q4EmIZpROjOgCvfkQfwdizpX63Z1P81 t0EWk4KB+WriuVMAZYTMLIsxmKZJVjKcI2T5Fph77tIHXAwh+ycEcM9YNkLocDi0A0Fvh2kiiAWa 52mGc/bkcVWZJ7QjFkHu92Lzri4ejUjIxtIX/Q9+Gj/ibZrjRUkpL5XbJwGNdCQQTihYzqNjmmY6 qt/PaSWNYrxauVaTbKsdtWsO+7JmTyZyr9/XZFNxhrJqKZo6sTRL7Q6aauHnvo9BgQ3YevbvNtZi Np/b1sZxPRt9a1+hE5QYYXGFC97FRRUTuGiwAYGVHmicBhGUyjzuGlC0DR+DpG5cFVZq+YV9N/Pt zWrhjeSWoJ8quEa92dT03oNkC+7vAWxx9G5muY5rLzaOZ35fQmCAq+UP1/GvwMODBOqH7TEFE3PJ CxMS8BXAcYHfAAqUtkTC4T4FMgXwMmY3AdjneGusz+Nft56VUUuknNCWxHgT1T8qkO6oCpHotIbg pUFryOPqqFV9nVrnDq3h5Y7dcKj3ARKuKBCwBJujivJgt8ORw13sI8NULFbxOrggzwPx8jrCf+Td 6qAzodIilC97c+gFjnHIuGrTmQYJbpJ/kwxYvCJQbxBQm1lpyT4xIbTg52IWS0qyDLNmUhHyc2rm MHxk7T1L4ia7LMmH1XWu+8r1dGjJWk9T5J41VOWBNtBkcRq9nqN0pp03V6Cjl5PUUXWwY+k/UEsH CPYcEF5bAgAAUAQAAFBLAQIVAxQACAAIABAFTDX2HBBeWwIAAFAEAAAgAAwAAAAAAAAAAECkgQAA AABaaXAgRHJhZyBjb21tYW5kIDMudG1EcmFnQ29tbWFuZFVYCADfZC1F0GQtRVBLBQYAAAAAAQAB AFoAAAC5AgAAAAA= --===============2878960674308830992==-- From tmtxpstuff@consking.com Fri Oct 13 21:46:12 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Sat, 14 Oct 2006 00:46:05 +0300 Message-ID: <4530091D.9030403@consking.com> In-Reply-To: <452D6B0A.2050903@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7085697684494831161==" --===============7085697684494831161== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 marios wrote: > I had forgotten to include the modifier key flags. > Also to make this command a little bit more useful, I added a Filetype > variable > that can be used, to add some extra text behind the title. > It uses shift to distinguish between the base Urls, which when not set > up will default to example.com. > > base="${TM_DROPPED_FILE/%.*/}" > title="${base##*/}" > FILETYPE=" Download" > url2="www.example.com" > url1="${TM_REMOTE_URL:-$url2}" > url="${TM_LOCAL_URL:-$url2}" > if [[ "$TM_MODIFIER_FLAGS" = *SHIFT* ]] > then BASE="$url" > else BASE="$url1" > fi > echo -n " title=\"\${3:$title}$FILETYPE\">\${4:$title}$FILETYPE > " > > I'm trying to figure out, how it can be done, so it does bulk inserting > as well, in spite the fact, that they have tab stop variables, but still > no go. Tried some strange constructs with expressions, or let n=(n+1) with sed, but that doesn't seem to give any valid syntax. The reason, why I am so much after this, is that it would open new roads not only for the drag commands, but other commands as well. regards, marios -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) Comment: This might change in the future Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFMAkd8tSzPOYuZvQRAhlnAKC3n606JNXqoyYlb0f8kguC/xnrOQCghLnz W5wahPvexYFYTLUqBD/Yn7Y= =bln1 -----END PGP SIGNATURE----- --===============7085697684494831161==-- From throw-away-1@macromates.com Fri Oct 13 22:37:40 2006 From: Allan Odgaard To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Sat, 14 Oct 2006 00:37:33 +0200 Message-ID: In-Reply-To: <4530091D.9030403@consking.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1445601663952333262==" --===============1445601663952333262== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On 13. Oct 2006, at 23:46, marios wrote: >> I'm trying to figure out, how it can be done, so it does bulk >> inserting >> as well, in spite the fact, that they have tab stop variables, but >> still >> no go. > Tried some strange constructs with expressions, or let n=(n+1) with > sed, but that doesn't seem to give any valid syntax [...] When you drop multiple files on TextMate, it will iteratively run the drag command (i.e. once for each dropped file). There is a few workarounds for this, like testing a modifier and going into “batch mode”, but nothing pretty. --===============1445601663952333262==-- From tmtxpstuff@consking.com Sun Oct 15 09:01:18 2006 From: marios To: textmate@lists.macromates.com Subject: Re: [TxMt] drag commands Date: Sat, 14 Oct 2006 23:53:07 +0300 Message-ID: <45314E33.5090001@consking.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8144816543788603331==" --===============8144816543788603331== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Allan Odgaard wrote: > On 13. Oct 2006, at 23:46, marios wrote: > >>> I'm trying to figure out, how it can be done, so it does bulk >>> inserting >>> as well, in spite the fact, that they have tab stop variables, but >>> still >>> no go. >> Tried some strange constructs with expressions, or let n=(n+1) with >> sed, but that doesn't seem to give any valid syntax [...] > > When you drop multiple files on TextMate, it will iteratively run > the drag command (i.e. once for each dropped file). > > There is a few workarounds for this, like testing a modifier and > going into “batch mode”, but nothing pretty. > > Thanks for the tip, I might give this a try, however it's not top priority. regards, marios -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) Comment: This might change in the future Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFMU4y8tSzPOYuZvQRAkoOAJ9UG0byXzYbcIiDceIsZPl9BNeAbACfZOJV vQ+ghb/98lfOjiGlDqFU1Mo= =Kcrp -----END PGP SIGNATURE----- --===============8144816543788603331==--