Author Topic: Project tool to prompt user  (Read 7967 times)

pvonkaenel

  • Senior Community Member
  • Posts: 211
  • Hero Points: 6
Project tool to prompt user
« on: October 27, 2009, 04:00:32 PM »
Hi all,

I've defined a few custom tools in [Project --> Project Properties] on the Tools page.  Is it possible to add a % modifier which will prompt the user for some data like you can do with aliases?  Alternatively, do you have suggestions on how to create a user interactive project tool?

Thanks,
Peter

Scott H

  • Senior Community Member
  • Posts: 240
  • Hero Points: 9
Re: Project tool to prompt user
« Reply #1 on: October 27, 2009, 08:19:07 PM »
You can prompt for values on the command line by using the get_string() function.  You can also call macros during the build process using the %m escape sequence.  You could make a macro function like this:

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

_str queryForValue()
{
   get_string(result,'Value:')
   return result;
}
and load it (press escape to bring up the command line, then type 'load' and hit enter).

Then do the following:
1. Go to Project Properties > Tools tab.  
2. Select "Build" in the tool list.  
3. On the "command line" text box insert "%mqueryForValue%" where you want your custom value (don't use the quotes though).
4. Click OK and build the project.  You will be prompted for a value on the command line and the value you enter will replace the %m sequence.

« Last Edit: October 27, 2009, 08:22:07 PM by Scott H »

pvonkaenel

  • Senior Community Member
  • Posts: 211
  • Hero Points: 6
Re: Project tool to prompt user
« Reply #2 on: October 27, 2009, 08:30:54 PM »
That sounds perfect, thanks.

Peter

pvonkaenel

  • Senior Community Member
  • Posts: 211
  • Hero Points: 6
Re: Project tool to prompt user
« Reply #3 on: October 28, 2009, 12:17:40 PM »
It works great as long as it's in a loaded macro module.  To make it easier to share I would like to put it in a batch macro in the same directory as the vpw file (make it part of source control so that no one has to worry about it).  Is there a way to get that to work?

Thanks again,
Peter

Scott H

  • Senior Community Member
  • Posts: 240
  • Hero Points: 9
Re: Project tool to prompt user
« Reply #4 on: October 28, 2009, 01:04:55 PM »
I tried making it a batch macro and you're right, the build complains that it can't find the function if it's not in a loaded macro file.  There's no work-around for this, but I can log a feature enhancement to add an escape sequence that prompts the user for a value, similar to aliases.  The first solution should still work, but your team will just have to coordinate on loading that macro file manually.

pvonkaenel

  • Senior Community Member
  • Posts: 211
  • Hero Points: 6
Re: Project tool to prompt user
« Reply #5 on: October 28, 2009, 01:28:42 PM »
Thanks Scott, I'll use that for now.  I would like to see the ability to run a batch macro at some point in the future.

Thanks again,
Peter

Scott H

  • Senior Community Member
  • Posts: 240
  • Hero Points: 9
Re: Project tool to prompt user
« Reply #6 on: October 28, 2009, 01:33:55 PM »
I've logged that as a feature request also.

pvonkaenel

  • Senior Community Member
  • Posts: 211
  • Hero Points: 6
Re: Project tool to prompt user
« Reply #7 on: October 28, 2009, 03:10:03 PM »
I guess I have one more request to go along with this: since I want to include the batch macro file in source control, I don't have an easy way to include that directory in the VSLICKPATH (it will be different for everyone).  Would it be possible to have the macro file in the "Run from dir:" on the Project Properties page where I'm defining the tool?

Thanks,
Peter

Scott H

  • Senior Community Member
  • Posts: 240
  • Hero Points: 9
Re: Project tool to prompt user
« Reply #8 on: October 28, 2009, 03:39:18 PM »
We'll take a look at that at the same time, thanks for the suggestion.