Page 1 of 1

Get ID or Index of current Memory Record

Posted: Mon Apr 15, 2024 11:39 am
by S1N74X
Hi there,

is there a way to figure out whats the ID or Index the current Memory Record?
I know i can use getAddressList().getMemoryRecordByDescription() and so on...
Afaik every Memory Record has a underlaying ID and Index.
Is there a way to get those more or less direct ?

Thanks for useful suggestions

Re: Get ID or Index of current Memory Record

Posted: Mon Apr 15, 2024 12:29 pm
by imjustmaxie
S1N74X wrote:
Mon Apr 15, 2024 11:39 am
Hi there,

is there a way to figure out whats the ID or Index the current Memory Record?
I know i can use getAddressList().getMemoryRecordByDescription() and so on...
Afaik every Memory Record has a underlaying ID and Index.
Is there a way to get those more or less direct ?

Thanks for useful suggestions
getAddressList().getMemoryRecordByDescription(‘description’).ID or .Index

[Link]

Re: Get ID or Index of current Memory Record

Posted: Mon Apr 15, 2024 1:20 pm
by S1N74X
[/quote]

getAddressList().getMemoryRecordByDescription(‘description’).ID or .Index

[/quote]

Thx for your reply but thats exatctly not the way i need to get the ID or the Index
The Memerc Name or Description can change. The ID is afaik uniqe

Re: Get ID or Index of current Memory Record

Posted: Mon Apr 15, 2024 1:53 pm
by imjustmaxie
S1N74X wrote:
Mon Apr 15, 2024 1:20 pm

Thx for your reply but thats exactly not the way I need to get the ID or the Index.
The memrec name or description can change. The ID is afaik unique
getAddressList().SelectedRecord.ID or getAddressList().SelectedRecord.Index

Re: Get ID or Index of current Memory Record

Posted: Mon Apr 15, 2024 2:00 pm
by S1N74X
imjustmaxie wrote:
Mon Apr 15, 2024 1:53 pm
S1N74X wrote:
Mon Apr 15, 2024 1:20 pm

Thx for your reply but thats exactly not the way I need to get the ID or the Index.
The memrec name or description can change. The ID is afaik unique
getAddressList().SelectedRecord.ID or getAddressList().SelectedRecord.Index
Does it. Thx

Re: Get ID or Index of current Memory Record

Posted: Mon Apr 15, 2024 2:10 pm
by S1N74X
S1N74X wrote:
Mon Apr 15, 2024 2:00 pm
imjustmaxie wrote:
Mon Apr 15, 2024 1:53 pm
S1N74X wrote:
Mon Apr 15, 2024 1:20 pm

Thx for your reply but thats exactly not the way I need to get the ID or the Index.
The memrec name or description can change. The ID is afaik unique
getAddressList().SelectedRecord.ID or getAddressList().SelectedRecord.Index
Does it. Thx
Aah sh.....
Selected == Activated
So the result doesnt match if you activate more than one script

Thx anyway

Re: Get ID or Index of current Memory Record

Posted: Mon Apr 15, 2024 2:14 pm
by imjustmaxie
S1N74X wrote:
Mon Apr 15, 2024 2:10 pm
S1N74X wrote:
Mon Apr 15, 2024 2:00 pm
imjustmaxie wrote:
Mon Apr 15, 2024 1:53 pm


getAddressList().SelectedRecord.ID or getAddressList().SelectedRecord.Index
Does it. Thx
Aah sh.....
Selected == Activated
So the result doesnt match if you activate more than one script

Thx anyway
Use a for loop on the AddressList and do compares if the AddressList[/i].Selected == true or AddressList[/i].Active == true or not, and do what you want to do afterwards.

Code: Select all

local al = getAddressList()
for i=0,al.Count-1 do
    if al[i].Selected == true then
        -- code here
    end
    -- or
    if al[i].Active == true then
        -- code here
    end
end

Re: Get ID or Index of current Memory Record

Posted: Tue Apr 16, 2024 6:22 am
by Paul44
^^ or: myMr = al.getMemoryRecordByID(ID)
(i never/rarely work with 'byDescr...' since i tend to a) rearrange/rename my entries in due time b) copy/pasting from another table keeps thàt ID (unless it already exists in current table)