globalCommands.py 107 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170
# -*- coding: UTF-8 -*-
#globalCommands.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2006-2016 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Leonard de Ruijter, Derek Riemer

import time
import itertools
import tones
import audioDucking
import touchHandler
import keyboardHandler
import mouseHandler
import eventHandler
import review
import controlTypes
import api
import textInfos
import speech
import sayAllHandler
from NVDAObjects import NVDAObject, NVDAObjectTextInfo
import globalVars
from logHandler import log
from synthDriverHandler import *
import gui
import wx
import config
import winUser
import appModuleHandler
import winKernel
import treeInterceptorHandler
import browseMode
import scriptHandler
import ui
import braille
import brailleInput
import inputCore
import virtualBuffers
import characterProcessing
from baseObject import ScriptableObject

#: Script category for text review commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_TEXTREVIEW = _("Text review")
#: Script category for Object navigation commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_OBJECTNAVIGATION = _("Object navigation")
#: Script category for system caret commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_SYSTEMCARET = _("System caret")
#: Script category for mouse commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_MOUSE = _("Mouse")
#: Script category for speech commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_SPEECH = _("Speech")
#: Script category for configuration dialogs commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_CONFIG = _("Configuration")
#: Script category for Braille commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_BRAILLE = _("Braille")
#: Script category for tools commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_TOOLS = pgettext('script category', 'Tools')
#: Script category for touch commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_TOUCH = _("Touch screen")
#: Script category for focus commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_FOCUS = _("System focus")
#: Script category for system status commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_SYSTEM = _("System status")
#: Script category for input commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_INPUT = _("Input")
#: Script category for document formatting commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_DOCUMENTFORMATTING = _("Document formatting")

class GlobalCommands(ScriptableObject):
	"""Commands that are available at all times, regardless of the current focus.
	"""

	def script_cycleAudioDuckingMode(self,gesture):
		if not audioDucking.isAudioDuckingSupported():
			# Translators: a message when audio ducking is not supported on this machine
			ui.message(_("Audio ducking not supported"))
			return
		curMode=config.conf['audio']['audioDuckingMode']
		numModes=len(audioDucking.audioDuckingModes)
		nextMode=(curMode+1)%numModes
		audioDucking.setAudioDuckingMode(nextMode)
		config.conf['audio']['audioDuckingMode']=nextMode
		nextLabel=audioDucking.audioDuckingModes[nextMode]
		ui.message(nextLabel)
	# Translators: Describes the Cycle audio ducking mode command.
	script_cycleAudioDuckingMode.__doc__=_("Cycles through audio ducking modes which determine when NVDA lowers the volume of other sounds")

	def script_toggleInputHelp(self,gesture):
		inputCore.manager.isInputHelpActive = not inputCore.manager.isInputHelpActive
		# Translators: This will be presented when the input help is toggled.
		stateOn = _("input help on")
		# Translators: This will be presented when the input help is toggled.
		stateOff = _("input help off")
		state = stateOn if inputCore.manager.isInputHelpActive else stateOff
		ui.message(state)
	# Translators: Input help mode message for toggle input help command.
	script_toggleInputHelp.__doc__=_("Turns input help on or off. When on, any input such as pressing a key on the keyboard will tell you what script is associated with that input, if any.")
	script_toggleInputHelp.category=SCRCAT_INPUT

	def script_toggleCurrentAppSleepMode(self,gesture):
		curFocus=api.getFocusObject()
		curApp=curFocus.appModule
		if curApp.sleepMode:
			curApp.sleepMode=False
			# Translators: This is presented when sleep mode is deactivated, NVDA will continue working as expected.
			ui.message(_("Sleep mode off"))
			eventHandler.executeEvent("gainFocus",curFocus)
		else:
			eventHandler.executeEvent("loseFocus",curFocus)
			curApp.sleepMode=True
			# Translators: This is presented when sleep mode is activated, the focused application is self voicing, such as klango or openbook.
			ui.message(_("Sleep mode on"))
	# Translators: Input help mode message for toggle sleep mode command.
	script_toggleCurrentAppSleepMode.__doc__=_("Toggles  sleep mode on and off for  the active application.")
	script_toggleCurrentAppSleepMode.allowInSleepMode=True

	def script_reportCurrentLine(self,gesture):
		obj=api.getFocusObject()
		treeInterceptor=obj.treeInterceptor
		if isinstance(treeInterceptor,treeInterceptorHandler.DocumentTreeInterceptor) and not treeInterceptor.passThrough:
			obj=treeInterceptor
		try:
			info=obj.makeTextInfo(textInfos.POSITION_CARET)
		except (NotImplementedError, RuntimeError):
			info=obj.makeTextInfo(textInfos.POSITION_FIRST)
		info.expand(textInfos.UNIT_LINE)
		if scriptHandler.getLastScriptRepeatCount()==0:
			speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
		else:
			speech.speakSpelling(info.text)
	# Translators: Input help mode message for report current line command.
	script_reportCurrentLine.__doc__=_("Reports the current line under the application cursor. Pressing this key twice will spell the current line")
	script_reportCurrentLine.category=SCRCAT_SYSTEMCARET

	def script_leftMouseClick(self,gesture):
		# Translators: Reported when left mouse button is clicked.
		ui.message(_("Left click"))
		winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
		winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)
	# Translators: Input help mode message for left mouse click command.
	script_leftMouseClick.__doc__=_("Clicks the left mouse button once at the current mouse position")
	script_leftMouseClick.category=SCRCAT_MOUSE

	def script_rightMouseClick(self,gesture):
		# Translators: Reported when right mouse button is clicked.
		ui.message(_("Right click"))
		winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTDOWN,0,0,None,None)
		winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTUP,0,0,None,None)
	# Translators: Input help mode message for right mouse click command.
	script_rightMouseClick.__doc__=_("Clicks the right mouse button once at the current mouse position")
	script_rightMouseClick.category=SCRCAT_MOUSE

	def script_toggleLeftMouseButton(self,gesture):
		if winUser.getKeyState(winUser.VK_LBUTTON)&32768:
			# Translators: This is presented when the left mouse button lock is released (used for drag and drop).
			ui.message(_("Left mouse button unlock"))
			winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)
		else:
			# Translators: This is presented when the left mouse button is locked down (used for drag and drop).
			ui.message(_("Left mouse button lock"))
			winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
	# Translators: Input help mode message for left mouse lock/unlock toggle command.
	script_toggleLeftMouseButton.__doc__=_("Locks or unlocks the left mouse button")
	script_toggleLeftMouseButton.category=SCRCAT_MOUSE

	def script_toggleRightMouseButton(self,gesture):
		if winUser.getKeyState(winUser.VK_RBUTTON)&32768:
			# Translators: This is presented when the right mouse button lock is released (used for drag and drop).
			ui.message(_("Right mouse button unlock"))
			winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTUP,0,0,None,None)
		else:
			# Translators: This is presented when the right mouse button is locked down (used for drag and drop).
			ui.message(_("Right mouse button lock"))
			winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTDOWN,0,0,None,None)
	# Translators: Input help mode message for right mouse lock/unlock command.
	script_toggleRightMouseButton.__doc__=_("Locks or unlocks the right mouse button")
	script_toggleRightMouseButton.category=SCRCAT_MOUSE

	def script_reportCurrentSelection(self,gesture):
		obj=api.getFocusObject()
		treeInterceptor=obj.treeInterceptor
		if isinstance(treeInterceptor,treeInterceptorHandler.DocumentTreeInterceptor) and not treeInterceptor.passThrough:
			obj=treeInterceptor
		try:
			info=obj.makeTextInfo(textInfos.POSITION_SELECTION)
		except (RuntimeError, NotImplementedError):
			info=None
		if not info or info.isCollapsed:
			speech.speakMessage(_("No selection"))
		else:
			speech.speakMessage(_("Selected %s")%info.text)
	# Translators: Input help mode message for report current selection command.
	script_reportCurrentSelection.__doc__=_("Announces the current selection in edit controls and documents. If there is no selection it says so.")
	script_reportCurrentSelection.category=SCRCAT_SYSTEMCARET

	def script_dateTime(self,gesture):
		if scriptHandler.getLastScriptRepeatCount()==0:
			text=winKernel.GetTimeFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.TIME_NOSECONDS, None, None)
		else:
			text=winKernel.GetDateFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.DATE_LONGDATE, None, None)
		ui.message(text)
	# Translators: Input help mode message for report date and time command.
	script_dateTime.__doc__=_("If pressed once, reports the current time. If pressed twice, reports the current date")
	script_dateTime.category=SCRCAT_SYSTEM

	def script_increaseSynthSetting(self,gesture):
		settingName=globalVars.settingsRing.currentSettingName
		if not settingName:
			# Translators: Reported when there are no settings to configure in synth settings ring (example: when there is no setting for language).
			ui.message(_("No settings"))
			return
		settingValue=globalVars.settingsRing.increase()
		ui.message("%s %s" % (settingName,settingValue))
	# Translators: Input help mode message for increase synth setting value command.
	script_increaseSynthSetting.__doc__=_("Increases the currently active setting in the synth settings ring")
	script_increaseSynthSetting.category=SCRCAT_SPEECH

	def script_decreaseSynthSetting(self,gesture):
		settingName=globalVars.settingsRing.currentSettingName
		if not settingName:
			ui.message(_("No settings"))
			return
		settingValue=globalVars.settingsRing.decrease()
		ui.message("%s %s" % (settingName,settingValue))
	# Translators: Input help mode message for decrease synth setting value command.
	script_decreaseSynthSetting.__doc__=_("Decreases the currently active setting in the synth settings ring")
	script_decreaseSynthSetting.category=SCRCAT_SPEECH

	def script_nextSynthSetting(self,gesture):
		nextSettingName=globalVars.settingsRing.next()
		if not nextSettingName:
			ui.message(_("No settings"))
			return
		nextSettingValue=globalVars.settingsRing.currentSettingValue
		ui.message("%s %s"%(nextSettingName,nextSettingValue))
	# Translators: Input help mode message for next synth setting command.
	script_nextSynthSetting.__doc__=_("Moves to the next available setting in the synth settings ring")
	script_nextSynthSetting.category=SCRCAT_SPEECH

	def script_previousSynthSetting(self,gesture):
		previousSettingName=globalVars.settingsRing.previous()
		if not previousSettingName:
			ui.message(_("No settings"))
			return
		previousSettingValue=globalVars.settingsRing.currentSettingValue
		ui.message("%s %s"%(previousSettingName,previousSettingValue))
	# Translators: Input help mode message for previous synth setting command.
	script_previousSynthSetting.__doc__=_("Moves to the previous available setting in the synth settings ring")
	script_previousSynthSetting.category=SCRCAT_SPEECH

	def script_toggleSpeakTypedCharacters(self,gesture):
		if config.conf["keyboard"]["speakTypedCharacters"]:
			# Translators: The message announced when toggling the speak typed characters keyboard setting.
			state = _("speak typed characters off")
			config.conf["keyboard"]["speakTypedCharacters"]=False
		else:
			# Translators: The message announced when toggling the speak typed characters keyboard setting.
			state = _("speak typed characters on")
			config.conf["keyboard"]["speakTypedCharacters"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle speaked typed characters command.
	script_toggleSpeakTypedCharacters.__doc__=_("Toggles on and off the speaking of typed characters")
	script_toggleSpeakTypedCharacters.category=SCRCAT_SPEECH

	def script_toggleSpeakTypedWords(self,gesture):
		if config.conf["keyboard"]["speakTypedWords"]:
			# Translators: The message announced when toggling the speak typed words keyboard setting.
			state = _("speak typed words off")
			config.conf["keyboard"]["speakTypedWords"]=False
		else:
			# Translators: The message announced when toggling the speak typed words keyboard setting.
			state = _("speak typed words on")
			config.conf["keyboard"]["speakTypedWords"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle speak typed words command.
	script_toggleSpeakTypedWords.__doc__=_("Toggles on and off the speaking of typed words")
	script_toggleSpeakTypedWords.category=SCRCAT_SPEECH

	def script_toggleSpeakCommandKeys(self,gesture):
		if config.conf["keyboard"]["speakCommandKeys"]:
			# Translators: The message announced when toggling the speak typed command keyboard setting.
			state = _("speak command keys off")
			config.conf["keyboard"]["speakCommandKeys"]=False
		else:
			# Translators: The message announced when toggling the speak typed command keyboard setting.
			state = _("speak command keys on")
			config.conf["keyboard"]["speakCommandKeys"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle speak command keys command.
	script_toggleSpeakCommandKeys.__doc__=_("Toggles on and off the speaking of typed keys, that are not specifically characters")
	script_toggleSpeakCommandKeys.category=SCRCAT_SPEECH

	def script_toggleReportFontName(self,gesture):
		if config.conf["documentFormatting"]["reportFontName"]:
			# Translators: The message announced when toggling the report font name document formatting setting.
			state = _("report font name off")
			config.conf["documentFormatting"]["reportFontName"]=False
		else:
			# Translators: The message announced when toggling the report font name document formatting setting.
			state = _("report font name on")
			config.conf["documentFormatting"]["reportFontName"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report font name command.
	script_toggleReportFontName.__doc__=_("Toggles on and off the reporting of font changes")
	script_toggleReportFontName.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportFontSize(self,gesture):
		if config.conf["documentFormatting"]["reportFontSize"]:
			# Translators: The message announced when toggling the report font size document formatting setting.
			state = _("report font size off")
			config.conf["documentFormatting"]["reportFontSize"]=False
		else:
			# Translators: The message announced when toggling the report font size document formatting setting.
			state = _("report font size on")
			config.conf["documentFormatting"]["reportFontSize"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report font size command.
	script_toggleReportFontSize.__doc__=_("Toggles on and off the reporting of font size changes")
	script_toggleReportFontSize.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportFontAttributes(self,gesture):
		if config.conf["documentFormatting"]["reportFontAttributes"]:
			# Translators: The message announced when toggling the report font attributes document formatting setting.
			state = _("report font attributes off")
			config.conf["documentFormatting"]["reportFontAttributes"]=False
		else:
			# Translators: The message announced when toggling the report font attributes document formatting setting.
			state = _("report font attributes on")
			config.conf["documentFormatting"]["reportFontAttributes"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report font attributes command.
	script_toggleReportFontAttributes.__doc__=_("Toggles on and off the reporting of font attributes")
	script_toggleReportFontAttributes.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportRevisions(self,gesture):
		if config.conf["documentFormatting"]["reportRevisions"]:
			# Translators: The message announced when toggling the report revisions document formatting setting.
			state = _("report revisions off")
			config.conf["documentFormatting"]["reportRevisions"]=False
		else:
			# Translators: The message announced when toggling the report revisions document formatting setting.
			state = _("report revisions on")
			config.conf["documentFormatting"]["reportRevisions"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report revisions command.
	script_toggleReportRevisions.__doc__=_("Toggles on and off the reporting of revisions")
	script_toggleReportRevisions.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportEmphasis(self,gesture):
		if config.conf["documentFormatting"]["reportEmphasis"]:
			# Translators: The message announced when toggling the report emphasis document formatting setting.
			state = _("report emphasis off")
			config.conf["documentFormatting"]["reportEmphasis"]=False
		else:
			# Translators: The message announced when toggling the report emphasis document formatting setting.
			state = _("report emphasis on")
			config.conf["documentFormatting"]["reportEmphasis"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report emphasis command.
	script_toggleReportEmphasis.__doc__=_("Toggles on and off the reporting of emphasis")
	script_toggleReportEmphasis.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportColor(self,gesture):
		if config.conf["documentFormatting"]["reportColor"]:
			# Translators: The message announced when toggling the report colors document formatting setting.
			state = _("report colors off")
			config.conf["documentFormatting"]["reportColor"]=False
		else:
			# Translators: The message announced when toggling the report colors document formatting setting.
			state = _("report colors on")
			config.conf["documentFormatting"]["reportColor"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report colors command.
	script_toggleReportColor.__doc__=_("Toggles on and off the reporting of colors")
	script_toggleReportColor.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportAlignment(self,gesture):
		if config.conf["documentFormatting"]["reportAlignment"]:
			# Translators: The message announced when toggling the report alignment document formatting setting.
			state = _("report alignment off")
			config.conf["documentFormatting"]["reportAlignment"]=False
		else:
			# Translators: The message announced when toggling the report alignment document formatting setting.
			state = _("report alignment on")
			config.conf["documentFormatting"]["reportAlignment"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report alignment command.
	script_toggleReportAlignment.__doc__=_("Toggles on and off the reporting of text alignment")
	script_toggleReportAlignment.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportStyle(self,gesture):
		if config.conf["documentFormatting"]["reportStyle"]:
			# Translators: The message announced when toggling the report style document formatting setting.
			state = _("report style off")
			config.conf["documentFormatting"]["reportStyle"]=False
		else:
			# Translators: The message announced when toggling the report style document formatting setting.
			state = _("report style on")
			config.conf["documentFormatting"]["reportStyle"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report style command.
	script_toggleReportStyle.__doc__=_("Toggles on and off the reporting of style changes")
	script_toggleReportStyle.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportSpellingErrors(self,gesture):
		if config.conf["documentFormatting"]["reportSpellingErrors"]:
			# Translators: The message announced when toggling the report spelling errors document formatting setting.
			state = _("report spelling errors off")
			config.conf["documentFormatting"]["reportSpellingErrors"]=False
		else:
			# Translators: The message announced when toggling the report spelling errors document formatting setting.
			state = _("report spelling errors on")
			config.conf["documentFormatting"]["reportSpellingErrors"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report spelling errors command.
	script_toggleReportSpellingErrors.__doc__=_("Toggles on and off the reporting of spelling errors")
	script_toggleReportSpellingErrors.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportPage(self,gesture):
		if config.conf["documentFormatting"]["reportPage"]:
			# Translators: The message announced when toggling the report pages document formatting setting.
			state = _("report pages off")
			config.conf["documentFormatting"]["reportPage"]=False
		else:
			# Translators: The message announced when toggling the report pages document formatting setting.
			state = _("report pages on")
			config.conf["documentFormatting"]["reportPage"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report pages command.
	script_toggleReportPage.__doc__=_("Toggles on and off the reporting of pages")
	script_toggleReportPage.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportLineNumber(self,gesture):
		if config.conf["documentFormatting"]["reportLineNumber"]:
			# Translators: The message announced when toggling the report line numbers document formatting setting.
			state = _("report line numbers off")
			config.conf["documentFormatting"]["reportLineNumber"]=False
		else:
			# Translators: The message announced when toggling the report line numbers document formatting setting.
			state = _("report line numbers on")
			config.conf["documentFormatting"]["reportLineNumber"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report line numbers command.
	script_toggleReportLineNumber.__doc__=_("Toggles on and off the reporting of line numbers")
	script_toggleReportLineNumber.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportLineIndentation(self,gesture):
		if config.conf["documentFormatting"]["reportLineIndentation"]:
			# Translators: The message announced when toggling the report line indentation document formatting setting.
			state = _("report line indentation off")
			config.conf["documentFormatting"]["reportLineIndentation"]=False
		else:
			# Translators: The message announced when toggling the report line indentation document formatting setting.
			state = _("report line indentation on")
			config.conf["documentFormatting"]["reportLineIndentation"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report line indentation command.
	script_toggleReportLineIndentation.__doc__=_("Toggles on and off the reporting of line indentation")
	script_toggleReportLineIndentation.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportParagraphIndentation(self,gesture):
		if config.conf["documentFormatting"]["reportParagraphIndentation"]:
			# Translators: The message announced when toggling the report paragraph indentation document formatting setting.
			state = _("report paragraph indentation off")
			config.conf["documentFormatting"]["reportParagraphIndentation"]=False
		else:
			# Translators: The message announced when toggling the report paragraph indentation document formatting setting.
			state = _("report paragraph indentation on")
			config.conf["documentFormatting"]["reportParagraphIndentation"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report paragraph indentation command.
	script_toggleReportParagraphIndentation.__doc__=_("Toggles on and off the reporting of paragraph indentation")
	script_toggleReportParagraphIndentation.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportLineSpacing(self,gesture):
		if config.conf["documentFormatting"]["reportLineSpacing"]:
			# Translators: The message announced when toggling the report line spacing document formatting setting.
			state = _("report line spacing off")
			config.conf["documentFormatting"]["reportLineSpacing"]=False
		else:
			# Translators: The message announced when toggling the report line spacing document formatting setting.
			state = _("report line spacing on")
			config.conf["documentFormatting"]["reportLineSpacing"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report line spacing command.
	script_toggleReportLineSpacing.__doc__=_("Toggles on and off the reporting of line spacing")
	script_toggleReportLineSpacing.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportTables(self,gesture):
		if config.conf["documentFormatting"]["reportTables"]:
			# Translators: The message announced when toggling the report tables document formatting setting.
			state = _("report tables off")
			config.conf["documentFormatting"]["reportTables"]=False
		else:
			# Translators: The message announced when toggling the report tables document formatting setting.
			state = _("report tables on")
			config.conf["documentFormatting"]["reportTables"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report tables command.
	script_toggleReportTables.__doc__=_("Toggles on and off the reporting of tables")
	script_toggleReportTables.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportTableHeaders(self,gesture):
		if config.conf["documentFormatting"]["reportTableHeaders"]:
			# Translators: The message announced when toggling the report table row/column headers document formatting setting.
			state = _("report table row and column headers off")
			config.conf["documentFormatting"]["reportTableHeaders"]=False
		else:
			# Translators: The message announced when toggling the report table row/column headers document formatting setting.
			state = _("report table row and column headers on")
			config.conf["documentFormatting"]["reportTableHeaders"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report table row/column headers command.
	script_toggleReportTableHeaders.__doc__=_("Toggles on and off the reporting of table row and column headers")
	script_toggleReportTableHeaders.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportTableCellCoords(self,gesture):
		if config.conf["documentFormatting"]["reportTableCellCoords"]:
			# Translators: The message announced when toggling the report table cell coordinates document formatting setting.
			state = _("report table cell coordinates off")
			config.conf["documentFormatting"]["reportTableCellCoords"]=False
		else:
			# Translators: The message announced when toggling the report table cell coordinates document formatting setting.
			state = _("report table cell coordinates on")
			config.conf["documentFormatting"]["reportTableCellCoords"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report table cell coordinates command.
	script_toggleReportTableCellCoords.__doc__=_("Toggles on and off the reporting of table cell coordinates")
	script_toggleReportTableCellCoords.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportLinks(self,gesture):
		if config.conf["documentFormatting"]["reportLinks"]:
			# Translators: The message announced when toggling the report links document formatting setting.
			state = _("report links off")
			config.conf["documentFormatting"]["reportLinks"]=False
		else:
			# Translators: The message announced when toggling the report links document formatting setting.
			state = _("report links on")
			config.conf["documentFormatting"]["reportLinks"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report links command.
	script_toggleReportLinks.__doc__=_("Toggles on and off the reporting of links")
	script_toggleReportLinks.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportComments(self,gesture):
		if config.conf["documentFormatting"]["reportComments"]:
			# Translators: The message announced when toggling the report comments document formatting setting.
			state = _("report comments off")
			config.conf["documentFormatting"]["reportComments"]=False
		else:
			# Translators: The message announced when toggling the report comments document formatting setting.
			state = _("report comments on")
			config.conf["documentFormatting"]["reportComments"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report comments command.
	script_toggleReportComments.__doc__=_("Toggles on and off the reporting of comments")
	script_toggleReportComments.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportLists(self,gesture):
		if config.conf["documentFormatting"]["reportLists"]:
			# Translators: The message announced when toggling the report lists document formatting setting.
			state = _("report lists off")
			config.conf["documentFormatting"]["reportLists"]=False
		else:
			# Translators: The message announced when toggling the report lists document formatting setting.
			state = _("report lists on")
			config.conf["documentFormatting"]["reportLists"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report lists command.
	script_toggleReportLists.__doc__=_("Toggles on and off the reporting of lists")
	script_toggleReportLists.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportHeadings(self,gesture):
		if config.conf["documentFormatting"]["reportHeadings"]:
			# Translators: The message announced when toggling the report headings document formatting setting.
			state = _("report headings off")
			config.conf["documentFormatting"]["reportHeadings"]=False
		else:
			# Translators: The message announced when toggling the report headings document formatting setting.
			state = _("report headings on")
			config.conf["documentFormatting"]["reportHeadings"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report headings command.
	script_toggleReportHeadings.__doc__=_("Toggles on and off the reporting of headings")
	script_toggleReportHeadings.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportBlockQuotes(self,gesture):
		if config.conf["documentFormatting"]["reportBlockQuotes"]:
			# Translators: The message announced when toggling the report block quotes document formatting setting.
			state = _("report block quotes off")
			config.conf["documentFormatting"]["reportBlockQuotes"]=False
		else:
			# Translators: The message announced when toggling the report block quotes document formatting setting.
			state = _("report block quotes on")
			config.conf["documentFormatting"]["reportBlockQuotes"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report block quotes command.
	script_toggleReportBlockQuotes.__doc__=_("Toggles on and off the reporting of block quotes")
	script_toggleReportBlockQuotes.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportLandmarks(self,gesture):
		if config.conf["documentFormatting"]["reportLandmarks"]:
			# Translators: The message announced when toggling the report landmarks document formatting setting.
			state = _("report landmarks off")
			config.conf["documentFormatting"]["reportLandmarks"]=False
		else:
			# Translators: The message announced when toggling the report landmarks document formatting setting.
			state = _("report landmarks on")
			config.conf["documentFormatting"]["reportLandmarks"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report landmarks command.
	script_toggleReportLandmarks.__doc__=_("Toggles on and off the reporting of landmarks")
	script_toggleReportLandmarks.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportFrames(self,gesture):
		if config.conf["documentFormatting"]["reportFrames"]:
			# Translators: The message announced when toggling the report frames document formatting setting.
			state = _("report frames off")
			config.conf["documentFormatting"]["reportFrames"]=False
		else:
			# Translators: The message announced when toggling the report frames document formatting setting.
			state = _("report frames on")
			config.conf["documentFormatting"]["reportFrames"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report frames command.
	script_toggleReportFrames.__doc__=_("Toggles on and off the reporting of frames")
	script_toggleReportFrames.category=SCRCAT_DOCUMENTFORMATTING

	def script_toggleReportClickable(self,gesture):
		if config.conf["documentFormatting"]["reportClickable"]:
			# Translators: The message announced when toggling the report if clickable document formatting setting.
			state = _("report if clickable off")
			config.conf["documentFormatting"]["reportClickable"]=False
		else:
			# Translators: The message announced when toggling the report if clickable document formatting setting.
			state = _("report if clickable on")
			config.conf["documentFormatting"]["reportClickable"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle report if clickable command.
	script_toggleReportClickable.__doc__=_("Toggles on and off reporting if clickable")
	script_toggleReportClickable.category=SCRCAT_DOCUMENTFORMATTING

	def script_cycleSpeechSymbolLevel(self,gesture):
		curLevel = config.conf["speech"]["symbolLevel"]
		for level in characterProcessing.CONFIGURABLE_SPEECH_SYMBOL_LEVELS:
			if level > curLevel:
				break
		else:
			level = characterProcessing.SYMLVL_NONE
		name = characterProcessing.SPEECH_SYMBOL_LEVEL_LABELS[level]
		config.conf["speech"]["symbolLevel"] = level
		# Translators: Reported when the user cycles through speech symbol levels
		# which determine what symbols are spoken.
		# %s will be replaced with the symbol level; e.g. none, some, most and all.
		ui.message(_("Symbol level %s") % name)
	# Translators: Input help mode message for cycle speech symbol level command.
	script_cycleSpeechSymbolLevel.__doc__=_("Cycles through speech symbol levels which determine what symbols are spoken")
	script_cycleSpeechSymbolLevel.category=SCRCAT_SPEECH

	def script_moveMouseToNavigatorObject(self,gesture):
		obj=api.getNavigatorObject() 
		try:
			p=api.getReviewPosition().pointAtStart
		except (NotImplementedError, LookupError):
			p=None
		if p:
			x=p.x
			y=p.y
		else:
			try:
				(left,top,width,height)=obj.location
			except:
				# Translators: Reported when the object has no location for the mouse to move to it.
				ui.message(_("Object has no location"))
				return
			x=left+(width/2)
			y=top+(height/2)
		winUser.setCursorPos(x,y)
		mouseHandler.executeMouseMoveEvent(x,y)
	# Translators: Input help mode message for move mouse to navigator object command.
	script_moveMouseToNavigatorObject.__doc__=_("Moves the mouse pointer to the current navigator object")
	script_moveMouseToNavigatorObject.category=SCRCAT_MOUSE

	def script_moveNavigatorObjectToMouse(self,gesture):
		# Translators: Reported when attempting to move the navigator object to the object under mouse pointer.
		ui.message(_("Move navigator object to mouse"))
		obj=api.getMouseObject()
		api.setNavigatorObject(obj)
		speech.speakObject(obj)
	# Translators: Input help mode message for move navigator object to mouse command.
	script_moveNavigatorObjectToMouse.__doc__=_("Sets the navigator object to the current object under the mouse pointer and speaks it")
	script_moveNavigatorObjectToMouse.category=SCRCAT_MOUSE

	def script_reviewMode_next(self,gesture):
		label=review.nextMode()
		if label:
			ui.message(label)
			pos=api.getReviewPosition().copy()
			pos.expand(textInfos.UNIT_LINE)
			speech.speakTextInfo(pos)
		else:
			# Translators: reported when there are no other available review modes for this object 
			ui.message(_("No next review mode"))
	# Translators: Script help message for next review mode command.
	script_reviewMode_next.__doc__=_("Switches to the next review mode (e.g. object, document or screen) and positions the review position at the point of the navigator object")
	script_reviewMode_next.category=SCRCAT_TEXTREVIEW

	def script_reviewMode_previous(self,gesture):
		label=review.nextMode(prev=True)
		if label:
			ui.message(label)
			pos=api.getReviewPosition().copy()
			pos.expand(textInfos.UNIT_LINE)
			speech.speakTextInfo(pos)
		else:
			# Translators: reported when there are no  other available review modes for this object 
			ui.message(_("No previous review mode"))
	# Translators: Script help message for previous review mode command.
	script_reviewMode_previous.__doc__=_("Switches to the previous review mode (e.g. object, document or screen) and positions the review position at the point of the navigator object") 
	script_reviewMode_previous.category=SCRCAT_TEXTREVIEW

	def script_toggleSimpleReviewMode(self,gesture):
		if config.conf["reviewCursor"]["simpleReviewMode"]:
			# Translators: The message announced when toggling simple review mode.
			state = _("Simple review mode off")
			config.conf["reviewCursor"]["simpleReviewMode"]=False
		else:
			# Translators: The message announced when toggling simple review mode.
			state = _("Simple review mode on")
			config.conf["reviewCursor"]["simpleReviewMode"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle simple review mode command.
	script_toggleSimpleReviewMode.__doc__=_("Toggles simple review mode on and off")
	script_toggleSimpleReviewMode.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_current(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			# Translators: Reported when the user tries to perform a command related to the navigator object
			# but there is no current navigator object.
			speech.speakMessage(_("No navigator object"))
			return
		if scriptHandler.getLastScriptRepeatCount()>=1:
			if curObject.TextInfo!=NVDAObjectTextInfo:
				textList=[]
				if curObject.name and isinstance(curObject.name, basestring) and not curObject.name.isspace():
					textList.append(curObject.name)
				try:
					info=curObject.makeTextInfo(textInfos.POSITION_SELECTION)
					if not info.isCollapsed:
						textList.append(info.text)
					else:
						info.expand(textInfos.UNIT_LINE)
						if not info.isCollapsed:
							textList.append(info.text)
				except (RuntimeError, NotImplementedError):
					# No caret or selection on this object.
					pass
			else:
				textList=[prop for prop in (curObject.name, curObject.value) if prop and isinstance(prop, basestring) and not prop.isspace()]
			text=" ".join(textList)
			if len(text)>0 and not text.isspace():
				if scriptHandler.getLastScriptRepeatCount()==1:
					speech.speakSpelling(text)
				else:
					if api.copyToClip(text):
						# Translators: Indicates something has been copied to clipboard (example output: title text copied to clipboard).
						speech.speakMessage(_("%s copied to clipboard")%text)
		else:
			speech.speakObject(curObject,reason=controlTypes.REASON_QUERY)
	# Translators: Input help mode message for report current navigator object command.
	script_navigatorObject_current.__doc__=_("Reports the current navigator object. Pressing twice spells this information, and pressing three times Copies name and value of this  object to the clipboard")
	script_navigatorObject_current.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_currentDimensions(self,gesture):
		count=scriptHandler.getLastScriptRepeatCount()
		locationText=api.getReviewPosition().locationText if count==0 else None
		if not locationText:
			locationText=api.getNavigatorObject().locationText
		if not locationText:
			# Translators: message when there is no location information for the review cursor
			ui.message(_("No location information"))
			return
		ui.message(locationText)
	# Translators: Description for report review cursor location command.
	script_navigatorObject_currentDimensions.__doc__=_("Reports information about the location of the text or object at the review cursor. Pressing twice may provide further detail.") 
	script_navigatorObject_currentDimensions.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_toFocus(self,gesture):
		obj=api.getFocusObject()
		try:
			pos=obj.makeTextInfo(textInfos.POSITION_CARET)
		except (NotImplementedError,RuntimeError):
			pos=obj.makeTextInfo(textInfos.POSITION_FIRST)
		api.setReviewPosition(pos)
		# Translators: Reported when attempting to move the navigator object to focus.
		speech.speakMessage(_("Move to focus"))
		speech.speakObject(obj,reason=controlTypes.REASON_FOCUS)
	# Translators: Input help mode message for move navigator object to current focus command.
	script_navigatorObject_toFocus.__doc__=_("Sets the navigator object to the current focus, and the review cursor to the position of the caret inside it, if possible.")
	script_navigatorObject_toFocus.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_moveFocus(self,gesture):
		obj=api.getNavigatorObject()
		if not isinstance(obj,NVDAObject):
			# Translators: Reported when:
			# 1. There is no focusable object e.g. cannot use tab and shift tab to move to controls.
			# 2. Trying to move focus to navigator object but there is no focus.
			ui.message(_("No focus"))
		if scriptHandler.getLastScriptRepeatCount()==0:
			# Translators: Reported when attempting to move focus to navigator object.
			ui.message(_("Move focus"))
			obj.setFocus()
		else:
			review=api.getReviewPosition()
			try:
				review.updateCaret()
			except NotImplementedError:
				# Translators: Reported when trying to move caret to the position of the review cursor but there is no caret.
				ui.message(_("No caret"))
				return
			info=review.copy()
			info.expand(textInfos.UNIT_LINE)
			speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move focus to current navigator object command.
	script_navigatorObject_moveFocus.__doc__=_("Pressed once sets the keyboard focus to the navigator object, pressed twice sets the system caret to the position of the review cursor")
	script_navigatorObject_moveFocus.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_parent(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			# Translators: Reported when the user tries to perform a command related to the navigator object
			# but there is no current navigator object.
			ui.reviewMessage(_("No navigator object"))
			return
		simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
		curObject=curObject.simpleParent if simpleReviewMode else curObject.parent
		if curObject is not None:
			api.setNavigatorObject(curObject)
			speech.speakObject(curObject,reason=controlTypes.REASON_FOCUS)
		else:
			# Translators: Reported when there is no containing (parent) object such as when focused on desktop.
			ui.reviewMessage(_("No containing object"))
	# Translators: Input help mode message for move to parent object command.
	script_navigatorObject_parent.__doc__=_("Moves the navigator object to the object containing it")
	script_navigatorObject_parent.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_next(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			# Translators: Reported when the user tries to perform a command related to the navigator object
			# but there is no current navigator object.
			ui.reviewMessage(_("No navigator object"))
			return
		simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
		curObject=curObject.simpleNext if simpleReviewMode else curObject.next
		if curObject is not None:
			api.setNavigatorObject(curObject)
			speech.speakObject(curObject,reason=controlTypes.REASON_FOCUS)
		else:
			# Translators: Reported when there is no next object (current object is the last object).
			ui.reviewMessage(_("No next"))
	# Translators: Input help mode message for move to next object command.
	script_navigatorObject_next.__doc__=_("Moves the navigator object to the next object")
	script_navigatorObject_next.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_previous(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			# Translators: Reported when the user tries to perform a command related to the navigator object
			# but there is no current navigator object.
			ui.reviewMessage(_("No navigator object"))
			return
		simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
		curObject=curObject.simplePrevious if simpleReviewMode else curObject.previous
		if curObject is not None:
			api.setNavigatorObject(curObject)
			speech.speakObject(curObject,reason=controlTypes.REASON_FOCUS)
		else:
			# Translators: Reported when there is no previous object (current object is the first object).
			ui.reviewMessage(_("No previous"))
	# Translators: Input help mode message for move to previous object command.
	script_navigatorObject_previous.__doc__=_("Moves the navigator object to the previous object")
	script_navigatorObject_previous.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_firstChild(self,gesture):
		curObject=api.getNavigatorObject()
		if not isinstance(curObject,NVDAObject):
			# Translators: Reported when the user tries to perform a command related to the navigator object
			# but there is no current navigator object.
			ui.reviewMessage(_("No navigator object"))
			return
		simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
		curObject=curObject.simpleFirstChild if simpleReviewMode else curObject.firstChild
		if curObject is not None:
			api.setNavigatorObject(curObject)
			speech.speakObject(curObject,reason=controlTypes.REASON_FOCUS)
		else:
			# Translators: Reported when there is no contained (first child) object such as inside a document.
			ui.reviewMessage(_("No objects inside"))
	# Translators: Input help mode message for move to first child object command.
	script_navigatorObject_firstChild.__doc__=_("Moves the navigator object to the first object inside it")
	script_navigatorObject_firstChild.category=SCRCAT_OBJECTNAVIGATION

	def script_review_activate(self,gesture):
		# Translators: a message reported when the action at the position of the review cursor or navigator object is performed.
		actionName=_("Activate")
		pos=api.getReviewPosition()
		try:
			pos.activate()
			if isinstance(gesture,touchHandler.TouchInputGesture):
				touchHandler.handler.notifyInteraction(pos.NVDAObjectAtStart)
			ui.message(actionName)
			return
		except NotImplementedError:
			pass
		obj=api.getNavigatorObject()
		while obj:
			realActionName=actionName
			try:
				realActionName=obj.getActionName()
			except:
				pass
			try:
				obj.doAction()
				if isinstance(gesture,touchHandler.TouchInputGesture):
					touchHandler.handler.notifyInteraction(obj)
				ui.message(realActionName)
				return
			except NotImplementedError:
				pass
			obj=obj.parent
		# Translators: the message reported when there is no action to perform on the review position or navigator object.
		ui.message(_("No action"))
	# Translators: Input help mode message for activate current object command.
	script_review_activate.__doc__=_("Performs the default action on the current navigator object (example: presses it if it is a button).")
	script_review_activate.category=SCRCAT_OBJECTNAVIGATION

	def script_review_top(self,gesture):
		info=api.getReviewPosition().obj.makeTextInfo(textInfos.POSITION_FIRST)
		api.setReviewPosition(info)
		info.expand(textInfos.UNIT_LINE)
		speech.speakMessage(_("Top"))
		speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move review cursor to top line command.
	script_review_top.__doc__=_("Moves the review cursor to the top line of the current navigator object and speaks it")
	script_review_top.category=SCRCAT_TEXTREVIEW

	def script_review_previousLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		info.collapse()
		res=info.move(textInfos.UNIT_LINE,-1)
		if res==0:
			# Translators: a message reported when review cursor is at the top line of the current navigator object.
			ui.reviewMessage(_("Top"))
		else:
			api.setReviewPosition(info)
		info.expand(textInfos.UNIT_LINE)
		speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move review cursor to previous line command.
	script_review_previousLine.__doc__=_("Moves the review cursor to the previous line of the current navigator object and speaks it")
	script_review_previousLine.resumeSayAllMode=sayAllHandler.CURSOR_REVIEW
	script_review_previousLine.category=SCRCAT_TEXTREVIEW

	def script_review_currentLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		scriptCount=scriptHandler.getLastScriptRepeatCount()
		if scriptCount==0:
			speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
		else:
			speech.spellTextInfo(info,useCharacterDescriptions=scriptCount>1)
	# Translators: Input help mode message for read current line under review cursor command.
	script_review_currentLine.__doc__=_("Reports the line of the current navigator object where the review cursor is situated. If this key is pressed twice, the current line will be spelled. Pressing three times will spell the line using character descriptions.")
	script_review_currentLine.category=SCRCAT_TEXTREVIEW
 
	def script_review_nextLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		info.collapse()
		res=info.move(textInfos.UNIT_LINE,1)
		if res==0:
			# Translators: a message reported when review cursor is at the bottom line of the current navigator object.
			ui.reviewMessage(_("Bottom"))
		else:
			api.setReviewPosition(info)
		info.expand(textInfos.UNIT_LINE)
		speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move review cursor to next line command.
	script_review_nextLine.__doc__=_("Moves the review cursor to the next line of the current navigator object and speaks it")
	script_review_nextLine.resumeSayAllMode=sayAllHandler.CURSOR_REVIEW
	script_review_nextLine.category=SCRCAT_TEXTREVIEW

	def script_review_bottom(self,gesture):
		info=api.getReviewPosition().obj.makeTextInfo(textInfos.POSITION_LAST)
		api.setReviewPosition(info)
		info.expand(textInfos.UNIT_LINE)
		speech.speakMessage(_("Bottom"))
		speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move review cursor to bottom line command.
	script_review_bottom.__doc__=_("Moves the review cursor to the bottom line of the current navigator object and speaks it")
	script_review_bottom.category=SCRCAT_TEXTREVIEW

	def script_review_previousWord(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_WORD)
		info.collapse()
		res=info.move(textInfos.UNIT_WORD,-1)
		if res==0:
			# Translators: a message reported when review cursor is at the top line of the current navigator object.
			ui.reviewMessage(_("Top"))
		else:
			api.setReviewPosition(info)
		info.expand(textInfos.UNIT_WORD)
		speech.speakTextInfo(info,reason=controlTypes.REASON_CARET,unit=textInfos.UNIT_WORD)
	# Translators: Input help mode message for move review cursor to previous word command.
	script_review_previousWord.__doc__=_("Moves the review cursor to the previous word of the current navigator object and speaks it")
	script_review_previousWord.category=SCRCAT_TEXTREVIEW

	def script_review_currentWord(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_WORD)
		scriptCount=scriptHandler.getLastScriptRepeatCount()
		if scriptCount==0:
			speech.speakTextInfo(info,reason=controlTypes.REASON_CARET,unit=textInfos.UNIT_WORD)
		else:
			speech.spellTextInfo(info,useCharacterDescriptions=scriptCount>1)
	# Translators: Input help mode message for report current word under review cursor command.
	script_review_currentWord.__doc__=_("Speaks the word of the current navigator object where the review cursor is situated. Pressing twice spells the word. Pressing three times spells the word using character descriptions")
	script_review_currentWord.category=SCRCAT_TEXTREVIEW

	def script_review_nextWord(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_WORD)
		info.collapse()
		res=info.move(textInfos.UNIT_WORD,1)
		if res==0:
			# Translators: a message reported when review cursor is at the bottom line of the current navigator object.
			ui.reviewMessage(_("Bottom"))
		else:
			api.setReviewPosition(info)
		info.expand(textInfos.UNIT_WORD)
		speech.speakTextInfo(info,reason=controlTypes.REASON_CARET,unit=textInfos.UNIT_WORD)
	# Translators: Input help mode message for move review cursor to next word command.
	script_review_nextWord.__doc__=_("Moves the review cursor to the next word of the current navigator object and speaks it")
	script_review_nextWord.category=SCRCAT_TEXTREVIEW

	def script_review_startOfLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		info.collapse()
		api.setReviewPosition(info)
		info.expand(textInfos.UNIT_CHARACTER)
		speech.speakMessage(_("Left"))
		speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move review cursor to start of current line command.
	script_review_startOfLine.__doc__=_("Moves the review cursor to the first character of the line where it is situated in the current navigator object and speaks it")
	script_review_startOfLine.category=SCRCAT_TEXTREVIEW

	def script_review_previousCharacter(self,gesture):
		lineInfo=api.getReviewPosition().copy()
		lineInfo.expand(textInfos.UNIT_LINE)
		charInfo=api.getReviewPosition().copy()
		charInfo.expand(textInfos.UNIT_CHARACTER)
		charInfo.collapse()
		res=charInfo.move(textInfos.UNIT_CHARACTER,-1)
		if res==0 or charInfo.compareEndPoints(lineInfo,"startToStart")<0:
			# Translators: a message reported when review cursor is at the leftmost character of the current navigator object's text.
			ui.reviewMessage(_("Left"))
			reviewInfo=api.getReviewPosition().copy()
			reviewInfo.expand(textInfos.UNIT_CHARACTER)
			speech.speakTextInfo(reviewInfo,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
		else:
			api.setReviewPosition(charInfo)
			charInfo.expand(textInfos.UNIT_CHARACTER)
			speech.speakTextInfo(charInfo,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move review cursor to previous character command.
	script_review_previousCharacter.__doc__=_("Moves the review cursor to the previous character of the current navigator object and speaks it")
	script_review_previousCharacter.category=SCRCAT_TEXTREVIEW

	def script_review_currentCharacter(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_CHARACTER)
		scriptCount=scriptHandler.getLastScriptRepeatCount()
		if scriptCount==0:
			speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
		elif scriptCount==1:
			speech.spellTextInfo(info,useCharacterDescriptions=True)
		else:
			try:
				c = ord(info.text)
				speech.speakMessage("%d," % c)
				speech.speakSpelling(hex(c))
			except:
				speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for report current character under review cursor command.
	script_review_currentCharacter.__doc__=_("Reports the character of the current navigator object where the review cursor is situated. Pressing twice reports a description or example of that character. Pressing three times reports the numeric value of the character in decimal and hexadecimal")
	script_review_currentCharacter.category=SCRCAT_TEXTREVIEW

	def script_review_nextCharacter(self,gesture):
		lineInfo=api.getReviewPosition().copy()
		lineInfo.expand(textInfos.UNIT_LINE)
		charInfo=api.getReviewPosition().copy()
		charInfo.expand(textInfos.UNIT_CHARACTER)
		charInfo.collapse()
		res=charInfo.move(textInfos.UNIT_CHARACTER,1)
		if res==0 or charInfo.compareEndPoints(lineInfo,"endToEnd")>=0:
			# Translators: a message reported when review cursor is at the rightmost character of the current navigator object's text.
			ui.reviewMessage(_("Right"))
			reviewInfo=api.getReviewPosition().copy()
			reviewInfo.expand(textInfos.UNIT_CHARACTER)
			speech.speakTextInfo(reviewInfo,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
		else:
			api.setReviewPosition(charInfo)
			charInfo.expand(textInfos.UNIT_CHARACTER)
			speech.speakTextInfo(charInfo,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move review cursor to next character command.
	script_review_nextCharacter.__doc__=_("Moves the review cursor to the next character of the current navigator object and speaks it")
	script_review_nextCharacter.category=SCRCAT_TEXTREVIEW

	def script_review_endOfLine(self,gesture):
		info=api.getReviewPosition().copy()
		info.expand(textInfos.UNIT_LINE)
		info.collapse(end=True)
		info.move(textInfos.UNIT_CHARACTER,-1)
		api.setReviewPosition(info)
		info.expand(textInfos.UNIT_CHARACTER)
		speech.speakMessage(_("Right"))
		speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
	# Translators: Input help mode message for move review cursor to end of current line command.
	script_review_endOfLine.__doc__=_("Moves the review cursor to the last character of the line where it is situated in the current navigator object and speaks it")
	script_review_endOfLine.category=SCRCAT_TEXTREVIEW

	def script_speechMode(self,gesture):
		curMode=speech.speechMode
		speech.speechMode=speech.speechMode_talk
		newMode=(curMode+1)%3
		if newMode==speech.speechMode_off:
			# Translators: A speech mode which disables speech output.
			name=_("Speech mode off")
		elif newMode==speech.speechMode_beeps:
			# Translators: A speech mode which will cause NVDA to beep instead of speaking.
			name=_("Speech mode beeps")
		elif newMode==speech.speechMode_talk:
			# Translators: The normal speech mode; i.e. NVDA will talk as normal.
			name=_("Speech mode talk")
		speech.cancelSpeech()
		ui.message(name)
		speech.speechMode=newMode
	# Translators: Input help mode message for toggle speech mode command.
	script_speechMode.__doc__=_("Toggles between the speech modes of off, beep and talk. When set to off NVDA will not speak anything. If beeps then NVDA will simply beep each time it its supposed to speak something. If talk then NVDA wil just speak normally.")
	script_speechMode.category=SCRCAT_SPEECH

	def script_moveToParentTreeInterceptor(self,gesture):
		obj=api.getFocusObject()
		parent=obj.parent
		#Move up parents until the tree interceptor of the parent is different to the tree interceptor of the object.
		#Note that this could include the situation where the parent has no tree interceptor but the object did.
		while parent and parent.treeInterceptor==obj.treeInterceptor:
			parent=parent.parent
		#If the parent has no tree interceptor, keep moving up the parents until we find a parent that does have one.
		while parent and not parent.treeInterceptor:
			parent=parent.parent
		if parent:
			parent.treeInterceptor.rootNVDAObject.setFocus()
			import eventHandler
			import wx
			wx.CallLater(50,eventHandler.executeEvent,"gainFocus",parent.treeInterceptor.rootNVDAObject)
	# Translators: Input help mode message for move to next document with focus command, mostly used in web browsing to move from embedded object to the webpage document.
	script_moveToParentTreeInterceptor.__doc__=_("Moves the focus to the next closest document that contains the focus")
	script_moveToParentTreeInterceptor.category=SCRCAT_FOCUS

	def script_toggleVirtualBufferPassThrough(self,gesture):
		focus = api.getFocusObject()
		vbuf = focus.treeInterceptor
		if not vbuf:
			# #2023: Search the focus and its ancestors for an object for which browse mode is optional.
			for obj in itertools.chain((api.getFocusObject(),), reversed(api.getFocusAncestors())):
				if obj.shouldCreateTreeInterceptor:
					continue
				try:
					obj.treeInterceptorClass
				except:
					continue
				break
			else:
				return
			# Force the tree interceptor to be created.
			obj.shouldCreateTreeInterceptor = True
			ti = treeInterceptorHandler.update(obj)
			if not ti:
				return
			if focus in ti:
				# Update the focus, as it will have cached that there is no tree interceptor.
				focus.treeInterceptor = ti
				# If we just happened to create a browse mode TreeInterceptor
				# Then ensure that browse mode is reported here. From the users point of view, browse mode was turned on.
				if isinstance(ti,browseMode.BrowseModeTreeInterceptor) and not ti.passThrough:
					browseMode.reportPassThrough(ti,False)
					braille.handler.handleGainFocus(ti)
			return

		if not isinstance(vbuf, browseMode.BrowseModeTreeInterceptor):
			return
		# Toggle browse mode pass-through.
		vbuf.passThrough = not vbuf.passThrough
		if isinstance(vbuf,browseMode.BrowseModeDocumentTreeInterceptor):
			# If we are enabling pass-through, the user has explicitly chosen to do so, so disable auto-pass-through.
			# If we're disabling pass-through, re-enable auto-pass-through.
			vbuf.disableAutoPassThrough = vbuf.passThrough
		browseMode.reportPassThrough(vbuf)
	# Translators: Input help mode message for toggle focus and browse mode command in web browsing and other situations.
	script_toggleVirtualBufferPassThrough.__doc__=_("Toggles between browse mode and focus mode. When in focus mode, keys will pass straight through to the application, allowing you to interact directly with a control. When in browse mode, you can navigate the document with the cursor, quick navigation keys, etc.")
	script_toggleVirtualBufferPassThrough.category=inputCore.SCRCAT_BROWSEMODE

	def script_quit(self,gesture):
		gui.quit()
	# Translators: Input help mode message for quit NVDA command.
	script_quit.__doc__=_("Quits NVDA!")

	def script_showGui(self,gesture):
		gui.showGui()
	# Translators: Input help mode message for show NVDA menu command.
	script_showGui.__doc__=_("Shows the NVDA menu")

	def script_review_sayAll(self,gesture):
		sayAllHandler.readText(sayAllHandler.CURSOR_REVIEW)
	# Translators: Input help mode message for say all in review cursor command.
	script_review_sayAll.__doc__ = _("Reads from the review cursor up to end of current text, moving the review cursor as it goes")
	script_review_sayAll.category=SCRCAT_TEXTREVIEW

	def script_sayAll(self,gesture):
		sayAllHandler.readText(sayAllHandler.CURSOR_CARET)
	# Translators: Input help mode message for say all with system caret command.
	script_sayAll.__doc__ = _("Reads from the system caret up to the end of the text, moving the caret as it goes")
	script_sayAll.category=SCRCAT_SYSTEMCARET

	def script_reportFormatting(self,gesture):
		formatConfig={
			"detectFormatAfterCursor":False,
			"reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False,
			"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,
			"reportPage":False,"reportLineNumber":False,"reportLineIndentation":True,"reportLineIndentationWithTones":False,"reportParagraphIndentation":True,"reportLineSpacing":True,"reportTables":False,
			"reportLinks":False,"reportHeadings":False,"reportLists":False,
			"reportBlockQuotes":False,"reportComments":False,
		}
		textList=[]
		info=api.getReviewPosition()

		# First, fetch indentation.
		line=info.copy()
		line.expand(textInfos.UNIT_LINE)
		indentation,content=speech.splitTextIndentation(line.text)
		if indentation:
			textList.append(speech.getIndentationSpeech(indentation, formatConfig))
		
		info.expand(textInfos.UNIT_CHARACTER)
		formatField=textInfos.FormatField()
		for field in info.getTextWithFields(formatConfig):
			if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField):
				formatField.update(field.field)

		repeats=scriptHandler.getLastScriptRepeatCount()
		if repeats==0:
			text=speech.getFormatFieldSpeech(formatField,formatConfig=formatConfig) if formatField else None
			if text:
				textList.append(text)

			if not textList:
			# Translators: Reported when trying to obtain formatting information (such as font name, indentation and so on) but there is no formatting information for the text under cursor.
				ui.message(_("No formatting information"))
				return
				
			ui.message(" ".join(textList))
		elif repeats==1:
			text=speech.getFormatFieldSpeech(formatField,formatConfig=formatConfig , separator="\n") if formatField else None
			if text:
				textList.append(text)

			if not textList:
				# Translators: Reported when trying to obtain formatting information (such as font name, indentation and so on) but there is no formatting information for the text under cursor.
				ui.message(_("No formatting information"))
				return

			# Translators: title for formatting information dialog.
			ui.browseableMessage(("\n".join(textList) ) , _("Formatting"))
	# Translators: Input help mode message for report formatting command.
	script_reportFormatting.__doc__ = _("Reports formatting info for the current review cursor position within a document. If pressed twice, presents the information in browse mode")
	script_reportFormatting.category=SCRCAT_TEXTREVIEW

	def script_reportCurrentFocus(self,gesture):
		focusObject=api.getFocusObject()
		if isinstance(focusObject,NVDAObject):
			if scriptHandler.getLastScriptRepeatCount()==0:
				speech.speakObject(focusObject, reason=controlTypes.REASON_QUERY)
			else:
				speech.speakSpelling(focusObject.name)
		else:
			speech.speakMessage(_("No focus"))
	# Translators: Input help mode message for report current focus command.
	script_reportCurrentFocus.__doc__ = _("Reports the object with focus. If pressed twice, spells the information")
	script_reportCurrentFocus.category=SCRCAT_FOCUS

	def script_reportStatusLine(self,gesture):
		obj = api.getStatusBar()
		found=False
		if obj:
			text = api.getStatusBarText(obj)
			api.setNavigatorObject(obj)
			found=True
		else:
			info=api.getForegroundObject().flatReviewPosition
			if info:
				info.expand(textInfos.UNIT_STORY)
				info.collapse(True)
				info.expand(textInfos.UNIT_LINE)
				text=info.text
				info.collapse()
				api.setReviewPosition(info)
				found=True
		if not found:
			# Translators: Reported when there is no status line for the current program or window.
			ui.message(_("No status line found"))
			return
		if scriptHandler.getLastScriptRepeatCount()==0:
			ui.message(text)
		else:
			speech.speakSpelling(text)
	# Translators: Input help mode message for report status line text command.
	script_reportStatusLine.__doc__ = _("Reads the current application status bar and moves the navigator to it. If pressed twice, spells the information")
	script_reportStatusLine.category=SCRCAT_FOCUS

	def script_toggleMouseTracking(self,gesture):
		if config.conf["mouse"]["enableMouseTracking"]:
			# Translators: presented when the mouse tracking is toggled.
			state = _("Mouse tracking off")
			config.conf["mouse"]["enableMouseTracking"]=False
		else:
			# Translators: presented when the mouse tracking is toggled.
			state = _("Mouse tracking on")
			config.conf["mouse"]["enableMouseTracking"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle mouse tracking command.
	script_toggleMouseTracking.__doc__=_("Toggles the reporting of information as the mouse moves")
	script_toggleMouseTracking.category=SCRCAT_MOUSE

	def script_title(self,gesture):
		obj=api.getForegroundObject()
		title=obj.name
		if not isinstance(title,basestring) or not title or title.isspace():
			title=obj.appModule.appName  if obj.appModule else None
			if not isinstance(title,basestring) or not title or title.isspace():
				# Translators: Reported when there is no title text for current program or window.
				title=_("No title")
		repeatCount=scriptHandler.getLastScriptRepeatCount()
		if repeatCount==0:
			ui.message(title)
		elif repeatCount==1:
			speech.speakSpelling(title)
		else:
			if api.copyToClip(title):
				ui.message(_("%s copied to clipboard")%title)
	# Translators: Input help mode message for report title bar command.
	script_title.__doc__=_("Reports the title of the current application or foreground window. If pressed twice, spells the title. If pressed three times, copies the title to the clipboard")
	script_title.category=SCRCAT_FOCUS

	def script_speakForeground(self,gesture):
		obj=api.getForegroundObject()
		if obj:
			sayAllHandler.readObjects(obj)
	# Translators: Input help mode message for read foreground object command (usually the foreground window).
	script_speakForeground.__doc__ = _("Speaks the current foreground object")
	script_speakForeground.category=SCRCAT_FOCUS

	def script_test_navigatorDisplayModelText(self,gesture):
		obj=api.getNavigatorObject()
		text=obj.displayText
		speech.speakMessage(text)
		log.info(text)

	def script_navigatorObject_devInfo(self,gesture):
		obj=api.getNavigatorObject()
		log.info("Developer info for navigator object:\n%s" % "\n".join(obj.devInfo), activateLogViewer=True)
	# Translators: Input help mode message for developer info for current navigator object command, used by developers to examine technical info on navigator object. This command also serves as a shortcut to open NVDA log viewer.
	script_navigatorObject_devInfo.__doc__ = _("Logs information about the current navigator object which is useful to developers and activates the log viewer so the information can be examined.")
	script_navigatorObject_devInfo.category=SCRCAT_TOOLS

	def script_toggleProgressBarOutput(self,gesture):
		outputMode=config.conf["presentation"]["progressBarUpdates"]["progressBarOutputMode"]
		if outputMode=="both":
			outputMode="off"
			# Translators: A mode where no progress bar updates are given.
			ui.message(_("No progress bar updates"))
		elif outputMode=="off":
			outputMode="speak"
			# Translators: A mode where progress bar updates will be spoken.
			ui.message(_("Speak progress bar updates"))
		elif outputMode=="speak":
			outputMode="beep"
			# Translators: A mode where beeps will indicate progress bar updates (beeps rise in pitch as progress bar updates).
			ui.message(_("Beep for progress bar updates"))
		else:
			outputMode="both"
			# Translators: A mode where both speech and beeps will indicate progress bar updates.
			ui.message(_("Beep and speak progress bar updates"))
		config.conf["presentation"]["progressBarUpdates"]["progressBarOutputMode"]=outputMode
	# Translators: Input help mode message for toggle progress bar output command.
	script_toggleProgressBarOutput.__doc__=_("Toggles between beeps, speech, beeps and speech, and off, for reporting progress bar updates")
	script_toggleProgressBarOutput.category=SCRCAT_SPEECH

	def script_toggleReportDynamicContentChanges(self,gesture):
		if config.conf["presentation"]["reportDynamicContentChanges"]:
			# Translators: presented when the present dynamic changes is toggled.
			state = _("report dynamic content changes off")
			config.conf["presentation"]["reportDynamicContentChanges"]=False
		else:
			# Translators: presented when the present dynamic changes is toggled.
			state = _("report dynamic content changes on")
			config.conf["presentation"]["reportDynamicContentChanges"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle dynamic content changes command.
	script_toggleReportDynamicContentChanges.__doc__=_("Toggles on and off the reporting of dynamic content changes, such as new text in dos console windows")
	script_toggleReportDynamicContentChanges.category=SCRCAT_SPEECH

	def script_toggleCaretMovesReviewCursor(self,gesture):
		if config.conf["reviewCursor"]["followCaret"]:
			# Translators: presented when toggled.
			state = _("caret moves review cursor off")
			config.conf["reviewCursor"]["followCaret"]=False
		else:
			# Translators: presented when toggled.
			state = _("caret moves review cursor on")
			config.conf["reviewCursor"]["followCaret"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle caret moves review cursor command.
	script_toggleCaretMovesReviewCursor.__doc__=_("Toggles on and off the movement of the review cursor due to the caret moving.")
	script_toggleCaretMovesReviewCursor.category=SCRCAT_TEXTREVIEW

	def script_toggleFocusMovesNavigatorObject(self,gesture):
		if config.conf["reviewCursor"]["followFocus"]:
			# Translators: presented when toggled.
			state = _("focus moves navigator object off")
			config.conf["reviewCursor"]["followFocus"]=False
		else:
			# Translators: presented when toggled.
			state = _("focus moves navigator object on")
			config.conf["reviewCursor"]["followFocus"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle focus moves navigator object command.
	script_toggleFocusMovesNavigatorObject.__doc__=_("Toggles on and off the movement of the navigator object due to focus changes") 
	script_toggleFocusMovesNavigatorObject.category=SCRCAT_OBJECTNAVIGATION

	#added by Rui Batista<ruiandrebatista@gmail.com> to implement a battery status script
	def script_say_battery_status(self,gesture):
		UNKNOWN_BATTERY_STATUS = 0xFF
		AC_ONLINE = 0X1
		NO_SYSTEM_BATTERY = 0X80
		sps = winKernel.SYSTEM_POWER_STATUS()
		if not winKernel.GetSystemPowerStatus(sps) or sps.BatteryFlag is UNKNOWN_BATTERY_STATUS:
			log.error("error accessing system power status")
			return
		if sps.BatteryFlag & NO_SYSTEM_BATTERY:
			# Translators: This is presented when there is no battery such as desktop computers and laptops with battery pack removed.
			ui.message(_("No system battery"))
			return
		# Translators: This is presented to inform the user of the current battery percentage.
		text = _("%d percent") % sps.BatteryLifePercent + " "
		# Translators: This is presented when AC power is connected such as when recharging a laptop battery.
		if sps.ACLineStatus & AC_ONLINE: text += _("AC power on")
		elif sps.BatteryLifeTime!=0xffffffff: 
			# Translators: This is the estimated remaining runtime of the laptop battery.
			text += _("{hours:d} hours and {minutes:d} minutes remaining") .format(hours=sps.BatteryLifeTime / 3600, minutes=(sps.BatteryLifeTime % 3600) / 60)
		ui.message(text)
	# Translators: Input help mode message for report battery status command.
	script_say_battery_status.__doc__ = _("Reports battery status and time remaining if AC is not plugged in")
	script_say_battery_status.category=SCRCAT_SYSTEM

	def script_passNextKeyThrough(self,gesture):
		keyboardHandler.passNextKeyThrough()
		# Translators: Spoken to indicate that the next key press will be sent straight to the current program as though NVDA is not running.
		ui.message(_("Pass next key through"))
	# Translators: Input help mode message for pass next key through command.
	script_passNextKeyThrough.__doc__=_("The next key that is pressed will not be handled at all by NVDA, it will be passed directly through to Windows.")
	script_passNextKeyThrough.category=SCRCAT_INPUT

	def script_reportAppModuleInfo(self,gesture):
		focus=api.getFocusObject()
		appName=appModuleHandler.getAppNameFromProcessID(focus.processID,True)
		# Translators: Indicates the name of the current program (example output: Currently running application is explorer.exe).
		# Note that it does not give friendly name such as Windows Explorer; it presents the file name of the current application.
		# If there is an appModule for the current program, NVDA speaks the name of the module after presenting this message.
		message = _("Currently running application is %s") % appName
		mod=focus.appModule
		if isinstance(mod,appModuleHandler.AppModule) and type(mod)!=appModuleHandler.AppModule:
			# Translators: Indicates the name of the appModule for the current program (example output: and currently loaded module is explorer).
			# For example, the complete message for Windows explorer is: Currently running application is explorer.exe and currently loaded module is explorer.
			# This message will not be presented if there is no module for the current program.
			message += _(" and currently loaded module is %s") % mod.appModuleName.split(".")[0]
		ui.message(message)
	# Translators: Input help mode message for report current program name and app module name command.
	script_reportAppModuleInfo.__doc__ = _("Speaks the filename of the active application along with the name of the currently loaded appModule")
	script_reportAppModuleInfo.category=SCRCAT_TOOLS

	def script_activateGeneralSettingsDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onGeneralSettingsCommand, None)
	# Translators: Input help mode message for go to general settings dialog command.
	script_activateGeneralSettingsDialog.__doc__ = _("Shows the NVDA general settings dialog")
	script_activateGeneralSettingsDialog.category=SCRCAT_CONFIG

	def script_activateSynthesizerDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onSynthesizerCommand, None)
	# Translators: Input help mode message for go to synthesizer dialog command.
	script_activateSynthesizerDialog.__doc__ = _("Shows the NVDA synthesizer dialog")
	script_activateSynthesizerDialog.category=SCRCAT_CONFIG

	def script_activateVoiceDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onVoiceCommand, None)
	# Translators: Input help mode message for go to voice settings dialog command.
	script_activateVoiceDialog.__doc__ = _("Shows the NVDA voice settings dialog")
	script_activateVoiceDialog.category=SCRCAT_CONFIG

	def script_activateBrailleSettingsDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onBrailleCommand, None)
	# Translators: Input help mode message for go to braille settings dialog command.
	script_activateBrailleSettingsDialog.__doc__ = _("Shows the NVDA braille settings dialog")
	script_activateBrailleSettingsDialog.category=SCRCAT_CONFIG

	def script_activateKeyboardSettingsDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onKeyboardSettingsCommand, None)
	# Translators: Input help mode message for go to keyboard settings dialog command.
	script_activateKeyboardSettingsDialog.__doc__ = _("Shows the NVDA keyboard settings dialog")
	script_activateKeyboardSettingsDialog.category=SCRCAT_CONFIG

	def script_activateMouseSettingsDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onMouseSettingsCommand, None)
	# Translators: Input help mode message for go to mouse settings dialog command.
	script_activateMouseSettingsDialog.__doc__ = _("Shows the NVDA mouse settings dialog")
	script_activateMouseSettingsDialog.category=SCRCAT_CONFIG

	def script_activateReviewCursorDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onReviewCursorCommand, None)
	# Translators: Input help mode message for go to review cursor settings dialog command.
	script_activateReviewCursorDialog.__doc__ = _("Shows the NVDA review cursor settings dialog")
	script_activateReviewCursorDialog.category=SCRCAT_CONFIG

	def script_activateInputCompositionDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onInputCompositionCommand, None)
	# Translators: Input help mode message for go to input composition dialog.
	script_activateInputCompositionDialog.__doc__ = _("Shows the NVDA input composition settings dialog")
	script_activateInputCompositionDialog.category=SCRCAT_CONFIG

	def script_activateObjectPresentationDialog(self, gesture):
		wx.CallAfter(gui.mainFrame. onObjectPresentationCommand, None)
	# Translators: Input help mode message for go to object presentation dialog command.
	script_activateObjectPresentationDialog.__doc__ = _("Shows the NVDA object presentation settings dialog")
	script_activateObjectPresentationDialog.category=SCRCAT_CONFIG

	def script_activateBrowseModeDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onBrowseModeCommand, None)
	# Translators: Input help mode message for go to browse mode dialog command.
	script_activateBrowseModeDialog.__doc__ = _("Shows the NVDA browse mode settings dialog")
	script_activateBrowseModeDialog.category=SCRCAT_CONFIG

	def script_activateDocumentFormattingDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onDocumentFormattingCommand, None)
	# Translators: Input help mode message for go to document formatting dialog command.
	script_activateDocumentFormattingDialog.__doc__ = _("Shows the NVDA document formatting settings dialog")
	script_activateDocumentFormattingDialog.category=SCRCAT_CONFIG

	def script_activateDefaultDictionaryDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onDefaultDictionaryCommand, None)
	# Translators: Input help mode message for opening default dictionary dialog.
	script_activateDefaultDictionaryDialog.__doc__ = _("Shows the NVDA default dictionary dialog")
	script_activateDefaultDictionaryDialog.category=SCRCAT_CONFIG

	def script_activateVoiceDictionaryDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onVoiceDictionaryCommand, None)
	# Translators: Input help mode message for opening voice-specific dictionary dialog.
	script_activateVoiceDictionaryDialog.__doc__ = _("Shows the NVDA voice-specific dictionary dialog")
	script_activateVoiceDictionaryDialog.category=SCRCAT_CONFIG

	def script_activateTemporaryDictionaryDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onTemporaryDictionaryCommand, None)
	# Translators: Input help mode message for opening temporary dictionary.
	script_activateTemporaryDictionaryDialog.__doc__ = _("Shows the NVDA temporary dictionary dialog")
	script_activateTemporaryDictionaryDialog.category=SCRCAT_CONFIG

	def script_activateSpeechSymbolsDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onSpeechSymbolsCommand, None)
	# Translators: Input help mode message for go to punctuation/symbol pronunciation dialog.
	script_activateSpeechSymbolsDialog.__doc__ = _("Shows the NVDA symbol pronunciation dialog")
	script_activateSpeechSymbolsDialog.category=SCRCAT_CONFIG

	def script_activateInputGesturesDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onInputGesturesCommand, None)
	# Translators: Input help mode message for go to input gestures dialog command.
	script_activateInputGesturesDialog.__doc__ = _("Shows the NVDA input gestures dialog")
	script_activateInputGesturesDialog.category=SCRCAT_CONFIG

	def script_saveConfiguration(self,gesture):
		wx.CallAfter(gui.mainFrame.onSaveConfigurationCommand, None)
	# Translators: Input help mode message for save current configuration command.
	script_saveConfiguration.__doc__ = _("Saves the current NVDA configuration")
	script_saveConfiguration.category=SCRCAT_CONFIG

	def script_revertConfiguration(self,gesture):
		scriptCount=scriptHandler.getLastScriptRepeatCount()
		if scriptCount==0:
			gui.mainFrame.onRevertToSavedConfigurationCommand(None)
		elif scriptCount==2:
			gui.mainFrame.onRevertToDefaultConfigurationCommand(None)
	# Translators: Input help mode message for apply last saved or default settings command.
	script_revertConfiguration.__doc__ = _("Pressing once reverts the current configuration to the most recently saved state. Pressing three times reverts to factory defaults.")
	script_revertConfiguration.category=SCRCAT_CONFIG

	def script_activatePythonConsole(self,gesture):
		if globalVars.appArgs.secure:
			return
		import pythonConsole
		if not pythonConsole.consoleUI:
			pythonConsole.initialize()
		pythonConsole.consoleUI.console.updateNamespaceSnapshotVars()
		pythonConsole.activate()
	# Translators: Input help mode message for activate python console command.
	script_activatePythonConsole.__doc__ = _("Activates the NVDA Python Console, primarily useful for development")
	script_activatePythonConsole.category=SCRCAT_TOOLS

	def script_activateAddonsManager(self,gesture):
		wx.CallAfter(gui.mainFrame.onAddonsManagerCommand, None)
		# Translators: Input help mode message for activate manage add-ons command.
	script_activateAddonsManager.__doc__ = _("Activates the NVDA Add-ons Manager to install and uninstall add-on packages for NVDA")
	script_activateAddonsManager.category=SCRCAT_TOOLS

	def script_toggleSpeechViewer(self,gesture):
		if gui.speechViewer.isActive:
			# Translators: The message announced when disabling speech viewer.
			state = _("speech viewer disabled")
			gui.speechViewer.deactivate()
			gui.mainFrame.sysTrayIcon.menu_tools_toggleSpeechViewer.Check(False)
		else:
			# Translators: The message announced when enabling speech viewer.
			state = _("speech viewer enabled")
			gui.speechViewer.activate()
			gui.mainFrame.sysTrayIcon.menu_tools_toggleSpeechViewer.Check(True)
		ui.message(state)
		# Translators: Input help mode message for toggle speech viewer command.
	script_toggleSpeechViewer.__doc__ = _("Toggles the NVDA Speech viewer, a floating window that allows you to view all the text that NVDA is currently speaking")
	script_toggleSpeechViewer.category=SCRCAT_TOOLS

	def script_braille_toggleTether(self, gesture):
		if braille.handler.tether == braille.handler.TETHER_FOCUS:
			braille.handler.tether = braille.handler.TETHER_REVIEW
			# Translators: One of the options for tethering braille (see the comment on "braille tethered to" message for more information).
			tetherMsg = _("review")
		else:
			braille.handler.tether = braille.handler.TETHER_FOCUS
			# Translators: One of the options for tethering braille (see the comment on "braille tethered to" message for more information).
			tetherMsg = _("focus")
		# Translators: Reports which position braille is tethered to (braille can be tethered to either focus or review position).
		ui.message(_("Braille tethered to %s") % tetherMsg)
	# Translators: Input help mode message for toggle braille tether to command (tethered means connected to or follows).
	script_braille_toggleTether.__doc__ = _("Toggle tethering of braille between the focus and the review position")
	script_braille_toggleTether.category=SCRCAT_BRAILLE

	def script_braille_toggleShowCursor(self, gesture):
		if config.conf["braille"]["showCursor"]:
			# Translators: The message announced when toggling the braille cursor.
			state = _("Braille cursor off")
			config.conf["braille"]["showCursor"]=False
		else:
			# Translators: The message announced when toggling the braille cursor.
			state = _("Braille cursor on")
			config.conf["braille"]["showCursor"]=True
		ui.message(state)
	# Translators: Input help mode message for toggle braille cursor command.
	script_braille_toggleShowCursor.__doc__ = _("Toggle the braille cursor on and off")
	script_braille_toggleShowCursor.category=SCRCAT_BRAILLE

	def script_braille_cycleCursorShape(self, gesture):
		if not config.conf["braille"]["showCursor"]:
			# Translators: A message reported when changing the braille cursor shape when the braille cursor is turned off.
			ui.message(_("Braille cursor is turned off"))
			return
		shapes = [s[0] for s in braille.CURSOR_SHAPES]
		try:
			index = shapes.index(config.conf["braille"]["cursorShape"]) + 1
		except:
			index = 1
		if index >= len(braille.CURSOR_SHAPES):
			index = 0
		config.conf["braille"]["cursorShape"] = braille.CURSOR_SHAPES[index][0]
		shapeMsg = braille.CURSOR_SHAPES[index][1]
		# Translators: Reports which braille cursor shape is activated.
		ui.message(_("Braille cursor %s") % shapeMsg)
	# Translators: Input help mode message for cycle braille cursor shape command.
	script_braille_cycleCursorShape.__doc__ = _("Cycle through the braille cursor shapes")
	script_braille_cycleCursorShape.category=SCRCAT_BRAILLE

	def script_reportClipboardText(self,gesture):
		try:
			text = api.getClipData()
		except:
			text = None
		if not text or not isinstance(text,basestring) or text.isspace():
			# Translators: Presented when there is no text on the clipboard.
			ui.message(_("There is no text on the clipboard"))
			return
		if len(text) < 1024: 
			ui.message(text)
		else:
			# Translators: If the number of characters on the clipboard is greater than about 1000, it reports this message and gives number of characters on the clipboard.
			# Example output: The clipboard contains a large portion of text. It is 2300 characters long.
			ui.message(_("The clipboard contains a large portion of text. It is %s characters long") % len(text))
	# Translators: Input help mode message for report clipboard text command.
	script_reportClipboardText.__doc__ = _("Reports the text on the Windows clipboard")
	script_reportClipboardText.category=SCRCAT_SYSTEM

	def script_review_markStartForCopy(self, gesture):
		reviewPos = api.getReviewPosition()
		# attach the marker to obj so that the marker is cleaned up when obj is cleaned up.
		reviewPos.obj._copyStartMarker = reviewPos.copy() # represents the start location
		reviewPos.obj._selectThenCopyRange = None # we may be part way through a select, reset the copy range.
		# Translators: Indicates start of review cursor text to be copied to clipboard.
		ui.message(_("Start marked"))
	# Translators: Input help mode message for mark review cursor position for a select or copy command (that is, marks the current review cursor position as the starting point for text to be selected).
	script_review_markStartForCopy.__doc__ = _("Marks the current position of the review cursor as the start of text to be selected or copied")
	script_review_markStartForCopy.category=SCRCAT_TEXTREVIEW

	def script_review_copy(self, gesture):
		pos = api.getReviewPosition().copy()
		if not getattr(pos.obj, "_copyStartMarker", None):
			# Translators: Presented when attempting to copy some review cursor text but there is no start marker.
			ui.message(_("No start marker set"))
			return
		startMarker = api.getReviewPosition().obj._copyStartMarker
		# first call, try to set the selection.
		if scriptHandler.getLastScriptRepeatCount()==0 :
			if getattr(pos.obj, "_selectThenCopyRange", None):
				# we have already tried selecting the text, dont try again. For now selections can not be ammended.
				# Translators: Presented when text has already been marked for selection, but not yet copied.
				ui.message(_("Press twice to copy or reset the start marker"))
				return
			copyMarker = startMarker.copy()
			# Check if the end position has moved
			if pos.compareEndPoints(startMarker, "endToEnd") > 0: # user has moved the cursor 'forward'
				# start becomes the original start
				copyMarker.setEndPoint(startMarker, "startToStart")
				# end needs to be updated to the current cursor position.
				copyMarker.setEndPoint(pos, "endToEnd")
				copyMarker.move(textInfos.UNIT_CHARACTER, 1, endPoint="end")
			else:# user has moved the cursor 'backwards' or not at all.
				# when the cursor is not moved at all we still want to select the character have under the cursor
				# start becomes the current cursor position position
				copyMarker.setEndPoint(pos, "startToStart")
				# end becomes the original start position plus 1
				copyMarker.setEndPoint(startMarker, "endToEnd")
				copyMarker.move(textInfos.UNIT_CHARACTER, 1, endPoint="end")
			if copyMarker.compareEndPoints(copyMarker, "startToEnd") == 0:
				# Translators: Presented when there is no text selection to copy from review cursor.
				ui.message(_("No text to copy"))
				api.getReviewPosition().obj._copyStartMarker = None
				return
			api.getReviewPosition().obj._selectThenCopyRange = copyMarker
			# for applications such as word, where the selected text is not automatically spoken we must monitor it ourself
			try:
				# old selection info must be saved so that its possible to report on the changes to the selection.
				oldInfo=pos.obj.makeTextInfo(textInfos.POSITION_SELECTION)
			except Exception as e:
				log.debug("Error trying to get initial selection information %s" % e)
				pass
			try:
				copyMarker.updateSelection()
				if hasattr(pos.obj, "reportSelectionChange"):
					# wait for applications such as word to update their selection so that we can detect it
					try:
						pos.obj.reportSelectionChange(oldInfo)
					except Exception as e:
						log.debug("Error trying to report the updated selection: %s" % e)
			except NotImplementedError as e:
				# we are unable to select the text, leave the _copyStartMarker in place in case the user wishes to copy the text.
				# Translators: Presented when unable to select the marked text.
				ui.message(_("Can't select text, press twice to copy"))
				log.debug("Error trying to update selection: %s" % e)
				return
		elif scriptHandler.getLastScriptRepeatCount()==1: # the second call, try to copy the text
			copyMarker = pos.obj._selectThenCopyRange
			if copyMarker.copyToClipboard():
				# Translators: Presented when some review text has been copied to clipboard.
				ui.message(_("Review selection copied to clipboard"))
			else:
				# Translators: Presented when unable to copy to the clipboard because of an error.
				ui.message(_("Unable to copy"))
			# on the second call always clean up the start marker
			api.getReviewPosition().obj._selectThenCopyRange = None
			api.getReviewPosition().obj._copyStartMarker = None
		return
	# Translators: Input help mode message for the select then copy command. The select then copy command first selects the review cursor text, then copies it to the clipboard.
	script_review_copy.__doc__ = _("If pressed once, the text from the previously set start marker up to and including the current position of the review cursor is selected. If pressed twice, the text is copied to the clipboard")
	script_review_copy.category=SCRCAT_TEXTREVIEW

	def script_braille_scrollBack(self, gesture):
		braille.handler.scrollBack()
	# Translators: Input help mode message for a braille command.
	script_braille_scrollBack.__doc__ = _("Scrolls the braille display back")
	script_braille_scrollBack.bypassInputHelp = True
	script_braille_scrollBack.category=SCRCAT_BRAILLE

	def script_braille_scrollForward(self, gesture):
		braille.handler.scrollForward()
	# Translators: Input help mode message for a braille command.
	script_braille_scrollForward.__doc__ = _("Scrolls the braille display forward")
	script_braille_scrollForward.bypassInputHelp = True
	script_braille_scrollForward.category=SCRCAT_BRAILLE

	def script_braille_routeTo(self, gesture):
		braille.handler.routeTo(gesture.routingIndex)
	# Translators: Input help mode message for a braille command.
	script_braille_routeTo.__doc__ = _("Routes the cursor to or activates the object under this braille cell")
	script_braille_routeTo.category=SCRCAT_BRAILLE

	def script_braille_previousLine(self, gesture):
		if braille.handler.buffer.regions: 
			braille.handler.buffer.regions[-1].previousLine(start=True)
	# Translators: Input help mode message for a braille command.
	script_braille_previousLine.__doc__ = _("Moves the braille display to the previous line")
	script_braille_previousLine.category=SCRCAT_BRAILLE

	def script_braille_nextLine(self, gesture):
		if braille.handler.buffer.regions: 
			braille.handler.buffer.regions[-1].nextLine()
	# Translators: Input help mode message for a braille command.
	script_braille_nextLine.__doc__ = _("Moves the braille display to the next line")
	script_braille_nextLine.category=SCRCAT_BRAILLE

	def script_braille_dots(self, gesture):
		brailleInput.handler.input(gesture.dots)
	# Translators: Input help mode message for a braille command.
	script_braille_dots.__doc__= _("Inputs braille dots via the braille keyboard")
	script_braille_dots.category=SCRCAT_BRAILLE

	def script_braille_toFocus(self, gesture):
		if braille.handler.tether == braille.handler.TETHER_REVIEW:
			self.script_navigatorObject_toFocus(gesture)
		else:
			if not braille.handler.mainBuffer.regions:
				return
			region = braille.handler.mainBuffer.regions[-1]
			braille.handler.mainBuffer.focus(region)
			if region.brailleCursorPos is not None:
				braille.handler.mainBuffer.scrollTo(region, region.brailleCursorPos)
			elif region.brailleSelectionStart is not None:
				braille.handler.mainBuffer.scrollTo(region, region.brailleSelectionStart)
			braille.handler.mainBuffer.updateDisplay()
	# Translators: Input help mode message for a braille command.
	script_braille_toFocus.__doc__= _("Moves the braille display to the current focus")
	script_braille_toFocus.category=SCRCAT_BRAILLE

	def script_reloadPlugins(self, gesture):
		import globalPluginHandler
		appModuleHandler.reloadAppModules()
		globalPluginHandler.reloadGlobalPlugins()
		NVDAObject.clearDynamicClassCache()
		# Translators: Presented when plugins (app modules and global plugins) are reloaded.
		ui.message(_("Plugins reloaded"))
	# Translators: Input help mode message for reload plugins command.
	script_reloadPlugins.__doc__=_("Reloads app modules and global plugins without restarting NVDA, which can be Useful for developers")
	script_reloadPlugins.category=SCRCAT_TOOLS

	def script_navigatorObject_nextInFlow(self,gesture):
		curObject=api.getNavigatorObject()
		newObject=None
		if curObject.simpleFirstChild:
			newObject=curObject.simpleFirstChild
		elif curObject.simpleNext:
			newObject=curObject.simpleNext
		elif curObject.simpleParent:
			parent=curObject.simpleParent
			while parent and not parent.simpleNext:
				parent=parent.simpleParent
			if parent:
				newObject=parent.simpleNext
		if newObject:
			api.setNavigatorObject(newObject)
			speech.speakObject(newObject,reason=controlTypes.REASON_FOCUS)
		else:
			# Translators: a message when there is no next object when navigating
			ui.reviewMessage(_("No next"))
	# Translators: Input help mode message for a touchscreen gesture.
	script_navigatorObject_nextInFlow.__doc__=_("Moves to the next object in a flattened view of the object navigation hierarchy")
	script_navigatorObject_nextInFlow.category=SCRCAT_OBJECTNAVIGATION

	def script_navigatorObject_previousInFlow(self,gesture):
		curObject=api.getNavigatorObject()
		newObject=curObject.simplePrevious
		if newObject:
			while newObject.simpleLastChild:
				newObject=newObject.simpleLastChild
		else:
			newObject=curObject.simpleParent
		if newObject:
			api.setNavigatorObject(newObject)
			speech.speakObject(newObject,reason=controlTypes.REASON_FOCUS)
		else:
			# Translators: a message when there is no previous object when navigating
			ui.reviewMessage(_("No previous"))
	# Translators: Input help mode message for a touchscreen gesture.
	script_navigatorObject_previousInFlow.__doc__=_("Moves to the previous object in a flattened view of the object navigation hierarchy")
	script_navigatorObject_previousInFlow.category=SCRCAT_OBJECTNAVIGATION

	def script_touch_changeMode(self,gesture):
		mode=touchHandler.handler._curTouchMode
		index=touchHandler.availableTouchModes.index(mode)
		index=(index+1)%len(touchHandler.availableTouchModes)
		newMode=touchHandler.availableTouchModes[index]
		touchHandler.handler._curTouchMode=newMode
		try:
			newModeLabel=touchHandler.touchModeLabels[newMode]
		except KeyError:
			# Translators: Cycles through available touch modes (a group of related touch gestures; example output: "object mode"; see the user guide for more information on touch modes).
			newModeLabel=_("%s mode")%newMode
		ui.message(newModeLabel)
	# Translators: Input help mode message for a touchscreen gesture.
	script_touch_changeMode.__doc__=_("Cycles between available touch modes")
	script_touch_changeMode.category=SCRCAT_TOUCH


	def script_touch_newExplore(self,gesture):
		touchHandler.handler.screenExplorer.moveTo(gesture.x,gesture.y,new=True)
	# Translators: Input help mode message for a touchscreen gesture.
	script_touch_newExplore.__doc__=_("Reports the object and content directly under your finger")
	script_touch_newExplore.category=SCRCAT_TOUCH

	def script_touch_explore(self,gesture):
		touchHandler.handler.screenExplorer.moveTo(gesture.x,gesture.y)
	# Translators: Input help mode message for a touchscreen gesture.
	script_touch_explore.__doc__=_("Reports the new object or content under your finger if different to where your finger was last")
	script_touch_explore.category=SCRCAT_TOUCH

	def script_touch_hoverUp(self,gesture):
		#Specifically for touch typing with onscreen keyboard keys
		obj=api.getNavigatorObject()
		import NVDAObjects.UIA
		if isinstance(obj,NVDAObjects.UIA.UIA) and obj.UIAElement.cachedClassName=="CRootKey":
			obj.doAction()
	script_touch_hoverUp.category=SCRCAT_TOUCH

	def script_activateConfigProfilesDialog(self, gesture):
		wx.CallAfter(gui.mainFrame.onConfigProfilesCommand, None)
	# Translators: Describes the command to open the Configuration Profiles dialog.
	script_activateConfigProfilesDialog.__doc__ = _("Shows the NVDA Configuration Profiles dialog")
	script_activateConfigProfilesDialog.category=SCRCAT_CONFIG

	def script_interactWithMath(self, gesture):
		import mathPres
		mathMl = mathPres.getMathMlFromTextInfo(api.getReviewPosition())
		if not mathMl:
			obj = api.getNavigatorObject()
			if obj.role == controlTypes.ROLE_MATH:
				try:
					mathMl = obj.mathMl
				except (NotImplementedError, LookupError):
					mathMl = None
		if not mathMl:
			# Translators: Reported when the user attempts math interaction
			# with something that isn't math.
			ui.message(_("Not math"))
			return
		mathPres.interactWithMathMl(mathMl)
	# Translators: Describes a command.
	script_interactWithMath.__doc__ = _("Begins interaction with math content")

	__gestures = {
		# Basic
		"kb:NVDA+n": "showGui",
		"kb:NVDA+1": "toggleInputHelp",
		"kb:NVDA+q": "quit",
		"kb:NVDA+f2": "passNextKeyThrough",
		"kb(desktop):NVDA+shift+s":"toggleCurrentAppSleepMode",
		"kb(laptop):NVDA+shift+z":"toggleCurrentAppSleepMode",

		# System status
		"kb:NVDA+f12": "dateTime",
		"kb:NVDA+shift+b": "say_battery_status",
		"kb:NVDA+c": "reportClipboardText",

		# System focus
		"kb:NVDA+tab": "reportCurrentFocus",
		"kb:NVDA+t": "title",
		"kb:NVDA+b": "speakForeground",
		"kb(desktop):NVDA+end": "reportStatusLine",
		"kb(laptop):NVDA+shift+end": "reportStatusLine",

		# System caret
		"kb(desktop):NVDA+downArrow": "sayAll",
		"kb(laptop):NVDA+a": "sayAll",
		"kb(desktop):NVDA+upArrow": "reportCurrentLine",
		"kb(laptop):NVDA+l": "reportCurrentLine",
		"kb(desktop):NVDA+shift+upArrow": "reportCurrentSelection",
		"kb(laptop):NVDA+shift+s": "reportCurrentSelection",
		"kb:NVDA+f": "reportFormatting",

		# Object navigation
		"kb:NVDA+numpad5": "navigatorObject_current",
		"kb(laptop):NVDA+shift+o": "navigatorObject_current",
		"kb:NVDA+numpad8": "navigatorObject_parent",
		"kb(laptop):NVDA+shift+upArrow": "navigatorObject_parent",
		"ts(object):flickup":"navigatorObject_parent",
		"kb:NVDA+numpad4": "navigatorObject_previous",
		"kb(laptop):NVDA+shift+leftArrow": "navigatorObject_previous",
		"ts(object):flickleft":"navigatorObject_previousInFlow",
		"ts(object):2finger_flickleft":"navigatorObject_previous",
		"kb:NVDA+numpad6": "navigatorObject_next",
		"kb(laptop):NVDA+shift+rightArrow": "navigatorObject_next",
		"ts(object):flickright":"navigatorObject_nextInFlow",
		"ts(object):2finger_flickright":"navigatorObject_next",
		"kb:NVDA+numpad2": "navigatorObject_firstChild",
		"kb(laptop):NVDA+shift+downArrow": "navigatorObject_firstChild",
		"ts(object):flickdown":"navigatorObject_firstChild",
		"kb:NVDA+numpadMinus": "navigatorObject_toFocus",
		"kb(laptop):NVDA+backspace": "navigatorObject_toFocus",
		"kb:NVDA+numpadEnter": "review_activate",
		"kb(laptop):NVDA+enter": "review_activate",
		"ts:double_tap": "review_activate",
		"kb:NVDA+shift+numpadMinus": "navigatorObject_moveFocus",
		"kb(laptop):NVDA+shift+backspace": "navigatorObject_moveFocus",
		"kb:NVDA+numpadDelete": "navigatorObject_currentDimensions",
		"kb(laptop):NVDA+delete": "navigatorObject_currentDimensions",

		#Touch-specific commands
		"ts:tap":"touch_newExplore",
		"ts:hoverDown":"touch_newExplore",
		"ts:hover":"touch_explore",
		"ts:3finger_tap":"touch_changeMode",
		"ts:2finger_double_tap":"showGui",
		"ts:hoverUp":"touch_hoverUp",
		# Review cursor
		"kb:shift+numpad7": "review_top",
		"kb(laptop):NVDA+control+home": "review_top",
		"kb:numpad7": "review_previousLine",
		"ts(text):flickUp":"review_previousLine",
		"kb(laptop):NVDA+upArrow": "review_previousLine",
		"kb:numpad8": "review_currentLine",
		"kb(laptop):NVDA+shift+.": "review_currentLine",
		"kb:numpad9": "review_nextLine",
		"kb(laptop):NVDA+downArrow": "review_nextLine",
		"ts(text):flickDown":"review_nextLine",
		"kb:shift+numpad9": "review_bottom",
		"kb(laptop):NVDA+control+end": "review_bottom",
		"kb:numpad4": "review_previousWord",
		"kb(laptop):NVDA+control+leftArrow": "review_previousWord",
		"ts(text):2finger_flickLeft":"review_previousWord",
		"kb:numpad5": "review_currentWord",
		"kb(laptop):NVDA+control+.": "review_currentWord",
		"ts(text):hoverUp":"review_currentWord",
		"kb:numpad6": "review_nextWord",
		"kb(laptop):NVDA+control+rightArrow": "review_nextWord",
		"ts(text):2finger_flickRight":"review_nextWord",
		"kb:shift+numpad1": "review_startOfLine",
		"kb(laptop):NVDA+home": "review_startOfLine",
		"kb:numpad1": "review_previousCharacter",
		"kb(laptop):NVDA+leftArrow": "review_previousCharacter",
		"ts(text):flickLeft":"review_previousCharacter",
		"kb:numpad2": "review_currentCharacter",
		"kb(laptop):NVDA+.": "review_currentCharacter",
		"kb:numpad3": "review_nextCharacter",
		"kb(laptop):NVDA+rightArrow": "review_nextCharacter",
		"ts(text):flickRight":"review_nextCharacter",
		"kb:shift+numpad3": "review_endOfLine",
		"kb(laptop):NVDA+end": "review_endOfLine",
		"kb:numpadPlus": "review_sayAll",
		"kb(laptop):NVDA+shift+a": "review_sayAll",
		"ts(text):3finger_flickDown":"review_sayAll",
		"kb:NVDA+f9": "review_markStartForCopy",
		"kb:NVDA+f10": "review_copy",

		# Flat review
		"kb:NVDA+numpad7": "reviewMode_next",
		"kb(laptop):NVDA+pageUp": "reviewMode_next",
		"ts(object):2finger_flickUp": "reviewMode_next",
		"kb:NVDA+numpad1": "reviewMode_previous",
		"kb(laptop):NVDA+pageDown": "reviewMode_previous",
		"ts(object):2finger_flickDown": "reviewMode_previous",

		# Mouse
		"kb:numpadDivide": "leftMouseClick",
		"kb(laptop):NVDA+[": "leftMouseClick",
		"kb:shift+numpadDivide": "toggleLeftMouseButton",
		"kb(laptop):NVDA+control+[": "toggleLeftMouseButton",
		"kb:numpadMultiply": "rightMouseClick",
		"kb(laptop):NVDA+]": "rightMouseClick",
		"kb:shift+numpadMultiply": "toggleRightMouseButton",
		"kb(laptop):NVDA+control+]": "toggleRightMouseButton",
		"kb:NVDA+numpadDivide": "moveMouseToNavigatorObject",
		"kb(laptop):NVDA+shift+m": "moveMouseToNavigatorObject",
		"kb:NVDA+numpadMultiply": "moveNavigatorObjectToMouse",
		"kb(laptop):NVDA+shift+n": "moveNavigatorObjectToMouse",

		# Tree interceptors
		"kb:NVDA+space": "toggleVirtualBufferPassThrough",
		"kb:NVDA+control+space": "moveToParentTreeInterceptor",

		# Preferences dialogs
		"kb:NVDA+control+g": "activateGeneralSettingsDialog",
		"kb:NVDA+control+s": "activateSynthesizerDialog",
		"kb:NVDA+control+v": "activateVoiceDialog",
		"kb:NVDA+control+k": "activateKeyboardSettingsDialog",
		"kb:NVDA+control+m": "activateMouseSettingsDialog",
		"kb:NVDA+control+o": "activateObjectPresentationDialog",
		"kb:NVDA+control+b": "activateBrowseModeDialog",
		"kb:NVDA+control+d": "activateDocumentFormattingDialog",

		# Configuration management
		"kb:NVDA+control+c": "saveConfiguration",
		"kb:NVDA+control+r": "revertConfiguration",
		"kb:NVDA+control+p": "activateConfigProfilesDialog",

		# Settings
		"kb:NVDA+shift+d":"cycleAudioDuckingMode",
		"kb:NVDA+2": "toggleSpeakTypedCharacters",
		"kb:NVDA+3": "toggleSpeakTypedWords",
		"kb:NVDA+4": "toggleSpeakCommandKeys",
		"kb:NVDA+p": "cycleSpeechSymbolLevel",
		"kb:NVDA+s": "speechMode",
		"kb:NVDA+m": "toggleMouseTracking",
		"kb:NVDA+u": "toggleProgressBarOutput",
		"kb:NVDA+5": "toggleReportDynamicContentChanges",
		"kb:NVDA+6": "toggleCaretMovesReviewCursor",
		"kb:NVDA+7": "toggleFocusMovesNavigatorObject",
		"kb:NVDA+control+t": "braille_toggleTether",

		# Synth settings ring
		"kb(desktop):NVDA+control+leftArrow": "previousSynthSetting",
		"kb(laptop):NVDA+shift+control+leftArrow": "previousSynthSetting",
		"kb(desktop):NVDA+control+rightArrow": "nextSynthSetting",
		"kb(laptop):NVDA+shift+control+rightArrow": "nextSynthSetting",
		"kb(desktop):NVDA+control+upArrow": "increaseSynthSetting",
		"kb(laptop):NVDA+shift+control+upArrow": "increaseSynthSetting",
		"kb(desktop):NVDA+control+downArrow": "decreaseSynthSetting",
		"kb(laptop):NVDA+control+shift+downArrow": "decreaseSynthSetting",

		# Braille keyboard
		"bk:dots" : "braille_dots",

		# Tools
		"kb:NVDA+f1": "navigatorObject_devInfo",
		"kb:NVDA+control+f1": "reportAppModuleInfo",
		"kb:NVDA+control+z": "activatePythonConsole",
		"kb:NVDA+control+f3": "reloadPlugins",
		"kb(desktop):NVDA+control+f2": "test_navigatorDisplayModelText",
		"kb:NVDA+alt+m": "interactWithMath",
	}

#: The single global commands instance.
#: @type: L{GlobalCommands}
commands = GlobalCommands()