Author Topic: "Executing" an HTML file  (Read 4404 times)

AriP

  • Community Member
  • Posts: 7
  • Hero Points: 0
"Executing" an HTML file
« on: October 20, 2013, 03:25:49 PM »
Hi,

I'm a slickedit n00b with a n00b problem. I'm using v17 (Linux). I want HTML code written in the editor to execute by shelling to a terminal where the code would normally be executed simply by typing its name. Do I need a macro to do this or can I set up a project and manipulate the project settings? If so, how? Also, how can I specify that I want a specific browser to be used -- Chrome, for example. An answer would really be appreciated.
« Last Edit: October 20, 2013, 03:31:43 PM by AriP »

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: "Executing" an HTML file
« Reply #1 on: October 22, 2013, 11:11:13 AM »
One way is to use this macro
Code: [Select]
_command void show_current_buffer_in_browser() name_info(','VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_READ_ONLY)
{
   safe_goto_url(p_buf_name);
}

add the code to the vusrmacs.e file in your configuration folder.  If you don't have a vusrmacs.e file, record a trivial macro and save it and vusrmacs.e should be created.  To load the macro, open vusrmacs.e in the editor and use the load module command on the macro menu.  Then you can bind a key to the macro or you can add it to the right click menu in the editor - to do that, right click in the editor window and select "edit this menu".  You are then presented with the menu editor.  Click the help button for some help.  The name of the right click menu is "_ext_menu_default".  To add your command, first you need to select the position in the menu that you want it to appear - using the edit window with the scroll bar at the bottom of the dialog.  In the "command" field you need to enter the name of the macro show_current_buffer_in_browser, and put something suitable in the caption.  Then click one of the buttons "insert after" or "insert before".

Another way is to use the shell command  - look up shell in the help. e.g.
 shell("man cc","","xterm -T "man" -e /bin/sh -c");

or

Code: [Select]
   shell('"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ' :+ maybe_quote_filename(p_buf_name));

Also, in tools -> options, search for "browser" and see how to select a default browser.

AriP

  • Community Member
  • Posts: 7
  • Hero Points: 0
Re: "Executing" an HTML file
« Reply #2 on: October 22, 2013, 03:52:16 PM »
Thanks a million. This worked out and saved a huge amount of time. Slick is a great product!