Comunidad Game Maker

Ayuda => Preguntas y respuestas => Mensaje iniciado por: Fenris78 en Octubre 14, 2010, 02:53:29 PM

Título: Abrir URL navegador
Publicado por: Fenris78 en Octubre 14, 2010, 02:53:29 PM
Saludos.

Estoy liado con la demo de mi juego y quiero que al terminar, me de la opcion de visitar una pagina web con el navegador predeterminado por el sistema.

Creo recordar que lo he hecho alguna vez, pero con explorer.

?Podria alguien comentarme como hacerlo?

Título: Re: Abrir URL navegador
Publicado por: Miguel en Octubre 14, 2010, 04:29:24 PM
Si no recuerda mal, para eso habia que usar una libreria.
La vi en la comunidad hace a?os, asi que debe seguir por ahi.
Título: Re: Abrir URL navegador
Publicado por: Johann en Octubre 14, 2010, 04:32:57 PM
Pues el  :GM8: tiene esta accion de D&D
CitarSplash Webpage
With this action you can show a webpage. You provide the url and whether it should be shown in the game window or in the default web browser. The url can be the address of a website, for example http://www.yoyogames.com) or can be the file name for a local html file. Note however that you must provide the full path for this to work (which is not the case for the other splash actions). So you best use as url something like "" + working_directory + "\index.html". (The first two quotes are required to indicate this is an expression rather than a string.) You should either distribute the file with the game or include it in the game through Include Files in the Resources menu. You can e.g. use this to create fancy help pages for your game. This action is only available in the Pro Edition.

o la funcion en GML
Citarsplash_show_web(url,delay) Shows a web page splash screen. url is the url of the webpage (starting with http://) or it is the file name for a local html file. Note however that you must provide the full path for this to work. So you best e.g. use as url something like working_directory + "\index.html". delay is the delay in milli seconds before returning to the game.

Título: Re: Abrir URL navegador
Publicado por: Fenris78 en Octubre 14, 2010, 05:14:35 PM
Jarl! no tenia ni idea de que habia una funcion para eso en GM8, yo lo hacia antes con "execute Shell" si no recuerdo mal, pero quiero que se utilice el navegador por defecto, no IE.

EDITADO:

Lo he estado probando, pero no funciona como necesito (no reproduce correctamente el DHTML). ?Alguna otra idea?
Título: Re: Abrir URL navegador
Publicado por: Fenris78 en Octubre 14, 2010, 07:30:53 PM
Actualizo el tema.

He probado sacando la direccion del navegador por defecto leyendo el registro:

[gml]var browser;
registry_set_root(1);

browser = registry_read_string_ext("\SOFTWARE\Classes\HTTP\shell\open\command","");
execute_shell(browser,"http://www.oniric-factor.com/oniric.html");
game_end();[/gml]

Funciona correctamente en Windows XP, pero cuando lo ejecuto en un Windows 7 me da el siguiente error:

Cannot execute "C:\Program Files\Internet Explorer\iexplore.exe"
-nohome


?A que se creeis que debe y que se os ocurre que se podria hacer?

He estado verificando la ruta real y es C:\Archivos de programa\Internet Explorer\iexplore.exe ?acaso no es fiable esta ruta de registro en Windows 7?
Título: Re: Abrir URL navegador
Publicado por: brunoxzx en Octubre 14, 2010, 09:42:34 PM
yo para ejecutar una pagina con el navegador predeterminado simplemente lo hago as?
[gml]execute_shell("http://www.oniric-factor.com/oniric.html","");[/gml]
y me funciona a la perfeccion
Título: Re: Abrir URL navegador
Publicado por: Fenris78 en Octubre 15, 2010, 01:18:03 AM
?Asi, sin especificar la aplicacion ni nada?

No se me habia pasado por la cabeza. ?Voy a probarlo!
Título: Re: Abrir URL navegador
Publicado por: Hackware en Octubre 15, 2010, 01:57:06 AM
Dos palabras: equis-de. XD
Título: Re: Abrir URL navegador
Publicado por: Fenris78 en Octubre 15, 2010, 02:06:40 AM
Oye, pues si que funciona. XD

En mi caso me aparece un error tipo "GM no puede ejecutar la aplicacion" y justo despues me lanza el navegador. Dado que el juego esta terminado, he deshabilitado la opcion de mostrar errores y listo. Lo que me tiene intrigado es porque aparecia el error si despues ejecuta la aplicacion. ?Seria porque la siguiente funcion en ejecutarse es un game_end()? le voy a dar un ultimo repaso para revisarlo, pero lo que es la duda esta mas que resuelta.

Gracias por el cable. ?Nos leemos!
Título: Re: Abrir URL navegador
Publicado por: Hackware en Octubre 15, 2010, 02:23:27 AM
?Cabe la posibilidad de que se trate de un conflcto con el Firewall? Intenta darle permiso total al programa o deshabilita el cortafuegos moment?neamente y vuelve a hacer la prueba.
Título: Re: Abrir URL navegador
Publicado por: brunoxzx en Octubre 15, 2010, 02:50:32 AM
Pues yo uso windows xp y mi firewall no me dice nada aunque le ponga que no permita excepciones, obvio el firewall no es el mismo que el de windows 7.

Que bueno que te sirvi?  :-[
?nos leemos!  :-X!
Título: Re: Abrir URL navegador
Publicado por: Wadk en Octubre 15, 2010, 03:17:29 AM
Hmm...
?Qu? tal esto?
[gml]f=file_text_open_write(temp_directory+"/t.url");
file_text_write_string(f,"[InternetShortcut]");
file_text_writeln(f);
file_text_write_string(f,"URL=http://www.comunidadgm.org/");
file_text_writeln(f);
file_text_close(f);
execute_shell(temp_directory+"/t.url","");
file_delete(temp_directory+"/t.url");[/gml]
Tal vez as? te deshazcas del error... (?deshazcas? ?se escribe as?? XD)
Título: Re: Abrir URL navegador
Publicado por: Hackware en Octubre 15, 2010, 08:18:28 AM
Se dice "deshagas", es algo elemental mi querido Wadkson. XD