Start a new topic

How to insert an actual tab character in the Quick term editor?

I'm trying to create an AHK script to automatically take a glossary entry from one glossary, delete this entry, and copy it to another glossary (writing it straight to the txt file). However, to do this, I would need to be able to insert an actual tab character in the Quick term editor. However, I use the tab key to navigate around in it, and would like to keep this functionality.


Any ideas?


Note: I do not want to have to switch off the following: View > Segment Panes > Cycle focus with tab key


Hmm, maybe not. 


I put them in because I seem to remember that they were needed in the past. I thought they were needed as placeholders for empty fields. However, I just checked, and they don't seem to be needed. All the fields (columns) in a glossary are defined on the first line.


Igor, are you reading this? Can you confirm?

Are those trailing tabs really necessary ? If so: why?

Indeed, I need to separate the various fields with tab characters, not put tabs inside of the fields.


I initially wanted to do the editing of the glossary entry in the QTE itself. But since I couldn't figure out a way to insert tab characters, I decided to edit the clipboard content directly, using the AHK thingee ‘StringReplace’, and just append that.


That is, somehow, you need to take the current glossary entry (which you are most likely ‘looking at’ in the QTE, after clicking on a relevant entry in a glossary pane) (e.g.: ‘kat = cat’), and convert it to the format that can then be appended to the end of the glossary file. It needs to end up like: ‘kat [TAB] cat [TAB] [TAB] [TAB] [TAB] [TAB] [TAB] [TAB] [TAB]’.


So you want to insert a tab character in one of the many fields that you have configured for the QE? Why's that? Won't that corrupt your glossary file? Field Sense should only contain one item. Not two or three, separated by tabs.

OK, I'll try again: 

If you want to have View > Segment Panes > Cycle focus with tab key switched ON (which I do), you cannot insert tab characters in the Quick term editor. Pressing the tab key when in the Quick term editor will cycle between fields, rather than insert a tab character.


My question was therefore: how can I insert a tab character in the Quick term editor, but without having to switch OFF View > Segment Panes > Cycle focus with tab key.


Geddit?

Neither did I understand your question. So I was trying to clarify what you mean. You can write in Dutch, if that's easier for you.

Thanks for the help Hans, although I don't really understand it.

Insert a tab char or emulate a tab press to switch between fields?

Wow, problem solved. I did it another way. Please marvel at my fugly AHK script:


(1) copies the glossary entry you are currently in (opened in the Quick term editor by clicking on an entry in the glossary pane)

(2) pastes it at the end of a second glossary

(3) deletes the original entry


-----------------------------------------------------------------------------

; AHK script to copy glossary entry in CafeTran from one glossary into another, and delete original entry

^+l::    ; ctrl+shift+l (I also have a voice command assigned to this via Dragon/Vocola: "copy to AA")

send, ^a ; ctrl+a selects src entry

sleep , 5 ;

send, ^c ; copy src entry

sleep , 5 ;

send, `t ; tab down

sleep , 5 ;

send, ^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left}^{left} ; moves all the way to the left

send, ^v ; paste src in front of target

sleep , 5 ;

send, | ; paste | between the two

sleep , 5 ;

send, ^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right}^{right} ; moves all the way to the right

sleep , 5 ;

send, |||||||| ; inserts 8 pipes; will later be converted into tabs to make up the empty other fields in my glossary

send, ^a^c ; copy src+trgt

sleep , 5 ;

;;;;;;;;;;;;;;;;;;;;;;;;

ClipSaved := ClipboardAll ; Store original clipboard in a variable for future use

Clipboard := ; Clear the clipboard.

send, ^c

sleep , 5 ;

;;;;;;;;;;;;;;;;;;;;

FixString = %clipboard%

StringReplace, FixString, FixString, |, `t, All ; all pipes in the text in the clipboard are converted to tab characters 

Clipboard := FixString ; load the new string to clipboard

;;;;;;;;;;;;;;;;;;;;

If (Clipboard != "") ; If Clipboard not equal to "" (Nothing)

FileAppend, %clipboard%`n, D:\Data\Programs\CafeTran\cafetran\resources\glossaries\_CT glossaries\AA.csv ; the second glossary

Clipboard := ClipSaved ; Restore the original clipboard.

send, `t`t`t`t`t`t`t`t`t`t ; tab to the Delete button

sleep , 5 ;

send, {enter} ; Press Delete to remove the original glossary entry

-----------------------------------------------------------------------------


Yes, it is hideous, but it seems to work.


Michael

Login to post a comment