Author Topic: _ProjectFindFile  (Read 3072 times)

Absinthe

  • Guest
_ProjectFindFile
« on: September 23, 2009, 04:49:10 pm »
I have a macro that opens a table file in my project. However, if I don't have a current file open and active (not minimized) or the file I have open is read-only the macro fails. Here is the huge macro :) What might I be doing wrong?

Quote
_command ot, open_table(tableName) name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
   _str fileName=_ProjectFindFile('dbo.'tableName'.sql', _project_name, false, true);

   edit(fileName);
}

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Re: _ProjectFindFile
« Reply #1 on: September 23, 2009, 05:01:22 pm »
Code: [Select]
_command ot, open_table(tableName) name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)

VSARG2_REQUIRES_EDITORCTL --> "This command is not allowed unless there is an open active not minimized buffer window".

Look up help on the VSARG2_* stuff (look up "name_info" in the Help) for a table that describes the flags to help you pick which ones are appropriate for your situation.

For example, the "edit" command that your macro calls has these flags:
Code: [Select]
name_info(FILE_MAYBE_LIST_BINARIES_ARG'*,'VSARG2_CMDLINE|VSARG2_REQUIRES_MDI|VSARG2_NOEXIT_SCROLL)

Absinthe

  • Guest
Re: _ProjectFindFile
« Reply #2 on: September 23, 2009, 05:28:36 pm »
All that stuff in the name_info() throws me. I tend to get that as a freebie when I start a macro by recording then modifying it. I have never really understood them so I just left them there. I will have to give them all a good look-see and be more careful about free tag-along things like that.