Enter/return in clips

General discussions about LaunchBar
Post Reply
beelerspace

Enter/return in clips

Post by beelerspace » Thu Jan 31, 2008 6:39 am

Is there a way to execute an enter or return in a text clip?

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Thu Jan 31, 2008 3:41 pm

Hi beelerspace,
can you tell me what it is you want to do?

Do you mean the text clips that LaunchBar can read and insert for you? You sure can just type return when you create one.

interested in what you're up to,
Ludwig

beelerspace
Posts: 2
Joined: Mon Feb 04, 2008 3:25 am

Post by beelerspace » Mon Feb 04, 2008 3:27 am

Basically, I'd like to set up a clip so that it can do two things: tab between fields, and then "enter." Is that possible? I know that in Windows there are numbers associated with each keystroke that can be used in macros and such, but I don't know how this works in OSX with Launchbar.

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Mon Feb 04, 2008 11:34 pm

Ah, OK. That seems useful :-)

Clips can't do that (I think), but Applescript can.
beelerspace wrote: I know that in Windows there are numbers associated with each keystroke


That's not Windows, that's ASCII, so it works in Mac OS X, too. 8)

I tweaked a little Applescript to show you the possibilities. The original script was from iMeowbot from the macrumors forum here.


Code: Select all

set CR to ASCII character of 13 --return
set tab to ASCII character of 9 --tab

tell application "System Events"
   --tell application "TextEdit" to activate
   
   keystroke "meow," & CR & "meow," & CR & "woof!" & tab & "THAT WAS A TAB!" -- add some text
   
   --examples for controlling apps:
   --keystroke "n" using command down -- new file
   --keystroke "s" using command down -- save
   --keystroke "mymeowfile" & CR
   --keystroke "q" using command down -- quit
end tell


Every line beginning with a -- is only a comment, so your basic idea of entering tabs and returns should be pretty easy to implement. :D

Let me know whether this worked for you or if you need more help,
regards,
Ludwig

beelerspace
Posts: 2
Joined: Mon Feb 04, 2008 3:25 am

Post by beelerspace » Sat Feb 16, 2008 4:35 pm

I think that did it! Thank you so much!

Post Reply