RPR GetUserFileNameForRead
From CockosWiki
(Difference between revisions)
(→GetUserFileNameForRead()) |
(→Returns) |
||
Line 17: | Line 17: | ||
An array or list, the elements of which are: | An array or list, the elements of which are: | ||
{|class="wikitable" | {|class="wikitable" | ||
- | !Name!!Description | + | !Type!!Name!!Description |
|- | |- | ||
- | |boolean | + | |boolean||result||1 if user pressed ok, 0 if user pressed cancel |
|- | |- | ||
- | |char*||filename||The | + | |char*||filename||The filename chosen by the user. |
|- | |- | ||
|const char*||title||The title of the Windows dialogue box, this can be ignored. | |const char*||title||The title of the Windows dialogue box, this can be ignored. |
Revision as of 14:50, 25 January 2010
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetUserFileNameForRead
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetUserFileNameForRead
Contents |
GetUserFileNameForRead()
bool GetUserFileNameForRead(char* filename, const char* title, const char* defext)
Parameters
Type | Name | Description |
---|---|---|
char* | filename | The default filename displayed by the dialogue box to the user. |
const char* | title | The title of the Windows dialogue box. |
const char* | defext | The default file extension for the Windows dialogue box. |
Returns
An array or list, the elements of which are:
Type | Name | Description |
---|---|---|
boolean | result | 1 if user pressed ok, 0 if user pressed cancel |
char* | filename | The filename chosen by the user. |
const char* | title | The title of the Windows dialogue box, this can be ignored. |
const char* | defext | The default file extension for the Windows dialogue box, this can be ignored. |
Examples
C++
Perl
# # GetUserInput.pl # use strict; use warnings; use constant TITLE => "GetUserInputs"; use constant NUM_INPUTS => 2; use constant CAPTIONS_CSV => "Caption 1,Caption 2"; use constant MAX_RETVAL_LEN => 10; my $retvals_csv = "one,two"; my @response = RPR_GetUserInputs(TITLE, NUM_INPUTS, CAPTIONS_CSV, $retvals_csv, MAX_RETVAL_LEN); RPR_ShowConsoleMsg("retvals_csv $retvals_csv\n"); RPR_ShowConsoleMsg("\n"); RPR_ShowConsoleMsg("response @response\n"); RPR_ShowConsoleMsg("\n"); RPR_ShowConsoleMsg("response[4] $response[4]\n"); RPR_ShowConsoleMsg("\n");
Python
#------------------------------------------------------------------- # get_user_input_example.py #------------------------------------------------------------------- # define msg alias (custom) def msg(m): RPR_ShowConsoleMsg(m+'\n') names = 'in0,in1,in2'; dvalues = '20,21,22'; maxreturnlen = 10; # 10 as per the example above, but really one more than what you expect to get back nitems = len(dvalues.split(',')); # call dialog and get result res = RPR_GetUserInputs('dialogname',nitems,names,dvalues,maxreturnlen); # we get a tuple msg('type is: '+type(res).__name__); # check if res[0] is true ('ok' pressed) if res[0]: # the fourth item holds the input values resvalues = res[4].split(','); # get length of the new array and output all items rvlen = len(resvalues); i=0; while i<rvlen: msg('resvalues['+str(i)+'] = '+resvalues[i]); i+=1; #-------------------------------------------------------------------
See Also
Stuff
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetUserFileNameForRead
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetUserFileNameForRead