Page 1 of 1

Get Auto Assemble Edit Form

Posted: Tue Oct 18, 2022 5:23 pm
by S1N74X
Hello,

i am currently tinkering around with CE Lua Forms and trying to get the "Auto Assemble Edit" From.
What i am trying to archive is to generate Template Function calls.
I know there are "copy paste" solutions for custom templates but they are op and i dont need all the functionality.

Following the Wiki i found this.
Spoiler

Code: Select all

{$lua}
if syntaxcheck then return end
[ENABLE]
for i = 0, getFormCount() - 1 do
  local frm = getForm(i)
  if frm.ClassName == 'TfrmAutoInject' then
  frm.show()
  end
end
[DISABLE]
The Problem is that this Method gives me the "Lua Script Edit" Form.

So any helpfull suggestions are welcome.
Thanks in advance.

Re: Get Auto Assemble Edit Form

Posted: Wed Oct 19, 2022 5:44 pm
by S1N74X
Ok i found out it myself.

getFormCount() only sees "active" forms. The "Auto Assemble edit:" Form is dynamic and not permanently open :)
Thread can be closed

Re: Get Auto Assemble Edit Form

Posted: Fri Oct 21, 2022 6:22 pm
by LeFiXER
S1N74X wrote:
Wed Oct 19, 2022 5:44 pm
...
This will, however, create a new Auto Assembler window with the pre-defined text as the main body of the script:

Code: Select all

local aa = getMemoryViewForm().getComponent(279)
aa.doClick()

AAWindow = 'TfrmAutoInject'

function getFormByClass(n)
 if n == '' then return nil end
 for i = 0, getFormCount() - 1 do
  local frm = getForm(i)
  if frm.ClassName == n then
    return frm
  end
 end
end

local f = getFormByClass(AAWindow)
local script = f.getComponent(60)
script.Lines.Text = [[
{
  Game    : My Random Game
  Author  : LeFiXER
  Date    : 21/10/22

  More Stuff
}
[ENABLE]

// blah blah blah

[DISABLE]
]]

Re: Get Auto Assemble Edit Form

Posted: Mon Oct 24, 2022 4:18 pm
by S1N74X
LeFiXER wrote:
Fri Oct 21, 2022 6:22 pm

First of all thanks for your reply.
Got some questions :D
Where did index 279 and 60 come from ? CESource on GitHub ?
aa.doClick() should open a Form i guess but it gives me a access violation. It opens an "Service Descriptor Table" with no functionality

Is this intended ?
Am i missing something ?

Spoiler

Code: Select all

local aa = getMemoryViewForm().getComponent(279) <<<<<< where did you get the Index from ?  
aa.doClick() <<<<<<< gives me an access violation  

AAWindow = 'TfrmAutoInject'

function getFormByClass(n)
 if n == '' then return nil end
 for i = 0, getFormCount() - 1 do
  local frm = getForm(i)
  if frm.ClassName == n then
    return frm
  end
 end
end

local f = getFormByClass(AAWindow)
local script = f.getComponent(60)  <<<<<<<< here and below wont run


Re: Get Auto Assemble Edit Form

Posted: Mon Oct 24, 2022 8:01 pm
by Eric
Lefixer seems to be on CE 7.4.1 which is the only version where AutoInject1 is at that position
It's better to get the name of the control, e.g:

Code: Select all

aa=getMemoryViewForm().AutoInject1
aa.doClick()

Re: Get Auto Assemble Edit Form

Posted: Mon Oct 24, 2022 9:45 pm
by LeFiXER
Eric wrote:
Mon Oct 24, 2022 8:01 pm
Lefixer seems to be on CE 7.4.1 which is the only version where AutoInject1 is at that position
It's better to get the name of the control, e.g:

Code: Select all

aa=getMemoryViewForm().AutoInject1
aa.doClick()
That's correct. I am, at least for now. Thanks for the tip!

Re: Get Auto Assemble Edit Form

Posted: Tue Oct 25, 2022 2:42 pm
by S1N74X
Eric wrote:
Mon Oct 24, 2022 8:01 pm
Lefixer seems to be on CE 7.4.1 which is the only version where AutoInject1 is at that position
It's better to get the name of the control, e.g:

Code: Select all

aa=getMemoryViewForm().AutoInject1
aa.doClick()
Thank you.
Is there an Overview or a function to get the Names of the available Forms and o Controls ?

Re: Get Auto Assemble Edit Form

Posted: Wed Oct 26, 2022 2:17 pm
by Eric
there's the CE sourcecode. You can ready through the .lfm and get the name property of the control you need

Re: Get Auto Assemble Edit Form

Posted: Wed Oct 26, 2022 4:44 pm
by S1N74X
Eric wrote:
Wed Oct 26, 2022 2:17 pm
there's the CE sourcecode. You can ready through the .lfm and get the name property of the control you need
Thx for the answer