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

  • Bronze
2 minutes ago, Caramelito said:

Wait. He is going to show us how to automatically download and install chrome&set it as a default browser.

@Johnny69 how? Is going to execute chrome.exe.

If chrome is your default browser Is going to open chrome.

Just change his line with that and test it, you will see.

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



×
×
  • 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.