1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: t_basic_ide_tools.inc,v $
13 '* last change: $Author: obo $ $Date: 2008-07-25 07:44:37 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 ' ** owner : joerg.skottke@sun.com
36 ' ** short description : tools for the property-browser test
38 '\******************************************************************************
40 function hShowMacroControls() as boolean
42 '///<h3>Tear off the ToolsCollectionBar from the MacroBar</h3>
43 '///<i>Starting point: Basic dialog editor is open and has the focus</i>
45 const CFN = "hShowMacroControls::"
47 printlog( CFN & "Enter" )
49 '///+<li>Test whether the ToolsCollectionBar is already open. If yes, exit directly</li>
50 kontext "ToolsCollectionBar"
51 if ( ToolsCollectionBar.exists( 3 ) ) then
52 printlog( CFN & "Exit: ToolsCollectionBar is already open." )
53 hShowMacroControls() = true
57 '///+<li>Verify that the Dialog Bar is available</li>
59 if ( DialogBar.exists( 5 ) ) then
61 '///+<li>Verify that the controls-button is enabled</li>
63 '///+<li>Click on the controls-button to open the ToolsCollectionBar</li>
66 '///+<li>Tear off the ToolsCollectionBar from the DialogBar</li>
69 '///+<li>Verify that the ToolsCollectionBar is visible and can be accessed</li>
70 kontext "ToolsCollectionBar"
71 if ( ToolsCollectionBar.exists( 5 ) ) then
73 '///+<li>Move it to the upper left corner at pos 50/50</li>
74 ToolsCollectionBar.Move ( 50 , 50 )
75 printlog( CFN & "Exit: ToolsCollectionBar is open and has been placed" )
76 hShowMacroControls() = true
79 printlog( CFN & "Exit: ToolsCollectionBar is not available. Aborting." )
80 hShowMacroControls() = false
84 printlog( CFN & "Exit: The Controls-Button is not enabled. Aborting." )
85 hShowMacroControls() = false
89 printlog( CFN & "Exit: The Dialog Bar is not available. Aborting." )
90 hShowMacroControls() = false
97 '*******************************************************************************
99 function hGetBasicWorkFile( cMajorID as string ) as string
101 '///<h3>Retrieve a filename, depending on gApplication and Build-ID</h3>
102 '///<i>Structure: work-directory/basic[.suffix]</i>
105 const CFN = "hGetBasicWorkFile::"
109 '///+<li>Build a path and a filename (path from UNO, Suffix from global-module)</li>
110 sFile = hGetWorkPath() & "basic" & hGetSuffix( cMajorId )
111 sFile = ConvertPath( sFile )
113 printlog( CFN & sFile & " for " & gApplication & " (" & cMajorID & ")" )
115 '///+<li>Return the path as string</li>
116 hGetBasicWorkFile() = convertpath( sFile )
122 '*******************************************************************************
124 function hOpenBasicIDE() as boolean
126 '///<h3>Open the Basic IDE for the last module listed in the Macro Organizer</h3>
127 '///<i>Starting point: Basic Macro Organizer has focus</i>
130 const CFN = "hOpenBasicIDE::"
132 '///+<li>Select the last module in the treelist, verify that it can be edited</li>
133 hSelectTheLastModule( true )
135 '///+<li>Click the Edit-button</li>
138 '///+<li>Maximize the Basic IDE (required to ensure proper operation of mousemovements)</li>
143 '///+<li>Verify that the Basic IDE is open, return TRUE on success</li>
144 if ( BasicIde.exists() ) then
145 printlog( CFN & "Open Basic-IDE for existing module: success" )
146 hOpenBasicIDE() = true
148 printlog( CFN & "Open Basic-IDE for existing module: failure" )
149 hOpenBasicIDE() = false
156 '*******************************************************************************
158 function hCloseBasicIDE() as boolean
160 '///<h3>Close the BASIC-IDE with best effort verification</h3>
161 '///<i>Starting point: Basic IDE is open and has the focus</i>
163 '///+<li>File-menu</li>
164 '///+<li>Slot FileClose</li>
165 '///+<li>hCloseDocument()/hDestroyDocument()</li>
169 use "global\tools\includes\optional\t_docfuncs.inc"
171 const CFN = "hCloseBasicIDE::"
174 '///+<li>Close the macro controls float</li>
175 hCloseCollectionBar()
177 '///+<li>Try to close the current document</li>
178 brc = hDestroyDocument()
180 hCloseBasicIDE() = true
182 hCloseBasicIDE() = false
183 qaerrorlog( "#i54135# Failed to close BASIC IDE" )
189 '*******************************************************************************
191 function hReOpenBasicDialog() as boolean
193 '///<h3>Open BASIC-IDE after loading a workfile with documentbound macro</h3>
194 '///<i>Starting point: Focus on document containing at least one macro</i><br>
195 '///<i>IMPORTANT: Errorhandling is incomplete, test may end up in undefined state</i>
200 '///+<li>open the macro dialog, select the last module</li>
201 brc = hSelectTheLastModule( true )
203 warnlog( "Could not open the last module for editing." )
204 hReOpenBasicDialog() = false
208 '///+<li>edit the module</li>
211 '///+<li>find the dialog window.</li>
215 brc = hFindFirstDialog()
217 warnlog( "Could not find any dialog" )
218 hReOpenBasicDialog() = false
220 hReOpenBasicDialog() = true
223 '///+<li>Return TRUE on success, FALSE on failure</li>
228 '*******************************************************************************
230 function hFindFirstDialog() as boolean
232 '///<h3>Find the first dialog in the BASIC-IDE</h3>
233 '///<i>Starting point: Basic IDE must be open and has the focus</i>
236 dim iPosOverTabbar as integer
238 const CFN = "hFindFirstDialog::"
240 '///+<li>Set focus to Basic IDE, maximize it</li>
247 '///+<li>move pointer over the tabbar and click until a dialog opens (hopefully)</li>
248 for iPosOverTabbar = 1 to 20
250 Tabbar.MouseDown ( 5 * iPosOverTabbar , 50 )
251 Tabbar.MouseUp ( 5 * iPosOverTabbar , 50 )
253 if ( DialogWindow.Exists() ) then
255 DialogWindow.typeKeys( "<up>", 5 )
261 '///+<li>Return TRUE on success, FALSE on failure</li>
263 printlog( CFN & "Found dialog" )
265 printlog( CFN & "Could not find the first dialog via tabbar" )
267 hFindFirstDialog() = brc
272 '*******************************************************************************
274 function hSelectDialogPane() as boolean
276 '///<h3>Select the dialog pane in the Basic dialog editor</h3>
277 '///<i>Starting point: Basic dialog editor is open and has the focus</i>
280 const CFN = "hSelectDialogPane::"
281 printlog( CFN & "Enter" )
283 '///+<li>Select background dialog by rubberband</li>
286 '///+<li>Set the mousepointer down at 90/90</li>
287 DialogWindow.mouseDown( 90 , 90 )
289 '///+<li>Move it to 10/10</li>
290 DialogWindow.mouseMove( 10 , 10 )
292 '///+<li>Release the mouse pointer at 10/10</li>
293 DialogWindow.mouseUp ( 10 , 10 )
295 '///+<li>Return TRUE, currently no verification is implemented</li>
296 printlog( CFN & "Exit: Selected dialog pane (not verified)" )
297 hSelectDialogPane() = true
302 '*******************************************************************************
304 function hCloseCollectionBar() as boolean
306 '///<h3>Close the ToolsCollectionBar (Macro Controls Float)</h3>
307 '///<i>Starting point: Basic Dialog editor is open, ToolsCollectionBar is open</i>
310 const CFN = "hCloseCollectionBar::"
316 '///+<li>Try to close the ToolsCollectionBar max 3 times</li>
317 kontext "ToolsCollectionBar"
318 while ( ToolsCollectionBar.exists( 1 ) )
320 printlog( CFN & "Closing ToolsCollectionBar..." )
321 ToolsCollectionBar.close()
323 if ( iTry = RETRIES ) then
324 printlog( CFN & "Failed to close ToolsCollectionBar" )
325 hCloseCollectionBar() = false
330 hCloseCollectionBar() = true
335 '*******************************************************************************
337 function hDeleteMacro() as boolean
339 '///<h3>Delete all text in the Basic IDE editor</h3>
340 '///<i>Starting point: Basic IDE is open, has focus, code can be edited</i>
343 use "global\tools\includes\optional\t_accels.inc"
345 '///+<li>Verify all prerequisites are met (BasicIDE must be open)</li>
347 if ( not BasicIde.exists() ) then
348 warnlog( "hDeleteMacro::BasicIDE is not visible/active. Aborting" )
349 hDeleteMacro() = false
355 '///+<li>get the languagespecific accelerator for "Edit->Select All"</li>
356 dim cAccelerator as string
357 cAccelerator = hGetAccel( "SelectAll" )
359 printlog( "hDeleteMacro::Using Accel: " & cAccelerator )
361 ' Common for all actions is that we delete the existing macro before
362 ' inserting the new one. This fails if the accelerator for SelectAll
363 ' is incorrect, we try to recover by doing this manually then.
364 '///+<li>Delete the entire content of the Basic IDE editor</li>
365 EditWindow.TypeKeys( cAccelerator )
366 EditWindow.TypeKeys( "<Delete>" )
368 ' Verify that the EditWindow is empty, if not use a method that
369 ' should work for all languages/locales
370 '///+<li>Verify that the editor window is indeed empty</li>
371 brc = hIsEditWindowEmpty()
373 qaerrorlog( "#i52430# hDeleteMacro::Accelerator " & cAccelerator & " failed" )
374 printlog( "hDeleteMacro::Trying alternative method" )
375 EditWindow.TypeKeys( "<Mod1 Home>" )
376 EditWindow.TypeKeys( "<Mod1 Shift End>" )
377 EditWindow.TypeKeys( "<Delete>" )
378 brc = hIsEditWindowEmpty()
381 '///+<li>Return TRUE on success, FALSE on failure</li>
387 '*******************************************************************************
389 function hIsEditWindowEmpty() as boolean
391 '///<h3>Test if the Basic-EditWindow is empty</h3>
392 '///<i>Starting point: Basic IDE editor is open and has the focus</i>
395 '///+<li>Verify that prerequisites are met: Basic IDE must be open</li>
397 if ( not BasicIDE.exists() ) then
398 warnlog( "hIsEditWindowEmpty::BasicIde is not open/visible" )
399 hIsEditWindowEmpty() = false
403 '///+<li>Verify that the EditWindow is empty. EditCopy is disabled when empty</li>
404 EditWindow.TypeKeys( "<Mod1 Home>" )
405 EditWindow.TypeKeys( "<Mod1 Shift End>" )
408 printlog( "EditCopy should be enabled for empty Basic IDE editor" )
413 if ( getClipBoardText() <> "" ) then
414 hIsEditWindowEmpty() = false
415 printlog( "hIsEditWindowEmpty::no - content follows:" )
416 printlog( GetClipboardText )
418 hIsEditWindowEmpty() = true
419 printlog( "hIsEditWindowEmpty::yes" )
422 '///+<li>Return TRUE on success, FALSE on failure</li>
427 '*******************************************************************************
429 function hRenameTab( cTabName as string ) as integer
431 '///<h3>Rename the first tab in the Basic IDE Tabbar</h3>
432 '///<i>Starting point: Basic IDE is open, at least one tab exists</i><br>
433 '///Return values are:
435 '///+<li>0 = Tab was correctly renamed</li>
436 '///+<li>1 = Invalid name warning is displayed (handle outside of function)</li>
437 '///+<li>2 = Unknown error / failed to rename the tab</li>
438 '///+<li>3 = Unable to access context menu</li>
443 const CFN = "hRenameTab::"
445 dim cString as string
451 cString = "<HOME><SHIFT END>" & cTabName & "<RETURN>"
454 '///+<li>Open the context menu of the tabbar</li>
458 Tabbar.OpenContextMenu
464 printlog( "No context menu, retrying..." )
467 '///+<li>Select to rename the tab</li>
469 warnlog( CFN & "Unable to access Context Menu" )
475 '///+<li>Overwrite the old name of the tab</li>
477 Tabbar.TypeKeys( cString , true )
479 printlog( CFN & "Tab renamed: " & cTabName )
481 '///+<li>Handle possible errors</li>
483 warnlog( CFN & "Failed to rename tab: " & cTabName )
490 if ( active.exists() ) then
492 printlog( CFN & "Invalid name for tab: Warning is displayed" )
496 '///+<li>Return 0, 1 or 2</li>
501 '*******************************************************************************
503 function hGetTabNameFromOrganizer() as string
505 '///<h3>Retrieve the name of a tab from the Basic Library Organizer</h3>
506 '///<i>Starting point: Basic IDE is open and has the focus</i>
509 const CFN = "hGetTabNameFromOrganizer::"
510 dim cReturnString as string
512 '///+<li>Open the Basic Library Organizer</li>
513 '///+<li>Go to the Module-Tab</li>
514 '///+<li>Get the name of the currently selected item from the Module-list</li>
515 '///+<li>Close the Macro Library Organizer</li>
516 if ( hOpenBasicObjectOrganizer( 1 ) ) then
517 cReturnString = Modulliste.GetSelText()
519 printlog( CFN & "Returning Tab-Name: " & cReturnString )
521 cReturnString = "Failure: Macro Organizer not open"
522 warnlog( CFN & cReturnString )
526 '///+<li>Return the name from the Module-list</li>
527 hGetTabNameFromOrganizer() = cReturnString
532 '*******************************************************************************
534 function hNewDialog() as boolean
536 '///<h3>Create a new BASIC dialog</h3>
537 '///<i>Starting point: Basic IDE is open</i>
540 const CFN = "hNewDialog::"
542 '///+<li>Open the context menu for the tabbar</li>
544 Tabbar.OpenContextMenu
546 '///+<li>Select the first item (insert)</li>
548 WaitSlot( 1000 ) ' sleep( 1 )
550 '///+<li>Select the second item (new dialog)</li>
552 WaitSlot( 2000 ) ' sleep( 2 )
554 '///+<li>Verify that a new dialog is opened and has the focus</li>
555 if ( DialogWindow.Exists() ) then
556 printlog( CFN & "New dialog is open" )
558 if ( DialogWindow.IsMax() = false ) then
559 DialogWindow.Maximize()
563 warnlog( CFN & "New dialog is not open" )
566 '///+<li>Return TRUE on success, FALSE on failure</li>
571 '*******************************************************************************
573 function hNewModule() as boolean
575 '///<h3>Create a new BASIC module</h3>
576 '///<i>Starting point: Basic IDE is open</i>
579 const CFN = "hNewModule::"
581 '///+<li>Open the context menu for the tabbar</li>
583 Tabbar.OpenContextMenu
585 '///+<li>Select the first item (insert)</li>
587 WaitSlot( 1000 ) ' sleep( 1 )
589 '///+<li>Select the first item (new module)</li>
591 WaitSlot( 2000 ) ' sleep( 2 )
593 '///+<li>Verify that a new module is opened and has the focus</li>
594 if ( EditWindow.Exists() ) then
595 printlog( CFN & "New module is open" )
598 warnlog( CFN & "New module is not open" )
601 '///+<li>Return TRUE on success, FALSE on failure</li>
606 '*******************************************************************************
608 function hHideModule() as boolean
610 '///<h3>Hide a Basic Module from the IDE</h3>
611 '///<i>Starting point: Basic IDE is open and has the focus</i>
614 const CFN = "hHideModule::"
618 '///+<li>Open the context menu of the tabbar</li>
620 tabbar.openContextMenu
622 '///+<li>Select the fourth entry (Hide)</li>
626 printlog( CFN & "Success" )
628 hHideModule() = false
629 warnlog( CFN & "Failure" )
631 '///+<li>Return TRUE on success, FALSE on any other condition (not verified)</li>
636 '*******************************************************************************
638 function hInitFormControls( cModule as string ) as boolean
640 '///<h3>Get from a new document to the Macro Controls Float in one go</h3>
641 '///<i>Starting point: Plain document</i><br>
642 '///This function performs following steps:
644 '///+<li>Open the Basic Organizer</li>
645 '///+<li>Create a new module for the current document</li>
646 '///+<li>Open a new basic dialog</li>
647 '///+<li>Open the Macro controls float</li>
652 const CFN = "hInitFormControls::"
654 '///+<li>Create and edit a new module for the current document</li>
655 brc = hInitBasicIde( cModule )
657 warnlog( "Could not create new module" )
659 hInitFormControls() = false
666 '///+<li>Create a new dialog.</li>
669 warnlog( "Could not create Basic-Dialog" )
671 hInitFormControls() = false
675 '///+<li>Open the macro controls float.</li>
676 brc = hShowMacroControls()
678 warnlog( CFN & "Could not tear off the macro controls float" )
680 hInitFormControls() = false
684 '///+<li>Return TRUE if all went well, FALSE on any other error</li>
685 hInitFormControls() = true
687 '///NOTE: The function will try to cleanup after itself in case of failure
691 '*******************************************************************************
693 function hInitBasicIde( cModule as string ) as boolean
695 '///<h3>Get from a new document to the Basic IDE in one go</h3>
696 '///<i>Starting point: New, plain document</i>
699 use "global\tools\includes\optional\t_basic_organizer_tools.inc"
700 use "global\tools\includes\optional\t_listfuncs.inc"
702 const CFN = "hInitBasicIde::"
704 if ( cModule = "" ) then
705 warnlog( CFN & "Invalid parameter passed to function" )
706 hInitBasicIde() = false
710 ' some multi-purpose return code
713 '///+<li>Open the basic Organizer</li>
714 brc = hOpenBasicOrganizerFromDoc()
716 warnlog( CFN & "Could not open the Basic Organizer, aborting" )
717 hInitBasicIde() = false
721 '///+<li>Create a new module for the current document</li>
722 brc = hCreateModuleForDoc( cModule )
724 warnlog( CFN & "The Basic-IDE is not open, aborting" )
725 hInitBasicIde() = false
728 if ( Makro.exists() ) then
729 printlog( CFN & "Closed Macro Organizer" )
735 '///+<li>Maximize the BasicIDE</li>
739 '///+<li>Verify that the Basic IDE is open, return TRUE on success, FASLE on failure</li>
740 hInitBasicIde() = true
742 '///NOTE: The function will try to to clean up after itself in case of any error
746 '*******************************************************************************
748 function hInsertMacro( _id as integer ) as boolean
750 '///<h3>Insert a macro into the Basic-IDE edit window by Index</h3>
751 '///<i>Starting point: Basic IDE is open, has the focus</i>
754 const CFN = "hInsertMacro::"
757 if ( ( _id < 1 ) or ( _id > 3 ) ) then
758 warnlog( CFN & "Invalid parameter passed to function: " & _id )
759 hInsertMacro() = false
765 '///+<li>Delete the content of the edit window</li>
768 warnlog( CFN & "Content of Basic-IDE was not deleted" )
769 hInsertMacro() = false
773 '///+<li>Insert a macro by index (passed as function parameter)</li>
776 ' this is a working macro that contains no errors
777 EditWindow.TypeKeys( "'# TTMacro1: This is a short testscript for automated testing!<return><return>" )
778 EditWindow.TypeKeys( "sub main<return><return>" )
779 EditWindow.TypeKeys( "print " & Chr (34) + "hallo" & Chr (34) )
780 EditWindow.TypeKeys( "<Return><Return>" )
781 EditWindow.TypeKeys( "<Home>end sub<return>" )
782 hInsertMacro() = true
783 printlog( CFN & "Inserted: " & _id )
785 EditWindow.TypeKeys( "'# TTMacro2: a second module for automated testing!" )
786 EditWindow.TypeKeys( "<Return><Return>" )
787 hInsertMacro() = true
788 printlog( CFN & "Inserted: " & _id )
790 EditWindow.TypeKeys( "'# TTMacro3: Bring up a messagebox<return><return>" )
791 EditWindow.TypeKeys( "sub main<return><return>" )
792 EditWindow.TypeKeys( " msgbox " & Chr (34) + "TTMacro3" & Chr (34) )
793 EditWindow.TypeKeys( "<Return><Return>" )
794 EditWindow.TypeKeys( "<Home>end sub<return>" )
795 hInsertMacro() = true
796 printlog( CFN & "Inserted: " & _id )
803 '*******************************************************************************
805 function hTestMacro( _id as integer ) as integer
807 '///<h3>Verify that the correct macro is visible in the IDE edit Window</h3>
808 '///<i>Starting point: Basic IDE is open and has focus</i>
811 const CFN = "hTestMacro::"
815 '///+<li>Copy the first line in the editwindow to clipboard</li>
816 EditWindow.TypeKeys( "<Mod1 Home>" )
817 EditWindow.TypeKeys( "<Home><Shift End>" )
820 '///+<li>Compare the string to a unique substring for the macro</li>
823 if ( Instr ( GetClipboardText, "TTMacro1" ) <> 0 ) then
824 printlog( CFN & "The correct macro is displayed in the editwindow" )
829 if ( Instr ( GetClipboardText, "TTMacro2" ) <> 0 ) then
830 printlog( CFN & "The correct macro is displayed in the editwindow" )
835 if ( Instr ( GetClipboardText, "TTMacro3" ) <> 0 ) then
836 printlog( CFN & "The correct macro is displayed in the editwindow" )
847 '*******************************************************************************
849 function hCreateBasicWorkFiles() as string
851 '///<H3>Create a macro, attach it to a file, save the file</H3>
852 '///<i>Starting point: The first doc or any other plain document</i>
854 const CFN = "hCreateBasicWorkFiles::"
855 const CMACRO = "TestMacro"
863 sFile = hGetBasicWorkFile( "CURRENT" )
865 '///+<li>Open a new document</li>
866 call hCreateDocument()
868 '///+<li>Change the document (to save it)</li>
870 printlog( CFN & crc )
872 '///+<li>Open Basic-Organizer, select the document and create a module</li>
873 brc = hInitBasicIde( CMACRO )
875 printlog( CFN & "Unable to create a module, aborting" )
876 call hDestroyDocument()
877 hCreateBasicWorkFiles() = ""
881 '///+<li>Insert a macro that triggers a messagebox</li>
882 brc = hInsertMacro( 3 )
884 printlog( CFN & "Unable to insert macro, aborting" )
886 call hDestroyDocument()
887 hCreateBasicWorkFiles() = ""
891 '///+<li>Close the Basic-IDE</li>
892 brc = hCloseBasicIde()
894 '///+<li>Save the file without autoextension, overwrite existing</li>
895 brc = hFileSaveAsKill( sFile )
897 printlog( CFN & "Unknown error while saving the file. Resetting" )
898 call ExitRestartTheOffice
899 hCreateBasicWorkFiles() = ""
903 '///+<li>Close the document</li>
904 call hDestroyDocument()
911 '*******************************************************************************
913 function hIDESelectTabByIndex( iIndex as integer ) as string
915 use "global\tools\includes\optional\t_accels.inc"
918 '///<h3>Select a tab within the BASIC-IDE by index</h3>
919 '///<i>The BASIC-IDE has to be open and has the focus. This function
920 '///+ selects the tab by sending CTRL+PAGEUP or CTRL+PAGEDOWN to the IDE using
921 '///+ the .typeKeys method. It is assumed that - when opening the IDE - the
922 '///+ first tab is active. When the specified index has been reached we
923 '///+ retrieve the name of the current tab by opening the context menu on the
924 '///+ tab and selecting "Rename". The name (which should be
925 '///+ highlighted by default) is then copied to the clipboard and returned
926 '///+ to the calling function.</i><br><br>
928 '///<u>Parameter(s):</u><br>
931 '///+<li>Index of the requested Tab (Integer)</li>
933 '///+<li>Index must not be negative</li>
934 '///+<li>0 does nothing (returning the name of the current tab)</li>
935 '///+<li>Index must be ≤ present number of tabs</li>
936 '///+<li>If Index > number of tabs, the last tab is selected</li>
942 '///<u>Returns:</u><br>
944 '///+<li>Name of the selected tab (string)</li>
946 '///+<li>Always evaluate the returnvalue</li>
950 const CFN = "hIDESelectTabByIndex::"
951 printlog( CFN & "Enter with option: " & iIndex )
952 dim brc as boolean 'a multi purpose boolean returnvalue
954 dim cTabName as string
955 dim iCurrentTab as integer
958 '///<u>Description:</u>
960 '///+<li>Set context to BASIC IDE</li>
963 '///+<li>Retrieve the accelerator to switch tabs</li>
964 '///+<li>Switch tabs</li>
967 case 1 : cAccel = hGetAccel( "IDE_SWITCH_TAB-" )
969 BasicIDE.typeKeys( cAccel )
971 case else: cAccel = hGetAccel( "IDE_SWITCH_TAB+" )
972 for iTab = 1 to iIndex
973 BasicIDE.typeKeys( cAccel )
977 '///+<li>Select the Tabbar</li>
980 '///+<li>Open the context menu</li>
983 '///+<li>Select "Rename"</li>
986 '///+<li>Copy the selected string to the clipboard</li>
989 '///+<li>Send ESC to the tabbar to deselect the tab</li>
991 Tabbar.typeKeys( "<ESCAPE>" )
993 '///+<li>Copy the string from clipboard to a local variable</li>
994 cTabName = getClipboardText
996 '///+<li>Print exit message, set return value</li>
997 printlog( CFN & "Exit with result: " & cTabName )
998 hIDESelectTabByIndex() = cTabName