THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/04/2009 at 18:59, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 11
Platform: Mac ;
Language(s) : C.O.F.F.E.E ;
---------
Hi,
I'm trying to open a plugin-registration-page in a user's default browser via coffee when they click a "register now" button in a GeUserDialog... I've hit a snag.
I would really like to do this in a direct manner, e.g., the way one can open Maxon's pages using CallCommand(13681) as indicated in "Basic Functions" of the coffeeSDK, but I've searched the SDK and the Cafe archives and can't find a function that simply fires up a website.
As a workaround, I have my plugin write a .url file and then try to open that file with GeExecuteFile(filepathToURLfile.url). This works great on my mac, but when I try it on a fresh mac, the GeExecuteFile() tries to open the file in its creator program, C4D, rather than a default browser and returns a C4D error of unrecognizable file format. To make it work, I need to use the macOSx system finder to 'get info' on any old example .url file and then select a browser under "Open with:" and say apply to all files of this type in the system's file info window.
I have no idea what would happen on a Windows machine, but I suspect it Windows would be more .suffix dependent and would open the file correctly, eh?
Surely there is a better way to pull off this simple task with coffee. I appreciate any suggestions.
Thanks,
Graham
TextDialog("You pressed OK! Now you'll register in your favorite browser.", DLG_OK);
var vFilenameWeb = GeGetRootFilename();
vFilenameWeb->RemoveLast();
vFilenameWeb->AddLast("PDBSurfReg");
vFilenameWeb->SetSuffix("url");
var vBaseFile = new(BaseFile);
vBaseFile->Open(vFilenameWeb, GE_WRITE);
var vStr = "[InternetShortcut]\n\nURL=http://www.fivth.com/\n\nWorkingDirectory=C:\WINDOWS\ \n\nShowCommand=7\n\nIconIndex=1\n\nIconFile=C:\WINDOWS\SYSTEM\url.dll\n\nModified=20F06BA06D07BD014D\n\nHotKey=1601";
var test = vBaseFile->WriteString(vStr);
var myString = ReturnFileAsString(vFilenameWeb);
vBaseFile->Close();
var file = new(Filename);
file->SetFullString(vFilenameWeb);
var i = GeExecuteFile(file); // this fails if mac users have not set .url files to open with a browser by default!
println("file executed = ", i);
return;