Announcement

Collapse
No announcement yet.

Repeat - Newbie help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Repeat - Newbie help

    Could someone help please. My original post is as follows:

    This is all a bit new to me, but i'm sure that this question will be easy to answer. I have created a message box that asks if over 18 or not, the user has to select Yes or No. If yes is selected then APM starts at the first page, If the user selects No, another message box appears telling the user that the programme will terminate, they then click OK for this to happen.
    My problem is that I have several pages, each time I go back to the initial page they have to repeat the process of selecting Yes / No / Ok etc.
    Could someone please advise of an easy way to stop this happening ?

    Corey replied:
    Set a variable, i.e. %ageCode% = yes.

    Could someone explain in a little more detail?
    Where do I put that variable in relation to my message boxes

    Many thanks in advance


  • #2
    Re: Repeat - Newbie help

    Hi

    You can set that variable in your projects 'OnInitialize'

    The idea is:

    1. set the variable %ageCode% to something other than YES ... ie: NO
    2. in your page.show actions, tell it to check the variable and if the content = NO ask if the user is 18 etc.
    - if content = YES do not ask the question
    3. also set "If the user clicks YES when asked if 18 etc ... set the variable to YES" ... so it will be set for the next visit to the page, and of course it will not ask again coz it will check to see if the content of %ageCode% = YES

    Hope this helps

    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

    Comment


    • #3
      Re: Repeat - Newbie help

      Derek
      Thanks for your help it is appreciated, but how do I do step 2

      Many Thanks

      Comment


      • #4
        Re: Repeat - Newbie help

        copy and paste this code onto all of your pages (other than the first page) below, then do what Derek says:

        Set in your project's On Initialize:
        %agecode%=no

        ---------------------------------
        <IR_ACTIONS_LIST>
        <Action name="IF">
        <Type>200</Type>
        <Function>1</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Condition>%agecode%="yes"</Condition>
        </Action>
        <Action name="GOTO">
        <Type>209</Type>
        <Function>1</Function>
        <DTIndentLevel>1</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Label>EXIT</Label>
        </Action>
        <Action name="END IF">
        <Type>201</Type>
        <Function>1</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        </Action>
        <Action name="Message Box">
        <Type>5</Type>
        <Function>0</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <DialogTitle>Age Verification</DialogTitle>
        <DialogMessage>Are you 18 years or older?</DialogMessage>
        <Icon>3</Icon>
        <Variable>%agequestion%</Variable>
        <DialogType>1</DialogType>
        <DefaultButton>1</DefaultButton>
        </Action>
        <Action name="IF">
        <Type>200</Type>
        <Function>1</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Condition>%agequestion%="yes"</Condition>
        </Action>
        <Action name="GOTO">
        <Type>209</Type>
        <Function>1</Function>
        <DTIndentLevel>1</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Label>EXIT</Label>
        </Action>
        <Action name="END IF">
        <Type>201</Type>
        <Function>1</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        </Action>
        <Action name="Jump">
        <Type>1</Type>
        <Function>0</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <PageName>%PageFirst%</PageName>
        </Action>
        <Action name="GOTO">
        <Type>209</Type>
        <Function>1</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Label>SKIP VARIABLE</Label>
        </Action>
        <Action name="Blank Line">
        <Type>203</Type>
        <Function>2</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        </Action>
        <Action name="LABEL">
        <Type>208</Type>
        <Function>1</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Label>EXIT</Label>
        </Action>
        <Action name="Set Value">
        <Type>6</Type>
        <Function>0</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Variable>%agecode%</Variable>
        <Value>yes</Value>
        <Evaluate>0</Evaluate>
        </Action>
        <Action name="Blank Line">
        <Type>203</Type>
        <Function>2</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        </Action>
        <Action name="LABEL">
        <Type>208</Type>
        <Function>1</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Label>SKIP VARIABLE</Label>
        </Action>
        </IR_ACTIONS_LIST>
        ---------------------------
        Eric Darling
        eThree Media
        http://www.ethreemedia.com

        Comment


        • #5
          Re: Repeat - Newbie help

          Thanks Eric.
          I used the code below in my first page only and it seems to work fine. I did also enter %agecode%=no in project's On Initialize:
          Can you see an error in this code, your feedback would be much appreciated.

          Many Thanks

          <IR_ACTIONS_LIST>
          <Action name="IF">
          <Type>200</Type>
          <Function>1</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Condition>%agecode%=NO</Condition>
          </Action>
          <Action name="Message Box">
          <Type>5</Type>
          <Function>0</Function>
          <DTIndentLevel>1</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <DialogTitle>Age Verification</DialogTitle>
          <DialogMessage>This CD contains material of adult nature.
          If you are 18+ then you may click the Yes button below, otherwise you MUST click the No button</DialogMessage>
          <Icon>3</Icon>
          <Variable>%Result%</Variable>
          <DialogType>1</DialogType>
          <DefaultButton>0</DefaultButton>
          </Action>
          <Action name="IF">
          <Type>200</Type>
          <Function>1</Function>
          <DTIndentLevel>1</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Condition>%Result% = NO</Condition>
          </Action>
          <Action name="Message Box">
          <Type>5</Type>
          <Function>0</Function>
          <DTIndentLevel>2</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <DialogTitle>Age verification failed</DialogTitle>
          <DialogMessage>Sorry this programme MUST close. You have indicated that you are under the age of 18</DialogMessage>
          <Icon>4</Icon>
          <Variable>%Result%</Variable>
          <DialogType>0</DialogType>
          <DefaultButton>0</DefaultButton>
          </Action>
          <Action name="Close">
          <Type>130</Type>
          <Function>0</Function>
          <DTIndentLevel>2</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage>This Programme can not continue as you have indicated that you are under the age of 18</CustomErrorMessage>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <hWnd>%MenuHWnd%</hWnd>
          <IfRunning>1</IfRunning>
          <ProgramDescription>AutoPlay Media Studio 4.0</ProgramDescription>
          </Action>
          <Action name="ELSE">
          <Type>206</Type>
          <Function>1</Function>
          <DTIndentLevel>1</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          </Action>
          <Action name="IF">
          <Type>200</Type>
          <Function>1</Function>
          <DTIndentLevel>2</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Condition>%Result%=YES</Condition>
          </Action>
          <Action name="Set Value">
          <Type>6</Type>
          <Function>0</Function>
          <DTIndentLevel>3</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Variable>%agecode%</Variable>
          <Value>YES</Value>
          <Evaluate>0</Evaluate>
          </Action>
          <Action name="END IF">
          <Type>201</Type>
          <Function>1</Function>
          <DTIndentLevel>2</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          </Action>
          <Action name="END IF">
          <Type>201</Type>
          <Function>1</Function>
          <DTIndentLevel>1</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          </Action>
          <Action name="END IF">
          <Type>201</Type>
          <Function>1</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          </Action>
          </IR_ACTIONS_LIST>

          Comment


          • #6
            Re: Repeat - Newbie help

            If statements can't be nested like this. You have to End If each If before you start the next If statement.

            Also, you will never have the %agecode% variable set to yes this way. Look at my original code, and you'll see what I mean. Your code only sets %agecode% to yes if it is already set to yes. That won't work.
            Eric Darling
            eThree Media
            http://www.ethreemedia.com

            Comment


            • #7
              Re: Repeat - Newbie help

              Cheers Eric I will use your code, but why do I have to enter it on all pages when my message is only on the first page. I take it these If statements etc are not the same as java, if they can't be nested.
              Why did my code work, is there a way that I can make it fail as it is.

              Once again Many Thanks for your help.

              Comment


              • #8
                Re: Repeat - Newbie help

                Well, I couldn't tell you how nested IF statements are working. I'm just sort of citing the rule book as it were. There are other folks around here who have a much deeper knowledge, and can probably answer the question as to why it worked. No - AMS is nothing like Java.

                I see now how the %agecode% variable is getting set. I got crossed up because my code introduces a second variable called %agequestion%. It's been a long week already - sorry about that.

                True, you only need to put that code on the page(s) where you want the user to confirm they are of legal age.
                Eric Darling
                eThree Media
                http://www.ethreemedia.com

                Comment


                • #9
                  Re: Repeat - Newbie help

                  Thanks for all your help and quick replys.
                  As I have only been using AMS for a couple of days I will take your advise and use your code. Maybe someone will read these posts who can answer how my If statements worked. It is frustraring when you're trying to learn and can't figure out where you've gone wrong, especially when you think its working ok. I will just keep reading untill I've sussed it.
                  Sorry for all the questions.

                  Comment


                  • #10
                    Re: Repeat - Newbie help

                    Not at all. I don't mind replying, I just mind being completely wrong about advice I'm trying to offer. So... Don't take my code for granted - if yours is working and you've tested through every conceivable angle, why jump ship? I say if it ain't broke....
                    Eric Darling
                    eThree Media
                    http://www.ethreemedia.com

                    Comment

                    Working...
                    X