Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
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;
On 01/04/2009 at 20:19, xxxxxxxx wrote:
The problem with GeExecuteFile() is that what application is called depends upon the associations between the file types and applications (as you note). Unfortunately, GeExecute() doesn't take arguments so you can't call the default browser with a file as an argument either.
On Windows, I use a .bat (batch) file and call it to execute an application with a particular file as argument.
In the C++ SDK, one can use a web view custom gui to show a URL in a Cinema 4D dialog window directly or GeOpenHTML() to open a URL (string) in the default browser.
You may need to find a similar 'batch' approach for the Mac (AppleScript?). Not on my Mac at the moment but maybe one can make a file-level association with an application? Otherwise, COFFEE doesn't have as many options in this direction.
On 02/04/2009 at 06:38, xxxxxxxx wrote:
On Mac call an Apple script file.
Such as (In AppleScript file) :
> \> property target_URL : "http://www.mycoolplace.com/" \> \> open location target_URL \>
\> property target_URL : "http://www.mycoolplace.com/" \> \> open location target_URL \>
Cheers Lennart
On 02/04/2009 at 14:22, xxxxxxxx wrote:
Thanks for the feedback guys. Two updates:
On 02/04/2009 at 15:23, xxxxxxxx wrote:
Quick test on a mac shows that an html redirect file seems to work...danger of it opening in something like Dreamweaver, but I'll take that chance for now and will stick with the .url for Windows.
<HEAD> <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.fivth.com/"> </HEAD>
On 03/04/2009 at 13:42, xxxxxxxx wrote:
Another update: creating a .html file in TextEdit and saving to the desktop works fine, but the same problem occurs if I create an identical file via my coffee code. The system writes C4D as the creator and tries to open it into C4D. It seems the only file that is default 100% recognized by a mac to open a browser is a .webloc file. These write the URL into the resource fork which I don't think I could access via Coffee, so instead I'm just packaging one with the plugin in a folder...lame. I do a test for the operating system and if its Windows I write the .url file, if mac, I open the included .webloc file. It was worth a try, Graham