AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

function cannot contain functions

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
exousia
Guest





PostPosted: Sat Oct 04, 2008 5:30 pm    Post subject: function cannot contain functions Reply with quote

I was editing my .ahk file which contains lots of stuff..
It worked without a flaw until I changed something that wasn't
in any connection with the following what so ever.

But all of a sudden it started complaining that EnableLeave()
function cannot contain functions..

I didn't change anything in the following code, or anything
that uses these functions.

Why did it start to give me errors all of a sudden?


Code:
DisableLeave()
   {
   WinGet, Manage, List, [ID=, , ,
   Control, Disable, , Button9, ahk_id %Manage1%
   Control, Disable, , Button9, ahk_id %Manage2%
   }

EnableLeave()
   {
   WinGet, Manage, List, [ID=, , ,
   Control, Enable, , Button9, ahk_id %Manage1%
   Control, Enable, , Button9, ahk_id %Manage2%
   }


[Title edited. Please write descriptive titles for your topics. ~jaco0646]
Back to top
exousia
Guest





PostPosted: Sat Oct 04, 2008 5:36 pm    Post subject: Reply with quote

Fixed Rolling Eyes
Back to top
Donny Bahama



Joined: 30 Dec 2006
Posts: 132
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA

PostPosted: Tue Apr 14, 2009 6:03 pm    Post subject: Reply with quote

I'm having the same problem and can't find any problems in my code. How did you fix this? What should I look for? I can't even debug this because it goes straight to that error message. Won't show MsgBoxes or ListVars or anything. Mad
Back to top
View user's profile Send private message
Donny Bahama



Joined: 30 Dec 2006
Posts: 132
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA

PostPosted: Tue Apr 14, 2009 6:42 pm    Post subject: Reply with quote

I commented out the ENTIRE function. Still get the exact same error.

Had the bright idea to undo a bunch of times then try again. Cool. Got back to where it was working (albeit without the new code). Now to redo, save, test, repeat until I find the problem line. BUT MY DAMN EDITOR WIPED MY REDO HISTORY!

So unhappy right now. I've been over and over and over my code. No idea how I'm going to find the problem now. Crying or Very sad
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Tue Apr 14, 2009 6:49 pm    Post subject: Reply with quote

The Function that gives the error is correct it is part of the script ABOVE the function that generates the error:
Code:
FunkyError()
   {
   MsgBox This generates an error at FuncA
   ;} ; because of missing } here

FuncA()
 {
   MsgBox A
 }
   
FuncB()
 {
   MsgBox B
 }   

_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
Donny Bahama



Joined: 30 Dec 2006
Posts: 132
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA

PostPosted: Tue Apr 14, 2009 7:07 pm    Post subject: Reply with quote

HugoV wrote:
The Function that gives the error is correct
I have a hard time with that since removing the entire function still generates the same error, but that point is moot.
Quote:
it is part of the script ABOVE the function that generates the error
Yeah, I cut a large section of my code (representing almost all of my recent code changes) and the problem went away. So I started pasting it back in, a chunk at a time. I found the (fairly small) block of code that's causing the problem...
Code:
If (add > 0)
} <------ OOPS!  :oops:
   GUI, 1:Destroy
   GUI, 2:Destroy
   GUI, 3:Destroy
   add = 0
   edit = 1
}
Thanks for the help, Hugo!
Back to top
View user's profile Send private message
Donny Bahama



Joined: 30 Dec 2006
Posts: 132
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA

PostPosted: Tue Apr 14, 2009 7:20 pm    Post subject: Reply with quote

I'd be willing to bet that a close curly bracket where there should have been an open curly bracket was what caused exousia's problem, too.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group