M
Martin M.
Hi everybody,
I am currently developing a small AppleScript, which will help our
staff to automate tasks in our spreadsheet app (RagTime 6). But now I
am at a point, where I need a function in my AppleScript to determine
the name of a column name in a table. Here is an example, just to give
you an idea:
Position: 5 -> Column name: "E"
Position: 28 -> Column name: "AB"
Now, I found a Perl module, which does exactly this: Converting number
positions into column names, but...I am not (yet) familiar with Perl.
So I would like you to tell me, what this code is doing, enabling me to
use it in my AppleScript:
[Code from: http://search.cpan.org/perldoc?Spreadsheet::ConvertAA ]
_______________________________
sub ToAA($)
{
my $c = shift ;
confess "Invalid base10 '$c'" if($c =~ /[^0-9]/) ;
return('@') if $c == 0 ;
my $cell = "";
while($c)
{
use integer;
substr ($cell, 0, 0) = chr (--$c % 26 + ord "A");
$c /= 26;
}
return($cell) ;
}
_______________________________
Thanks so much in advance!
Best regards,
Martin
http://www.schoolscout24.de/wordpress-files/welistento.html
I am currently developing a small AppleScript, which will help our
staff to automate tasks in our spreadsheet app (RagTime 6). But now I
am at a point, where I need a function in my AppleScript to determine
the name of a column name in a table. Here is an example, just to give
you an idea:
Position: 5 -> Column name: "E"
Position: 28 -> Column name: "AB"
Now, I found a Perl module, which does exactly this: Converting number
positions into column names, but...I am not (yet) familiar with Perl.
So I would like you to tell me, what this code is doing, enabling me to
use it in my AppleScript:
[Code from: http://search.cpan.org/perldoc?Spreadsheet::ConvertAA ]
_______________________________
sub ToAA($)
{
my $c = shift ;
confess "Invalid base10 '$c'" if($c =~ /[^0-9]/) ;
return('@') if $c == 0 ;
my $cell = "";
while($c)
{
use integer;
substr ($cell, 0, 0) = chr (--$c % 26 + ord "A");
$c /= 26;
}
return($cell) ;
}
_______________________________
Thanks so much in advance!
Best regards,
Martin
http://www.schoolscout24.de/wordpress-files/welistento.html