SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: flethuseo on October 20, 2016, 09:54:29 PM

Title: Getting path where a command was loaded from
Post by: flethuseo on October 20, 2016, 09:54:29 PM
Hi,
I want to be able to get the path for the ruby script which is the same directory from which the *.e file was loaded from. Right now, I'm forced to use an absolute path, but I want to make this a relative path. Is this possible?

Code: [Select]
#include "slick.sh"

_command void rmv_c_dev() {

   if (_select_type() == "") {
      select_all()
   } else if (_select_type() != "LINE" && _select_type() != "BLOCK") {
      // Convert it into a LINE selection
      _select_type('', 'T', 'LINE');
   }

   // This doesn't run correctly if I don't supply the full path, I want to detect the path of this script.
   _str cmd = 'ruby C:\Users\Ted\SlickEdit\MyMacros\rmv_c_dev\rmv_c_dev.rb'
   _str out = filter_command(cmd);
// say('cmd='cmd);
}
Title: Re: Getting path where a command was loaded from
Post by: Graeme on October 21, 2016, 11:58:18 AM
You could have a read of this
https://community.slickedit.com/index.php/topic,9792.msg41781.html#msg41781 (https://community.slickedit.com/index.php/topic,9792.msg41781.html#msg41781)

You can get the path for your configuration folder using _config_path().