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 

Noob ini and GUI menu togglecheck problem
Goto page Previous  1, 2
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Krogdor



Joined: 18 Apr 2008
Posts: 1145
Location: The Interwebs

PostPosted: Tue Jul 22, 2008 8:34 am    Post subject: Reply with quote

For the first problem, you need to tell the script what to do OnExit before the first return of the script, right now the OnExit command is not being reached. Also, you formatted it a bit wrong. Your code should look like this:
Code:

IniRead, Checkbox, MyScript.ini, MyItems, Checkbox

;-------------------------------------------------------------

Menu, MyMenu, Add, &MenuItem, ToggleState
Menu, MenuBar, Add, &FirstMenu, :MyMenu
Gui, Menu, MenuBar

Menu, MyMenu, % (CheckBox) ? "Check" : "Uncheck", &MenuItem
OnExit, CheckboxStatus
Return

;-------------------------------------------------------------

SetTimer, AutoRun, 1000
GoSub, MyFunction


;-------------------------------------------------------------

ToggleState:
menu, MyMenu, ToggleCheck, &MenuItem
GoSub, MyFunction
return

;-------------------------------------------------------------

MyFunction:

if(Checkbox)
  {   
    SetTimer, AutoRun, On
  }
  else
  {   
    SetTimer, AutoRun, Off
  }
Checkbox := !Checkbox
return

;-------------------------------------------------------------

GuiClose:

CheckboxStatus:
IniWrite, %Checkbox% , MyScript.ini, MyItems, Checkbox
ExitApp

;GuiClose:     ;works better to have only one label for closing
;ExitApp


;-------------------------------------------------------------

Also, note that the code in the olive brown color will never be executed, since there is a return above it. If you want it to be run when the script starts, put it at the top under the IniRead command.

For your second question, that seems strange. If you are using relative coordinates for the MouseMove, then if the Menu is active at the time that might cause problems... Although the mouse should still move, just maybe not to the right place.
Back to top
View user's profile Send private message AIM Address
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Tue Jul 22, 2008 9:26 am    Post subject: Reply with quote

Idea Fair enough, that explains a whole lot about the errors I make Laughing. Got a lot to think over, thanks for your help once again.
Back to top
View user's profile Send private message
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Thu Jul 24, 2008 3:27 am    Post subject: Reply with quote

I now have more menu's than a large restaurant Laughing . But I am still having this mouseover problem. My script has an 'includes' folder and the part with the mouseover is in an ahk there. Now the funny part is that I have an almost identical version that has the mouseover working. But since I put the menus in, whilst I can still see this function attempting to click the buttons (can see flashing), the mouse is not moving. The function won't work without mouseover, the buttons flash but don't click. So what are the possibilities of why a function can be working (because the buttons are flashing) but a mouseover doesn't happen, when this same function (and I copy and pasted it to make sure it is identical) works in an almost identical script Confused
Back to top
View user's profile Send private message
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Thu Jul 24, 2008 3:50 am    Post subject: Reply with quote

Krogdor wrote:
If you are using relative coordinates for the MouseMove, then if the Menu is active at the time that might cause problems... Although the mouse should still move, just maybe not to the right place.


The co-ordinates are just the straight up co-ordinates of a button that is in a window that doesn't change in character at all.
Back to top
View user's profile Send private message
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Thu Jul 24, 2008 4:15 am    Post subject: Reply with quote

I do have menu's in the working script, just without checkboxes in them. I know that sounds completely irrelevant but I really can't see any difference in these two scripts...
Back to top
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 1145
Location: The Interwebs

PostPosted: Thu Jul 24, 2008 4:22 am    Post subject: Reply with quote

That seems weird...
Are any of the settings different? SendMode, KeyDelay, etc?
Back to top
View user's profile Send private message AIM Address
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Thu Jul 24, 2008 4:44 am    Post subject: Reply with quote

I went through and cut pasted a whole heap of stuff and it's started working. I recently started to use the #includes method with another folder- perhaps in that process I misplaced the juncture of one of the extra ahk's but who knows Confused . On another matter,I have a bunch of pictures and icons in the gui, is it possible to put them into an includes folder without using a path or must they stay in the main folder? I send my script to other people so paths are not an option-have tried but with no success.
Back to top
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 1145
Location: The Interwebs

PostPosted: Thu Jul 24, 2008 5:11 am    Post subject: Reply with quote

Well you could do something like have the user specify a directory, and then include that directory as a variable before all of the files. Or set the working directory to a different location.
Back to top
View user's profile Send private message AIM Address
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Thu Jul 24, 2008 5:23 am    Post subject: Reply with quote

mmm, was trying to avoid that, some of the users need help turning their PC on Rolling Eyes . Not to worry, just a neatness thing, I was hoping to get the main folder down to the main ahk and the preferences file but I notice that ahk writers far more savvy than me have icons in their main folder so I thought it was a long shot. I pretty much have my script ready, it is far more user friendly now, thanks again Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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