help compiling my project for Mac ? lazarus / 8-Other ---------------------------------------------------------------------- teevee · 2008-10-07 18:57 Hello, For my new project, I am using FPC Lazarus and I think it is very good. Now I am wondering, I am using this line to open an HTML file: Shellexecute(handle, 'open', PChar(basedir + 'index.html'),'','',sw_show); Where 'basedir' is a variable containing the application folder. If I would do the same thing on a Mac, would that work as well ? Greetings, Bram ---------------------------------------------------------------------- theo · 2008-10-07 19:08 http://wiki.freepascal.org/Executing_External_Programs ---------------------------------------------------------------------- Phil · 2008-10-07 19:09 Quote from: "teevee"If I would do the same thing on a Mac, would that work as well ? ShellExecute is a Windows API function so you can't use it on OS X. Try this instead: {$IFDEF DARWIN}   Shell('Open "' + basedir + 'index.html"'); {$ENDIF} I included double quotes in case your basedir contains any spaces. You can also open another application using the command line Open command. For example, to open your index.html with the OS X Help Viewer instead of with Safari (or whatever the system's default browser is):   Shell('Open -a "Help Viewer" "' + basedir + 'index.html"'); Thanks. -Phil ---------------------------------------------------------------------- teevee · 2008-10-07 23:22 Hey .. when I try to compile that, it doesn't recognize Shell as a command ? Is it included in the Mac version only ? ---------------------------------------------------------------------- Phil · 2008-10-08 01:15 Quote from: "teevee"Hey .. when I try to compile that, it doesn't recognize Shell as a command ? Is it included in the Mac version only ? Shell is in the Unix unit, which needs to be included in your uses. Please download the FPC rtl.pdf. Thanks. -Phil ---------------------------------------------------------------------- teevee · 2008-10-08 21:22 So if somebody has Lazarus installed on a Mac, does him/her has this Unix unit ? ---------------------------------------------------------------------- Phil · 2008-10-09 02:10 Quote from: "teevee"So if somebody has Lazarus installed on a Mac, does him/her has this Unix unit ? The Unix unit is only available on OS X and Linux, hence the need for conditional compiling. Download this toolkit and look at the Shell commands for OS X and Linux in file HelpUtil.pas: http://wiki.lazarus.freepascal.org/XDev_Toolkit Thanks. -Phil ---------------------------------------------------------------------- teevee · 2008-10-09 08:13 Thanks a lot! ---------------------------------------------------------------------- windy · 2008-10-10 20:05 thanks for that Phil, I have it working loading a web site URL too (change to load Safari and set the URL) most excellent, I was wanting to know how to do that ---------------------------------------------------------------------- windy · 2008-10-10 21:36 Question if I may how do you do the same thing on Linux (e.g to open Firefox) (it says there is no Open command) thanks! ---------------------------------------------------------------------- Phil · 2008-10-11 01:47 Quote from: "windy"Question if I may how do you do the same thing on Linux (e.g to open Firefox) (it says there is no Open command) thanks! See HelpUtil.pas in above link. Also, don't specify Safari in your Shell since user might have a different browser set as default. Just specify the URL. You can see how this works. Enter the following at a Terminal command line: open "http://www.freepascal.org" Thanks. -Phil ---------------------------------------------------------------------- windy · 2008-10-11 02:53 Thanks Phil I got it working in Linux too