Jump to content

Python Open Link


Recommended Posts

Userinterface/PythonApplicationModule.cpp

// Add
#include <Shellapi.h>
  
// Search
PyObject* appExit(PyObject* poSelf, PyObject* poArgs)
{
    CPythonApplication::Instance().Exit();
    return Py_BuildNone();
}
  
// Add
PyObject * appOpenWebBrowser(PyObject * poSelf, PyObject * poArgs)
{
    char * szURL;

    if (!PyTuple_GetString(poArgs, 0, &szURL))
        return Py_BuildException();

    char * getChormeURL;
    _snprintf(getChormeURL, sizeof(getChormeURL), "%s  --non-incognito", szURL);

    ShellExecuteA(0, 0, "chrome.exe", getChormeURL, 0, SW_SHOWMAXIMIZED);

    return Py_BuildNone();
}
  
// Search
{ "Exit",                        appExit,                        METH_VARARGS },

// Add
{ "OpenURL",                    appOpenWebBrowser,                METH_VARARGS },
  
For Ex:
app.OpenURL('www.norsmt2.com')

 

  • Metin2 Dev 1
  • Love 2
Link to comment
Share on other sites

7 hours ago, Helia01 said:

Nice, but what should I do if I don't have chrome?

You can edit, this is just for example.

3 hours ago, filipw1 said:

		import os
		os.system("start "" https://www.google.com/")

That would make a deal without  any C++ code

Of course, it makes sense to use python, but some users are having problems. (Client crash etc..)

52 minutes ago, Mali61 said:

And you have a developer tag.? I love this site

Tag dont matter, you can live happier only if you focus on your own life. Unless you try to make bad comments.

46 minutes ago, Syriza said:

 

GetChorme ?

im sorry sometimes i write variables once and always copy and paste xD

 

#NOTE: I can't help and log in because of my personal business. But a little code, I wanted to give this example, you can change the logic and use it in a healthy way.

  • Love 2
Link to comment
Share on other sites

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 0

      Target Information System

    2. 1

      Feeding game source to LLM

    3. 2

      anti exp explanation pls

    4. 1

      Feeding game source to LLM

    5. 2

      anti exp explanation pls

    6. 0

      [GR2] Positioning an object added with "Attach"

    7. 1417

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.