PDA

View Full Version : Need Help with code


Pampas
03-12-2004, 07:17 AM
Hi everyone,

I'm developing a CD with a presentation in AutoPlay. As there are 3 different types of screens in the market, I developed 2 different presentations for 800x600 and 1024x768. These two are full screened. Less than 800x600 it will ask the user to change the screen def, any thing bigger will use a kiosk window.

The problem is that I have to create a Master Project that gets the System.GetDisplayInfo() and then should start (or not if it's less than 800x600) one of the presentations.

The part of the code that should do this is placed in the ontime action (Just to give some time for the user to read a message saying that we're finding out what is the screen def) and is as follows (disregard the Portuguese language :) )

Page.StartTimer(500);
-- Get the user's display information.
display = System.GetDisplayInfo();

if (display ~= nil) then
-- If the user's running less than 800 x 600, display a dialog.
if (display.Height < 600) then
Dialog.Message("Informação", " Lamentamos, mas a sua resolução está definida para "..display.Width.." x "..display.Height..".\r\n"..
"tem de ajustar a definição a um minimo de 800 por 600 para poder visualizar esta aplicação.", MB_OK, MB_ICONINFORMATION);
elseif (display.Height < 1100) then
File.Open("C:\Documents and Settings\User\Os meus documentos\AutoPlay Media Studio 5.0 Projects\BpEurope800x600\CD_Root\autoplay", "", SW_SHOWNORMAL);
else File.Open("C:\Documents and Settings\User\Os meus documentos\AutoPlay Media Studio 5.0 Projects\BpEurope1024x768\CD_Root\autoplay", "", SW_SHOWNORMAL);

end
end

Page.StopTimer();
Application.Exit();

The problem is that this does not open the AM5 autostart file as I wanted it to.

What am I doing wrong?

I get no error message. Just does nothing at all. (except display = System.GetDisplayInfo(); this one it does).

I can't think anymore.

Can anyone give me a hand please?

Thanks

Pampas

Worm
03-12-2004, 07:49 AM
In your file paths, you need to double up on the backslashes


File.Open("C:\\Documents and Settings\\User\\Os meus documentos\\AutoPlay Media Studio 5.0 Projects\\BpEurope800x600\\CD_Root\\autoplay", "", SW_SHOWNORMAL);
else File.Open("C:\\Documents and Settings\\User\\Os meus documentos\\AutoPlay Media Studio 5.0 Projects\\BpEurope1024x768\\CD_Root\\autoplay", "", SW_SHOWNORMAL);

Pampas
03-12-2004, 11:34 AM
Tks Worm but it didnt't work. I mean, nothing still happens. Having 1 or 2 backslashes dosen't seem to have any diference. Basically I seem to be getting now where after I get display = System.GetDisplayInfo();.

Display gets the correct info from system, but then dosent open the AM5 autorun.

Do you know if I should use a file.open or a file.run?

Tks

Pampas

Worm
03-12-2004, 11:38 AM
I would use File.Run and you need to double the backslashes in a Path . Be sure to use the whole file name too, i.e. autorun.exe

"C:\test\folder\here"
would be
"C:\\test\\folder\\here"

Other than that, make sure your paths are correct. You probably will eventually want to use the _SourceFolder variable instead of a static path.

Pampas
03-13-2004, 11:48 AM
Thanks Worm. Will try that.

Pampas