AutoHotkey Community

It is currently May 27th, 2012, 10:44 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Order of multiple GUI's
PostPosted: February 20th, 2008, 3:43 am 
Offline

Joined: October 1st, 2007, 4:09 pm
Posts: 17
I've read alot of the posts on using multiple GUI's and I'm still trying to understand the concept of using different GUI's out of order. I have a complex script which currently has 4 GUI's. I want to add a new one that will appear at the beginning of the script if a certain condition is met. I created the new GUI as #5 using code such as Gui, 5:Show.

My problem happens when the condition is met and I use Goto to get to GUI #5, get the input I need, then return to show GUI #1. GUI #1 displays OK, but none of the buttons work. Is this possible to accomplish or do I need to re-number all my GUI's?

Here's the beginning of the code (check for condition):
Code:
IfExist, %ProgramFiles%\Newforma\Fourth Edition\Project Center\ProjectCenter.exe
{
   IfExist, C:\Program Files\DriveMap\DriveMap.exe
   {
   IfExist, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini
   {
      IniRead, PrefSet, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini, Settings, MappingProgram
     If PrefSet = 1
        Mapper = Drivemap
      If PrefSet = 2
        Mapper = Newforma
   }
   else
   Goto, MappingPref
   }
   else
      Mapper = Newforma
}


Here's the GUI #5:
Code:
MappingPref:
Gui, 5:Add, Text, x36 y10 w220 h20 , Choose your drive mapping preference:
Gui, 5:Add, Radio, vMapPref Checked x76 y40 w120 h30 , DriveMap
Gui, 5:Add, Radio, x76 y70 w120 h30 , Newforma
Gui, 5:Add, Button, x86 y110 w100 h30 , OK
; Generated using SmartGUI Creator 4.0
IfExist, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini
{
   IniRead, PrefSet, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini, Settings, MappingProgram
   GuiControl,, MapPref, %PrefSet%
}
Gui, 5:Show, x131 y91 h159 w293, New GUI Window
pause

5GuiClose:
ExitApp

5ButtonOK:
Gui,5:submit,hide
IfNotExist, %ProgramFiles%\LaunchPad
   FileCreateDir, %ProgramFiles%\LaunchPad
IniWrite, %MapPref%, %ProgramFiles%\LaunchPad\LaunchPadPrefs.ini, Settings, MappingProgram
Gui,5:destroy
Gui, 1:Default
Goto, Step1


Goto, Step1 brings the script back to a point right where we were after the condition checking to launch GUI #1.

Any help is much appreciated!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2008, 7:14 pm 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
Goto is probably the wrong way of doing this and the pause is probably not helping things.

I cant see it unpause.

I think if you put a pause,off in the ok subroutine, that may resolve it. Otherwise the better way might be to restructure the code.

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2008, 8:47 pm 
Offline

Joined: March 19th, 2006, 5:52 am
Posts: 419
I agree with Superfraggle, the pause is probably causing problems. Since you used Goto to get to MappingPref, a return where the pause is should make the script wait for further input. Where as, if you used GoSub, a return would jump back to the line following the GoSub.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, specter333, Yahoo [Bot] and 57 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group