#=============================================================================================
# @TITLE					DBMGUI - Main test
#
# @NUMBER					init
#
# @DESCRIPTION				Sets all global variables.
#
# @EXP_RESULT				
#
# @REQUIREMENTS				
#=============================================================================================

########################################################
# these values are modified by dbmguitest.pl           #
########################################################
public Version = "7.6.00";
public Version = "7.6.00";
public Version = "7.6.00";
public Version = "7.6.00";
public Version = "7.6.00";
public Version = "7.6.00";
public Version = "7.6.00";
public Version = "7.5.00";
public DetailedVersion = "7.6.00.07";
public database = "WR760D";
public QA_Level = "DEV";
public Server = "P52837";
public RemoteServer = "p38387";
public tools_dir = "C:\\Program Files\\SDB\\DBM\\";
public testdir = "D:\\WinRunner\\DBMGUI\\";
########################################################

public guiFilePath =  testdir & "GuiFiles\\";
public GUI_Version = "3";

################################################################################ 
# 
# is_numeric(); 
# 
# This function returns "-1" (True) if a string passed in is completely numeric. 
# 
# Arguments are: sValue 
# Example - The following example sets x to "Letters": 
# if (is_numeric("Cat")) 
# x = "Numbers"; 
# else 
# x = "Letters"; 
# 
################################################################################ 
public function is_numeric(sValue)
{
	auto iPointer, iValueLength, iIsNumeric;
	iIsNumeric = -1; #True
	iValueLength = length(sValue);
	for (iPointer=0; iPointer < iValueLength; iPointer++) {
	
		if (ascii(substr(sValue, iPointer, 1)) < 48 || ascii(substr(sValue, iPointer, 1)) > 57) { 
			iIsNumeric = 0; #False
		}
	}
	return iIsNumeric;
}
generator_add_function("is_numeric","This function returns "-1" (True) if a string passed in is completely numeric.", 1, "sValue","type_edit","");
generator_add_function_to_category("General","is_numeric");


################################################################################ 
# 
# menu_select_item_by_shortcut(in Menu_shortcuts); 
# 
################################################################################ 
public function menu_select_item_by_shortcut(in menu_shortcuts) 
{ 
        auto split_count,menu_array[],win,i;
		
		win = GUI_get_window();
        win_activate(win);
		
		split_count=split (menu_shortcuts,menu_array,";"); 

		#!!!! dt.TASTEN !!!!
		#kRechts_E
		#kLinks_E
		#kAb_E
		#kAuf_E;
		#kreturn
		#Buchstaben: a -> key: a
		
        #open the menu. 
        type("<kAlt_L>"); 
        #make the selection via "shortcuts"
        for (i=1;i<=split_count;i++)
		{ 
			type (menu_array[i]);
			wait(1); 
        } 
} 
generator_add_function( "menu_select_item_by_shortcut", "Selects one or a sequence of menu Item(s) by its key shortcut, seperated by ';' \n Example: \n Menu: (I)nstance->Confi(g)uration->(D)atabase User \n -- invoking: menu_select_item_shortcuts(I;g;D) ", 1, "Menu Item(s) shortcut key(s)", "type_edit", "\"\"" ); 
generator_add_function_to_category( "menu", "menu_select_item_by_shortcut" );
