PDA

View Full Version : Screen Resolution Variable in v7



timeaton
01-16-2002, 11:13 AM
Hi!

I'm trying out the eval version of DemoShield 7 to see if it will work for my company's CD projects. One of the things I'm trying to do is resize the screen using an external app. This works fine, but I want to change it back when the user exits the demo. From what I read in the KB article Q102890, this should be done by setting a variable based on the results of checking the resolution. However, this article only goes up to DemoShield 6.5, and the commands are a bit different in 7. How do I set this variable in version 7? I can't find "Set Variable" in the actions list.

Thanks,
Tim Eaton
Studio Theta

KimberlyH
01-16-2002, 02:09 PM
In DemoShield 7.0, the Set Variable action has been changed to the Perform Calculation action. The reason for this is, in DemoShield 7.0 you now have the ability to perform calculations on Variables and set that value to another Variable.

Therefore, for Knowledge Base article Q102890, simply replace the Set Variable action with the Perform Calculation action.

I hope this helps.

timeaton
01-16-2002, 02:27 PM
Thanks, that worked... mostly.

It doesn't seem to be saving the variable correctly. I have an object called "Resolution" that is initially set to "Unknown". I then have an event that asks if the system has 1280x1024 resolution (which I do), and if it does it assignes the constant "1280 1024" to the variable "Resolution".

However, when I call it from a second scene, all it returns is "Unknown". After some playing around, it seemed that my problem was in the if/then statement (I made all true actions automatically play and it changed the variable correctly). This is what I have:

If Resolution equals 1280x1024 then
{
Resolution = 1280 1024
}
else
{
}

Is this right? Do I have the numbers in the right order? I'm assuming it's just some small thing I overlooked by I cannot for the life of me find it...

Thanks,
Tim Eaton
Studio Theta

KimberlyH
01-16-2002, 03:22 PM
Yes, to check the resolution you will need to set up the Event Object to check the resolution condition. The value you enter in the condition is based off the resolution you are checking for. For example, if you are checking if the user is running at 1280x1024, then you would enter 1280x1024 as the value.

If the user is running at 1280x1024, then the True Actions will be triggered. If the user is not running at 1280x1024, then the False Actions will be triggered.

If you are simply looking to display the resolution the user is running at you can do this by just using a Quick Report Object in the scene where this information should be displayed and insert a Token into the Quick Report Object Styles tab. Just select the Scene you are currently working on. Next, select System Variables from the Type drop down menu and then Resolution from Pre-Defined Tokens drop down. DemoShield will retrieve the resolution from the system and enter it in place of the Token.

I hope this helps.

timeaton
01-16-2002, 03:48 PM
That's what I'm trying, I think. But apparently, asking for it to check for resolution 1280x1024 comes up negative. When I asked for the resolution from Quick Report Object, it said I was running 1280x1024... What gives?

For kicks, I switched my screen to 800x600, and asked for 0800x0600, and that also tested negative.

I can't just quick report, because I need to have the "x" removed from the resolution to use with the external program I have. Is there any way to do a search and replace on a string?

Tim Eaton

KimberlyH
01-16-2002, 06:02 PM
Please try the following steps to set up a Condition within an Event Object to check the resolution and based off the value of the Resolution write a value to a variable.

First, create a demo with two scenes.
In the first scene of the demo, create a Variable Object.
Open the properties to the Variable Object.
Change the name of the Variable Object to - Current Resolution
Enter the value - Unknown - in the Current Value and Initial Value edit fields.
Select String as the Type.
Click OK to close out of the Variable.

Next, create an Event Object in the scene.
Open the Properties to the Event Object and navigate to the Object Styles tab.
Under Conditions delete the Always perform true actions.
Click on the New button to activate the Condition Builder.
Select Resolution from the Condition Type drop down list.
From here you will select the resolution you would like to check for.
Click on the link for 0640x0480.
An Edit Field will appear.
Type in the resolution you would like to check for. For this example we will enter 1280x1024
Click Apply once you have entered in the value.
Click OK when this is done.
Next, go to the Actions tab.
Here we will assign the actions to be performed based on the value that is returned. If the value is true (meaning the resolution is set to 1280x1024), then the True Actions will be triggered. If the value is false, then the False Actions will be triggered.
Assign a Perform Calculation action under the True Actions with the following settings:

Scene Name: Scene you are currently on
Object Name: Current Resolution
Operator: Assign Value
1st Operand
Type: Constant
Constant: 1280 1024

Next, in the second scene create a Quick Report Object.
Open the Properties to the Quick Report Object and go to the Object Styles tab.
Click on the Insert Token button.
This will bring up the Insert Token dialog.
Select the following:

Scene: Scene that has the Variable Object
Type: Object
Objects: Current Resolution

Click Ok

What this will do is place a Token within the Quick Report Object. The Token will tell DemoShield to retrieve the information pertaining to the Token and replace the token with the relevant information.

Click OK to close out of the Quick Report.
Save your demo.

I have created a sample demo to display how this works. Please take a look and let me know if you have any questions.

All the best,

timeaton
01-16-2002, 07:41 PM
Thanks... I don't know what I did wrong before, but I scrapped the project and rebuilt it according to your directions and it worked beautifully. Thanks again!

Tim Eaton