SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: AriP on October 20, 2013, 03:25:49 pm

Title: "Executing" an HTML file
Post by: AriP on October 20, 2013, 03:25:49 pm

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.
Title: Re: "Executing" an HTML file
Post by: Graeme 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)

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");


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.
Title: Re: "Executing" an HTML file
Post by: AriP 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!