cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Newbie key mapping help

bfriesen
18-Opal

Newbie key mapping help

Trying to map F12 to add the index marker to text, but do not know enough to see what I am doing wrong.


Here is what I got so far. Can someone shed some light for me.



function table auto_index()


{


$table_rows=tbl_row_count()



$column_to_process=tbl_caret_col()



while(tbl_caret_row() <= $table_rows && tbl_caret_row() > 0) {


oid_select(oid_caret(0))


copy_mark mymark


insert_tag(indexterm)


paste mymark


# insert("-")


if (goto_cell(tbl_caret_row()+1, $column_to_process) != 1)


{


break


}


}



map F12 auto_index();



Thanks



Bryon

3 REPLIES 3

Hi Bryon--



Your code seems to have gotten munged by the email software, so it's a
little hard to see what you've got there. However, one thing to check is
whether you are defining your function inside a named package. If there
is a "package" statement in the ACL file where you are defining this
function, then you will need to include the package modifier in your map
command. For example, if this is in a package called "table", then you
need to use something like this:



map F12 table::auto_index()



Hope that helps.



--Clay



Clay Helberg

Senior Consultant



TerraXML

1380 Forest Park Circle, Suite 100

Lafayette, CO 80027

Bryon,



Like Clay said, your code came across pretty mangled. I copied and tried to
see what I could do with it.

This is what I came up with.

function table
auto_index()
{$table_rows=tbl_row_count() #this counts the rows
$column_to_process=tbl_caret_col() #this one tells it to process where the
cusor location is
while(tbl_caret_row() <= $table_rows && tbl_caret_row() > 0)
{oid_select(oid_caret(0))copy_mark mymark
insert_tag(indexterm)
paste mymark#
insert("-")
if (goto_cell(tbl_caret_row()+1, $column_to_process) != 1)
{break}}
map F12 auto_index();



When I did a 'brace' comparison with Codewright, there is an unmatched set
of braces. Fix that and see what happens.



Lynn


Thansk for the help, I noticed after I posted it was all crazy. I have edited the original post to show what I have in my text file. The purpose of this acl is to place your cursor in the top cell of a column,press f12, it will add an indexterm element with the contents of the cell populating it. The original version that I have works, but needs to be local on everyone computer. I have switched to a .zip sma, so I can manage everything off of a network drive instead.



If I have this acl code save locally, it can be invoked by source auto_index.acl. Iooked at other acl scripts that I have had help with and tried to map



$table_rows=tbl_row_count()



$column_to_process=tbl_caret_col()



while(tbl_caret_row() <= $table_rows && tbl_caret_row() > 0) {



oid_select(oid_caret(0))



copy_mark mymark



insert_tag(indexterm)



paste mymark



# insert("-")



if (goto_cell(tbl_caret_row()+1, $column_to_process) != 1)



{



break



}



}



Thanks for the suggestion Clay do I need to add that at the begining or at the end? I am reading the acl reference but... not sure what I am reading.



function table::auto_index() {


$table_rows=tbl_row_count()


$column_to_process=tbl_caret_col()
while(tbl_caret_row() <= $table_rows && tbl_caret_row() > 0) {


copy_mark mymark


paste mymark


")


{


}


}



Announcements

Top Tags