Continuation Section too long Topic is solved

Ask for help, how to use AHK_H, etc.
Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Continuation Section too long

Post by Galaxis » 31 Dec 2020, 23:44

I have a multithread AHK_H script that works perfectly fine.
However, when I compile that script and run the exe, it says continuation section is too long.

Please advise.

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Continuation Section too long

Post by HotKeyIt » 01 Jan 2021, 06:21

Compile the script without compression, then use ResHacker to get the compiled script from your exe, then you can check why the continuation section is too long.
You can then split the section in 2 or more ones:

Code: Select all

var:="
(
...
)"
var.="
(
...
)"
...
You can also try using AHK_H v2 which has been improved and has no limit for line or continuation section.

Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: Continuation Section too long

Post by Galaxis » 01 Jan 2021, 13:11

Thanks!

Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: Continuation Section too long  Topic is solved

Post by Galaxis » 01 Jan 2021, 13:40

HotKeyIt wrote:
01 Jan 2021, 06:21
Compile the script without compression, then use ResHacker to get the compiled script from your exe, then you can check why the continuation section is too long.
You can then split the section in 2 or more ones:

Code: Select all

var:="
(
...
)"
var.="
(
...
)"
...
You can also try using AHK_H v2 which has been improved and has no limit for line or continuation section.
@HotKeyIt

The threads in my script contain the classMemory lib functions.

Code: Select all

 
 
 AhkThread("#NoTrayIcon `n#Include classMemory.ahk 
(

WinWait, Street Fighter V
_classmemory.setSeDebugPrivilege()



if (_ClassMemory.__Class != ""_ClassMemory"")
    msgbox class memory not correctly installed. Or the (global class) variable ""_ClassMemory"" has been overwritten

    
    Capcom:= 
	Capcom:= new _ClassMemory(""Street Fighter V"", """", hProcessCopy) 
    
    ; Check if the above method was successful.
    if !isObject(sfv) 
    {
        if (hProcessCopy = 0)
        msgbox The program isn't running (not found) or you passed an incorrect program identifier parameter. 
        else if (hProcessCopy = """")
        msgbox OpenProcess failed. If the target process has admin rights, then the script also needs to be ran as admin. Consult A_LastError for more information.
        
    }
    
    
    if !(SFV.isHandleValid())
    {
      msgbox, Program NOT LOADED! 
      ExitApp
	}    


Array:= SFV.hexStringtoPattern(""48 4F 54 42 41 52 2E 44 41 54 00 00 01 00 00 00 70"")
controller:= SFV.processPatternScan(,, Array*)


If controller=0
	{
		Msgbox Controller ARRAY NOT FOUND
		exitapp
	}


		Key0:=XIV.readstring(controller+Data) 
		Key1:=XIV.readstring(controller+(Data+add))
		Key2:=XIV.readstring(controller+(Data+(add*2)))
		Key3:=XIV.readstring(controller+(Data+(add*3)))
		Key4:=XIV.readstring(controller+(Data+(add*4)))
		Key5:=XIV.readstring(controller+(Data+(add*5)))
		Key6:=XIV.readstring(controller+(Data+(add*6)))
		Key7:=XIV.readstring(controller+(Data+(add*7)))
		Key8:=XIV.readstring(controller+(Data+(add*8)))
		Key9:=XIV.readstring(controller+(Data+(add*9)))
		Key10:=XIV.readstring(controller+(Data+(add*10)))
		Key11:=XIV.readstring(controller+(Data+(add*11)))
		Key12:=XIV.readstring(controller+(Data+(add*12)))

)")

That readmemory initialization is the lengthiest code. I don't think I can split initialization code into Vars:= / Vars.= as you suggested.
But if you can, I'd greatly appreciate knowing how. lol Thanks
Last edited by Galaxis on 01 Jan 2021, 13:52, edited 1 time in total.

Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: Continuation Section too long

Post by Galaxis » 01 Jan 2021, 13:50

@HotKeyIt But as stated before, all that above works fine, as long as the script isn't compiled. The Exe is the problem.

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Continuation Section too long

Post by HotKeyIt » 01 Jan 2021, 13:56

Try using CreateScript:

Code: Select all

#Persistent
thread:=AhkThread(CreateScript("ClassMemory:ClassMemoryEnd") " 
(

#NoTrayIcon
WinWait, Street Fighter V
_classmemory.setSeDebugPrivilege()



if (_ClassMemory.__Class != ""_ClassMemory"")
    msgbox class memory not correctly installed. Or the (global class) variable ""_ClassMemory"" has been overwritten

    
    Capcom:= 
	Capcom:= new _ClassMemory(""Street Fighter V"", """", hProcessCopy) 
    
    ; Check if the above method was successful.
    if !isObject(xiv) 
    {
        if (hProcessCopy = 0)
        msgbox The program isn't running (not found) or you passed an incorrect program identifier parameter. 
        else if (hProcessCopy = """")
        msgbox OpenProcess failed. If the target process has admin rights, then the script also needs to be ran as admin. Consult A_LastError for more information.
        
    }
    
    
    if !(SFV.isHandleValid())
    {
      msgbox, Program NOT LOADED! 
      ExitApp
	}    


Array:= SFV.hexStringtoPattern(""48 4F 54 42 41 52 2E 44 41 54 00 00 01 00 00 00 70"")
controller:= SFV.processPatternScan(,, Array*)


If controller=0
	{
		Msgbox Controller ARRAY NOT FOUND
		exitapp
	}


)")

ClassMemory:
Return
#Include classMemory.ahk
ClassMemoryEnd:
Return

Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: Continuation Section too long

Post by Galaxis » 01 Jan 2021, 16:47

@HotKeyIt

Code: Select all

ClassMemory:
Return
#Include classMemory.ahk
ClassMemoryEnd:
Return
Thanks.
CreateScript is interesting! But stuff outside the thread Isn't visable to anything inside the thread. So i can't use classMemory

Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: Continuation Section too long

Post by Galaxis » 01 Jan 2021, 17:14

@HotKeyIt
You helped me solve the problem though. Using compression on the Exe caused it to throw error "Continuation Section Too Long"

By you telling me to uncheck compression... the script/exe worked instantly. Compression was the problem. LOL

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Continuation Section too long

Post by HotKeyIt » 01 Jan 2021, 17:41

So it must be very hard on the limit, compressed lines are crypted and are longer than pure text.
CreateScript will copythe part between ClassMemory and ClassMemoryEnd and include it in script, so it will be inside the thread.

Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: Continuation Section too long

Post by Galaxis » 01 Jan 2021, 19:11

Hmm. Well, the readmemory functions in classmemory don't work when using using that CreateScript method.
So, I did this simple test here, and the outer variable not visible to the thread. With that result, I assumed is why #include classmemory wasn't detected, and no functions initialized as they should.

Code: Select all

#SingleInstance force
#Persistent

thread:=Ahkthread(CreateScript("ClassMemory:ClassMemoryEnd") "
(

	Loop
	{
		Msgbox % var
		
	}
	


)")




ClassMemory:
Var:="The sky is blue"
Return 

ClassMemoryEnd:
Return




F1::exitapp 
return 

@HotKeyIt
The variable outside isn't being seen. I guess I'm missing some context. If it can work, this is definitely a preferred way of retrieving data from the main thread.

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Continuation Section too long

Post by HotKeyIt » 01 Jan 2021, 21:30

Code: Select all

#SingleInstance force
#Persistent

thread:=Ahkthread(CreateScript("ClassMemory:ClassMemoryEnd") "
(
		Msgbox % var
)")
Sleep 3000
MsgBox
ExitApp



ClassMemory:
Var:="The sky is blue"
ClassMemoryEnd:
Return




F1::exitapp 
return 

Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: Continuation Section too long

Post by Galaxis » 01 Jan 2021, 22:20

@HotKeyIt
Thanks man. And stay awesome :)

Post Reply

Return to “Ask for Help”