Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:using_with_tcl_tk [2018/04/10 17:37] – 6th color scheme aplsimplehowtos:using_with_tcl_tk [2019/09/15 14:30] (current) – links updated aplsimple
Line 11: Line 11:
  
 Below there is an attached zip file that provides this mutual helping of [[http://www.tcl.tk|Tcl/Tk]] and Geany. Below there is an attached zip file that provides this mutual helping of [[http://www.tcl.tk|Tcl/Tk]] and Geany.
 +
 +\\
  
 ===== List of features ===== ===== List of features =====
Line 18: Line 20:
   * calling a context help for [[http://www.tcl.tk|Tcl/Tk]] during Geany seance   * calling a context help for [[http://www.tcl.tk|Tcl/Tk]] during Geany seance
  
-  * [[http://www.tcl.tk|Tcl/Tk]] help pages can be made and called offline for quicker response+  * [[http://www.tcl.tk|Tcl/Tk]] help pages can be made and called offline for faster response
  
   * opening any number of menus containing any commands (programs) to run   * opening any number of menus containing any commands (programs) to run
Line 24: Line 26:
   * passing a selected text to the menu commands to process   * passing a selected text to the menu commands to process
  
-  * the selection can be passed as underlined ("_" instead " ")+  * the selection can be passed as underlined ("_" instead of " "), 'plused' ("+" instead of " ") or stripped of special symbols (", $, %, {}, [], <>, *)
  
   * commands can be run by itself and by shell in console box   * commands can be run by itself and by shell in console box
Line 30: Line 32:
   * commands can be run with or without waiting their completion   * commands can be run with or without waiting their completion
  
-  * internal command //%%s// means "edit/create in Geany a file(s) with name(s) = selected text" \\ (opens/creates in Geany //f1 f2 f3// files if //%s="f1 f2 f3"//+  * internal command //%%s// means "edit/create in Geany a file(s) with name(s) = selected text" \\ (opens/creates in Geany //f1 f2 f3// files if //%s="f1 f2 f3"//
-  * internal command //%"%s"// means "browse an internet link = selected text" +  * internal command //%"%s"// means "browse an internet link = selected text" 
-  * internal command //%"title" "message %s"// means "ask a confirmation, possibly with selected text"+  * internal command //%"title" "message %s"// means "ask a confirmation, possibly with selected text"
  
-  * a batch of commands can be under one menu item+  * a batch of commands can be united under a single menu item
  
   * any command can be confirmed, with message box of title and text including Geany selection   * any command can be confirmed, with message box of title and text including Geany selection
Line 40: Line 42:
   * commands can include backslashes as opposed to Unix's "/" (esp. for Windows)   * commands can include backslashes as opposed to Unix's "/" (esp. for Windows)
  
-  * hierarchy of menus+  * hierarchy of menus
  
-  * child menu can be called with or without waiting it, with or without closing its parent menu+  * child menu can be called with or without waiting it, with or without closing its parent menu 
 + 
 +  * a child menu can be called with closing its parent and calling back the parent after closing the child
  
   * menus can be called (or made afterwards) as 'stayed on the top'   * menus can be called (or made afterwards) as 'stayed on the top'
Line 52: Line 56:
   * menu items can be bound to hotkeys F1-F12 (by default they are bound to 1-9a-z)   * menu items can be bound to hotkeys F1-F12 (by default they are bound to 1-9a-z)
  
-  * menu items and their underlying commands can include up to counters of runs per a menu+  * menu items and their underlying commands can include up to 10 counters of runs per a menu
  
   * menu items and their underlying commands can be supplied with current date/time   * menu items and their underlying commands can be supplied with current date/time
Line 62: Line 66:
   * any menu item can be assigned to 'autorun' at start of [[using_with_tcl_tk|e_menu]] (submenus including)   * any menu item can be assigned to 'autorun' at start of [[using_with_tcl_tk|e_menu]] (submenus including)
  
-  * to 'autorun' may be assigned commands that are invisible in menu (submenus excluding)+  * commands that are invisible in menu may be assigned to 'autorun' (submenus including)
  
-  * any Tcl command(s) can be assigned to 'autorun' at start of [[using_with_tcl_tk|e_menu]]+  * Tcl command(s) can be assigned to 'autorun' at start of [[using_with_tcl_tk|e_menu]]
  
   * menus can be edited in Geany 'on fly' and then re-read   * menus can be edited in Geany 'on fly' and then re-read
Line 74: Line 78:
   * [[using_with_tcl_tk|e_menu]] can be started with a pause to delay its initialization   * [[using_with_tcl_tk|e_menu]] can be started with a pause to delay its initialization
  
-  * items can be run repeatedly with interval set in seconds+  * items can be run repeatedly at intervals set in seconds
  
-  * [[using_with_tcl_tk|e_menu]] neighbour applications can be killed with two keystrokes (well fit to clear+  * [[using_with_tcl_tk|e_menu]] neighboring applications can be killed with two keystrokes (sort of clearance)
  
-  * menu text font and font size may be set at call+  * there are a lot of 'look and feel' options (incl. highlighting 'master' or 'dangerous' menus)
  
-  * there are several color schemes of menu (inc. highlighting 'master' or 'dangerous' menus); this option as most others may be set at call+  * the options may be set at calling of [[using_with_tcl_tk|e_menu]] and/or in [OPTIONS] section of a menu
  
-  * parent menu options are inherited by child menu if not overridden at call of it+  * parent menu options are inherited by child menu and can be overridden by its [OPTIONS]
  
-  * [[https://git-scm.com/|git]] support of Geany IDE can be easily implemented with [[using_with_tcl_tk|e_menu]]+  * for an easy exercise, [[https://git-scm.com/|git]] as well as [[http://fossil-scm.org|fossil]] support of Geany IDE can be implemented with [[using_with_tcl_tk|e_menu]]
  
   * encoding of menus is utf-8   * encoding of menus is utf-8
  
 +\\
  
 ===== Context action of Geany IDE ===== ===== Context action of Geany IDE =====
  
-I try and show how the Geany context command can be used with all its beauty.+I try and show how the Geany context command can be used in all its beauty.
  
 Imagine we have a Python module under testing in Geany. And it is called with parameters. And the parameters are changed from time to time. Imagine we have a Python module under testing in Geany. And it is called with parameters. And the parameters are changed from time to time.
Line 114: Line 119:
  
 By this we don't touch Run settings of other Python modules. By this we don't touch Run settings of other Python modules.
 +
 +\\
  
 ===== Introduction to e_menu ===== ===== Introduction to e_menu =====
Line 123: Line 130:
 Please try this: Please try this:
  
-1. If you do not have [[http://www.tcl.tk|Tcl/Tk]] on your system, install it from [[http://www.tcl.tk|www.tcl.tk]]. Linux users have it preinstalled, most likely. Though in Linux it may be necessary to install tcl-tls package or even to update Tcl to 8.6 version. On Mac [[using_with_tcl_tk|e_menu]] hasn't been tested.+1. If you do not have [[http://www.tcl.tk|Tcl/Tk]] on your system, install it from [[http://www.tcl.tk|www.tcl.tk]]. Linux users have it preinstalled, most likely. Though in Linux it may be necessary to install //tklib, tcl-tls// packages or even to update Tcl to 8.6 version. On Mac [[using_with_tcl_tk|e_menu]] hasn't been tested.
  
-2. Unpack the below attached zip to save files:+2. Unpack the below attached zip to save: 
 + 
 +    e_menu 
 +    menus directory 
 +    src directory
  
-    e_help.tcl 
-    e_menu.tcl 
-    rarrow.png 
-    run_pause.bat 
-    run_pause.sh 
-    ...etc... 
 into some directory, e.g. /home/me/UTILS/e_menu (for Windows it may be C:\Users\me\UTILS\e_menu). into some directory, e.g. /home/me/UTILS/e_menu (for Windows it may be C:\Users\me\UTILS\e_menu).
  
 3. Go to Geany's menu 'Edit/Settings', then to 'Tools' page and enter in the 'Context action' field: 3. Go to Geany's menu 'Edit/Settings', then to 'Tools' page and enter in the 'Context action' field:
  
-    wish /home/me/UTILS/e_menu/e_menu.tcl "s=%s"+    wish /home/me/UTILS/e_menu/e_menu "s=%s"
  
 Uff. Now you should be able to call the context help. While editing your [[http://www.tcl.tk|Tcl/Tk]] script, select a [[http://www.tcl.tk|Tcl/Tk]] command or simply place the caret on it and call "Context action" from popup menu. You should see something like: Uff. Now you should be able to call the context help. While editing your [[http://www.tcl.tk|Tcl/Tk]] script, select a [[http://www.tcl.tk|Tcl/Tk]] command or simply place the caret on it and call "Context action" from popup menu. You should see something like:
Line 155: Line 160:
 {{:howtos:e_menu:e_menu2.png|}} {{:howtos:e_menu:e_menu2.png|}}
  
-The menu is rather simply organized and passed to e_menu.tcl as "m=menu.txt" parameter.+The menu is rather simply organized and passed to [[using_with_tcl_tk|e_menu]] as "m=menu.txt" parameter. 
 + 
 +\\
  
 ===== Calling e_menu ===== ===== Calling e_menu =====
Line 163: Line 170:
 **// **//
  
-    wish e_menu.tcl [s=%s] [m=menufile] [options]+    wish e_menu [s=%s] [m=menufile] [options]
  
 //** //**
Line 202: Line 209:
 |// fs=number //|size of fonts used in menu| fs=9| |// fs=number //|size of fonts used in menu| fs=9|
 |// "f1=font" //|name of font used in menu header| "f1=Liberation Sans" | |// "f1=font" //|name of font used in menu header| "f1=Liberation Sans" |
-|// "f2=font" //|name of font used in menu entries| "f1=Liberation Mono"|+|// "f2=font" //|name of font used in menu entries| "f2=Liberation Mono"|
 |// w=number //|width of menu items (in characters)| w=30 | |// w=number //|width of menu items (in characters)| w=30 |
-|// c=number //|index of color scheme (0 through 6)| c=1 |+|// c=number //|index of color scheme (0 through 12)| c=1 |
 |// o=number //|'ornament' (view mode)|o=0 - no header, no prompts shown \\ o=1 - header only shown (default) \\ o=2 - prompts only shown \\ o=3 - both prompts and header shown| |// o=number //|'ornament' (view mode)|o=0 - no header, no prompts shown \\ o=1 - header only shown (default) \\ o=2 - prompts only shown \\ o=3 - both prompts and header shown|
 |//bd=number //|sets a border width of menu items|bd=0 - minimum \\ bd=1| |//bd=number //|sets a border width of menu items|bd=0 - minimum \\ bd=1|
 +|//b1=number //|sets an internal vertical padding of menu items|b1=1|
 +|//b2=number //|sets an internal horizontal padding of menu items|b2=1|
 +|//b3=number //|sets an external vertical padding of menu items|b3=1|
 +|//b4=number //|sets an external horizontal padding of menu items|b4=1|
 |//t=1 //|sets a menu as a topmost window on screen|t=1| |//t=1 //|sets a menu as a topmost window on screen|t=1|
 |// g=+x+y //|sets (x,y) screen coordinates of menu| g=+700+200| |// g=+x+y //|sets (x,y) screen coordinates of menu| g=+700+200|
 |// wc=1 // |centers a menu on screen|wc=1| |// wc=1 // |centers a menu on screen|wc=1|
-|// "h=path" //|path to offline Tcl/Tk help (e.g. "h=/home/me/Tcl/tcl8.6")|<nowiki>"h=/home/me/DOC/www.tcl.tk/man/tcl8.6"</nowiki>+|// "h=path" //|path to offline Tcl/Tk help|<nowiki>"h=/home/me/DOC/www.tcl.tk/man/tcl8.6"</nowiki>
-|// "b=browser" //|a browser to be used for viewing Tcl/Tk help (also used in a menu command "%link")|b=/usr/bin/epiphany|+|// "b=browser" //|a browser to be used for viewing Tcl/Tk help (also used in a menu command "%link")|b=/usr/bin/epiphany|
 |// "u=string" //|value of string that is underscored|"u=%s"| |// "u=string" //|value of string that is underscored|"u=%s"|
 |// "qq=string" //|value of string with quotes (") escaped|"qq=%s"| |// "qq=string" //|value of string with quotes (") escaped|"qq=%s"|
-|// "dd=string" //|value of string with special symbols (", $, %) deleted and spaces converted to "_"|"dd=%s"|+|// "dd=string" //|value of string with special symbols (", $, %, {}, [], <>, *) deleted and spaces converted to "_"|"dd=%s"|
 |// "s0=string0" \\ "s1=string1" \\ -"-"- \\ "s9=string9"//| - strings used in commands as %s0, %s1, ..., %s9 wildcards|"s0=%s" can be used when it's desirable to process Geany's selection without having those HELP/EXEC/SHELL commands in menu; other parameters (s1, ..., s9) can contain environment variables or their combinations| |// "s0=string0" \\ "s1=string1" \\ -"-"- \\ "s9=string9"//| - strings used in commands as %s0, %s1, ..., %s9 wildcards|"s0=%s" can be used when it's desirable to process Geany's selection without having those HELP/EXEC/SHELL commands in menu; other parameters (s1, ..., s9) can contain environment variables or their combinations|
 |// "u0=string0" \\  "u1=string1" \\ -"-"- \\ "u9=string9"//|the same as s0...s9 strings modified so that all spaces are converted to "_"|"u1=%s-1st"| |// "u0=string0" \\  "u1=string1" \\ -"-"- \\ "u9=string9"//|the same as s0...s9 strings modified so that all spaces are converted to "_"|"u1=%s-1st"|
Line 225: Line 236:
 |// ah=list //|sets a list of hotkeys of autorun menu items of [HIDDEN] section to be run at start of [[using_with_tcl_tk|e_menu]]|ah=1,2,3| |// ah=list //|sets a list of hotkeys of autorun menu items of [HIDDEN] section to be run at start of [[using_with_tcl_tk|e_menu]]|ah=1,2,3|
 |// "a2=Tcl command(s)" //|sets Tcl command(s) to be run at start of [[using_with_tcl_tk|e_menu]] __after__ processing //a=list// (see above)|"a2=d {Hello! \n\n Today is [clock format [set systime [clock seconds]] -format {%A %d-%m-%Y %H:%M}] \n\n Current dir: [pwd]}"| |// "a2=Tcl command(s)" //|sets Tcl command(s) to be run at start of [[using_with_tcl_tk|e_menu]] __after__ processing //a=list// (see above)|"a2=d {Hello! \n\n Today is [clock format [set systime [clock seconds]] -format {%A %d-%m-%Y %H:%M}] \n\n Current dir: [pwd]}"|
-|// P=syms // |sets a symbol(s) used instead of "%" in the  [[using_with_tcl_tk|e_menu]] call|It's important if the caller of  [[using_with_tcl_tk|e_menu]] (Geany, shell) uses % literals conflicting with  [[using_with_tcl_tk|e_menu]]'s parameters. \\ Example of overcoming Geany's %d substitution: \\ wish e_menu.tcl "s=%s" P=# "t2=#A #d-#m-#Y #H:#M"|+|// P=syms // |sets a symbol(s) used instead of "%" in the  [[using_with_tcl_tk|e_menu]] call|It's important if the caller of  [[using_with_tcl_tk|e_menu]] (Geany, shell) uses % literals conflicting with  [[using_with_tcl_tk|e_menu]]'s parameters. \\ Example of overcoming Geany's %d substitution: \\ wish e_menu "s=%s" P=# "t2=#A #d-#m-#Y #H:#M"|
 |// pa=number //|sets a pause (in milliseconds) to suspend [[using_with_tcl_tk|e_menu]] before starting it; sometimes it may be desirable|pa=500| |// pa=number //|sets a pause (in milliseconds) to suspend [[using_with_tcl_tk|e_menu]] before starting it; sometimes it may be desirable|pa=500|
 |// "x*=string" //| e_menu wildcard %x* of commands|"x=%s" "x0=%s" "xz=%s"| |// "x*=string" //| e_menu wildcard %x* of commands|"x=%s" "x0=%s" "xz=%s"|
Line 237: Line 248:
 |// "om=0" //| om=0 overrides the [OPTIONS] menu options \\ (by default [OPTIONS] options overcome the options defined in the call string of [[using_with_tcl_tk|e_menu]])|om=0| |// "om=0" //| om=0 overrides the [OPTIONS] menu options \\ (by default [OPTIONS] options overcome the options defined in the call string of [[using_with_tcl_tk|e_menu]])|om=0|
  
-Note: options s0..s9 and u0..u9 can include wildcards used in menu commands, e.g.:+Note: options s0..s9u0..u9, x*, y*, z* can include wildcards used in menu commands, e.g.:
  
     "s0= run #%i0 at %t2"     "s0= run #%i0 at %t2"
Line 244: Line 255:
 See also "Processing wildcards" below. See also "Processing wildcards" below.
  
 +\\
  ==== Setting options in a menu file ====  ==== Setting options in a menu file ====
  
 Most options of a call string can be set in [OPTIONS] section of a menu file, e.g. : Most options of a call string can be set in [OPTIONS] section of a menu file, e.g. :
  
-    R:?6?  Firefox search for "%s" R: firefox -search "%s" +    R:  R: 6 
-    R: Wikipedia for "%s" R:%https://en.wikipedia.org/w/index.php?cirrusUserTesting=classic-explorer-i&search=%+ +    R: Firefox search for "%s" R: firefox -search "%s" 
-    R: Open/create file(s) "%s" R:%%s+    R: Wikipedia for "%s" R:%https://en.wikipedia.org/w/index.php?cirrusUserTesting=classic-explorer-i&search=%+ 
 +    R: Open/create file(s) "%s" R:%%s
     R: geany: edit all          R: geany readme.md wiki.txt e_help.tcl e_menu.tcl     R: geany: edit all          R: geany readme.md wiki.txt e_help.tcl e_menu.tcl
          
-    MW?6?  Git  MW: m=%PN/git.mnu "u=%s" o=0 w=50+    R:  R: 6 
 +    MW: Git  MW: m=%PN/git.mnu "u=%s" o=0 w=50
     MW: Tcl/Tk    MW: m=%PN/tcltk.mnu w=20     MW: Tcl/Tk    MW: m=%PN/tcltk.mnu w=20
     MW: Python    MW: m=%PN/python.mnu w=40     MW: Python    MW: m=%PN/python.mnu w=40
Line 277: Line 290:
 The //om=// option is of particular weight. By default, the menu [OPTIONS] take priority over the options defined in a call string. This can be overridden by setting //om=0// in the call string of [[using_with_tcl_tk|e_menu]] - after that the call string options would have more priority than the menu [OPTIONS]. But all the same, the final decision is left to the menu that can reset the //om=// option to //om=1// and override all previously set options of the call string or the parent menus. The //om=// option is of particular weight. By default, the menu [OPTIONS] take priority over the options defined in a call string. This can be overridden by setting //om=0// in the call string of [[using_with_tcl_tk|e_menu]] - after that the call string options would have more priority than the menu [OPTIONS]. But all the same, the final decision is left to the menu that can reset the //om=// option to //om=1// and override all previously set options of the call string or the parent menus.
  
 +Some options are intended mostly for [[using_with_tcl_tk|e_menu]] call string than for [OPTIONS] section. E.g. if you want to have a menu system 'project sensitive', do not include into [OPTIONS] such options as //PD=// (project directory) and //PN=// (project name). They are mostly for setting in a command line to call [[using_with_tcl_tk|e_menu]].
 +
 +And vice versa, if you want to have a specific menu iron bound to some project, include into its [OPTIONS] the //PD=, PN=// and //om=1//.
  
 +\\
  ==== Examples ====  ==== Examples ====
  
Line 285: Line 302:
  ** 1. **  ** 1. **
  
-    wish /home/me/e_menu/e_menu.tcl "s=%s" "m=menus/menu.mnu" \+    wish /home/me/e_menu/e_menu "s=%s" "m=menus/menu.mnu" \
       "h=/home/me/DOC/Tcl/tcl8.6" c=1 fs=11 \       "h=/home/me/DOC/Tcl/tcl8.6" c=1 fs=11 \
       "PD=/home/me/PG/projects/e_menu" b=/usr/bin/epiphany a=6,b       "PD=/home/me/PG/projects/e_menu" b=/usr/bin/epiphany a=6,b
Line 295: Line 312:
   * color scheme 1   * color scheme 1
   * font size 11   * font size 11
-  * working directory // /home/me/PG/projects/e_menu //+  * working directory // /home/me/PG/projects/e_menu // \\ (this would set //PN=e_menu// as 'project name', used as %PN wildcard in commands)
   * browser // epiphany //   * browser // epiphany //
   * two menu items to run at start with hotkeys '6' and 'b'   * two menu items to run at start with hotkeys '6' and 'b'
Line 319: Line 336:
     cd $DIR     cd $DIR
          
-    wish ./e_menu.tcl "s0=$PROJECT" "s1=$THEME" "s2=$SUBJ" "b=$BROWSER" "PD=$DIR" \+    wish ./e_menu "s0=$PROJECT" "s1=$THEME" "s2=$SUBJ" "b=$BROWSER" "PD=$DIR" \
       m=menus/git.mnu g=$LEFT+30 t=1 o=0 w=21 fs=10 pa=100 &       m=menus/git.mnu g=$LEFT+30 t=1 o=0 w=21 fs=10 pa=100 &
          
-    wish ./e_menu.tcl "b=$BROWSER" "PD=$DIR" \+    wish ./e_menu "b=$BROWSER" "PD=$DIR" \
       m=menus/wiki.mnu g=$LEFT+465 t=1 o=0 w=21 fs=10 pa=100 &       m=menus/wiki.mnu g=$LEFT+465 t=1 o=0 w=21 fs=10 pa=100 &
          
-    wish ./e_menu.tcl "b=$BROWSER" "PD=$DIR" \+    wish ./e_menu "b=$BROWSER" "PD=$DIR" \
       m=menus/templates.mnu g=$LEFT+808 t=1 o=0 w=21 fs=10 pa=100 a=1 &       m=menus/templates.mnu g=$LEFT+808 t=1 o=0 w=21 fs=10 pa=100 a=1 &
          
Line 332: Line 349:
     cd $curdir     cd $curdir
  
-Notice that all three menus are called as topmost independent applications (t=1, &) without 'ornament' (o=0), the last menu running 1st item at start (//tkcon// to be exact). Geany IDE is run with project files as passed parameters. This would result in the picture shown below. All menus share some options defined with environment variables (BROWSER, DIR, LEFT) while others (PROJECT, THEME, SUBJ) are supplied to //git.mnu// only for use in git commands as %s0, %s1 and %s2 wildcards.+Notice that all three menus are called as topmost independent applications (t=1, &) without 'ornament' (o=0), the last menu running 1st item at start (//tkcon// to be exact). Geany IDE is run with project files as passed parameters. This would result in the picture shown somewhere below. All menus share some options defined with environment variables (BROWSER, DIR, LEFT) while others (PROJECT, THEME, SUBJ) are supplied to //git.mnu// only for use in git commands as %s0, %s1 and %s2 wildcards.
  
 +\\
  
 ===== Creating e_menu files ===== ===== Creating e_menu files =====
  
 +\\
 ==== Structure of menu ==== ==== Structure of menu ====
  
Line 351: Line 370:
     <marker> name4 <marker> command4 continued     <marker> name4 <marker> command4 continued
          
-    # ... 
     # comments     # comments
 +    # ...
          
     [HIDDEN]     [HIDDEN]
     <marker> name5 <marker> command5     <marker> name5 <marker> command5
     <marker> name6 <marker> command6     <marker> name6 <marker> command6
 +    # ...
          
 +    [OPTIONS]
 +    # ... options of e_menu call string
     # ...     # ...
-    # comments 
  
 where //<marker>// can be one of following: where //<marker>// can be one of following:
Line 389: Line 410:
   * // ME/ //   * // ME/ //
   * // ME: // these ones call a child menu and close a parent   * // ME: // these ones call a child menu and close a parent
 +
 +  * // I: // Tcl commands (incl. the internal e_menu functions D, Q, S)
  
 Markers with "/" are the same as with ":"; the one and only difference is that in their corresponding commands all "\" are converted to "/". It's only for use in Windows and only for convenience. Markers with "/" are the same as with ":"; the one and only difference is that in their corresponding commands all "\" are converted to "/". It's only for use in Windows and only for convenience.
Line 420: Line 443:
 A //menu item name// can begin with //F1// through //F12// which means a hotkey F1...F12 for this name. By default, items have hotkeys //1// through //9// and //a// through //z//. For example: A //menu item name// can begin with //F1// through //F12// which means a hotkey F1...F12 for this name. By default, items have hotkeys //1// through //9// and //a// through //z//. For example:
  
-    RE: F1 Geany's help RE:%file:///usr/share/doc/geany/html/index.html+    RE: F1 Geany's help RE:%file:///usr/share/doc/geany/html/index.html
  
 - this would display [[using_with_tcl_tk|e_menu]] that would display (after second F1) the help of Geany IDE and close. - this would display [[using_with_tcl_tk|e_menu]] that would display (after second F1) the help of Geany IDE and close.
Line 426: Line 449:
 It's useful feature if you mapped F1 to Geany context action - then double pressing F1 brings up Geany's help and closes [[using_with_tcl_tk|e_menu]]. It's useful feature if you mapped F1 to Geany context action - then double pressing F1 brings up Geany's help and closes [[using_with_tcl_tk|e_menu]].
  
 +An item marked with //I:// refers to some internals, namely the direct execution of Tcl commands. D, Q, S procedures of [[using_with_tcl_tk|e_menu]] can be also used in //I:// items. Here a few examples:
 +
 +    I: Xterm in "%PD" I: D run bash in %PD; if {[Q "BASH" "Want to bash?"]} {cd "%PD"; S bash}
 +    
 +    I: Xterm in "%PD" (mute) I: cd "%PD"; S bash
 +    
 +    I: Console commands I: S dir \n echo \$PWD \n date
 +
 +where $ escaped as \$, CLI commands devided with \n.
 +
 +\\
 ==== Wildcards in menu names and commands ==== ==== Wildcards in menu names and commands ====
  
Line 447: Line 481:
 |// %u0 \\  %u1 \\ -"-"- \\ %u9 //| //u0=// parameter of [[using_with_tcl_tk|e_menu]] \\ //u1=// parameter of [[using_with_tcl_tk|e_menu]] \\ -"-"- \\  //u9=// parameter of [[using_with_tcl_tk|e_menu]]| |// %u0 \\  %u1 \\ -"-"- \\ %u9 //| //u0=// parameter of [[using_with_tcl_tk|e_menu]] \\ //u1=// parameter of [[using_with_tcl_tk|e_menu]] \\ -"-"- \\  //u9=// parameter of [[using_with_tcl_tk|e_menu]]|
 |// %i0 \\  %i1  \\ -"-"- \\  %i9  //| 0th counter of runs (it may be initialized with //i0=// parameter of [[using_with_tcl_tk|e_menu]]) \\  1st counter of runs (it may be initialized with //i1=// parameter of [[using_with_tcl_tk|e_menu]]) \\ -"-"- \\  9th counter of runs (it may be initialized with //i9=// parameter of [[using_with_tcl_tk|e_menu]])| |// %i0 \\  %i1  \\ -"-"- \\  %i9  //| 0th counter of runs (it may be initialized with //i0=// parameter of [[using_with_tcl_tk|e_menu]]) \\  1st counter of runs (it may be initialized with //i1=// parameter of [[using_with_tcl_tk|e_menu]]) \\ -"-"- \\  9th counter of runs (it may be initialized with //i9=// parameter of [[using_with_tcl_tk|e_menu]])|
-|// %"link" //| calls a browser with passed //link//; here //%b// corresponds to //b=// parameter of [[using_with_tcl_tk|e_menu]]| +|// %"link" //| calls a browser with passed //link//; here //%B// corresponds to //b=// parameter of [[using_with_tcl_tk|e_menu]]| 
-|// %"title" "message" //| puts out a query with //title// and //message// asking "OK" or "Cancel"; if answered "Cancel", cancels next commands of batch| +|// %"title" "message" //| puts out a query with //title// and //message// asking "OK" or "Cancel"; if answered "Cancel", cancels next commands of batch| 
-|// %file1 [file2 ...] //| calls Geany editor to edit/create //file(s)// e.g.: \\  ... to edit file(s) of Geany's selection: \\     //%%s// \\  ... to edit/create all files of project by one click: \\     // %mod1.c mod2.c mod3.c mod4.c mod1.h mod2.h mod3.h mod4.h etc.//|+|// %file1 [file2 ...] //| calls Geany editor to edit/create //file(s)// e.g.: \\  ... to edit file(s) of Geany's selection: \\     //%%s// \\  ... to edit/create all files of project by one click: \\     // %mod1.c mod2.c mod3.c mod4.c mod1.h mod2.h mod3.h mod4.h etc.//|
 |// ''<nowiki>%%</nowiki>'' //| % symbol| |// ''<nowiki>%%</nowiki>'' //| % symbol|
 |// %d //| Geany's wildcard %d (reserved)| |// %d //| Geany's wildcard %d (reserved)|
Line 457: Line 491:
 |// %p //| Geany's wildcard %p (reserved)| |// %p //| Geany's wildcard %p (reserved)|
  
 +\\
  ==== Processing wildcards ====  ==== Processing wildcards ====
  
Line 505: Line 540:
     "s1= Theme 1" "s2= Theme 1.2" "s3= Theme 1.2.3" "s4= Theme 1.2.3.4"     "s1= Theme 1" "s2= Theme 1.2" "s3= Theme 1.2.3" "s4= Theme 1.2.3.4"
  
 +\\
 ==== Examples ==== ==== Examples ====
  
Line 514: Line 549:
 Here is an example: Here is an example:
  
-    # menu for e_menu.tcl+    # menu for e_menu
          
      R/ GoldenDict              R/ "C:\Program Files (x86)\GoldenDict\GoldenDict.exe"      R/ GoldenDict              R/ "C:\Program Files (x86)\GoldenDict\GoldenDict.exe"
Line 523: Line 558:
          
      R: Firefox search for "%s" R: firefox -search "%s"      R: Firefox search for "%s" R: firefox -search "%s"
-     R: Wikipedia for "%s"      R: %https://en.wikipedia.org/w/index.php?cirrusUserTesting=classic-explorer-i&search=%++     R: Wikipedia for "%s"      R: %https://en.wikipedia.org/w/index.php?cirrusUserTesting=classic-explorer-i&search=%+
          
     MW/ Git menu               MW/ "m=menus\gitmenu.txt" o=0 "PD=%d" "s=%s"     MW/ Git menu               MW/ "m=menus\gitmenu.txt" o=0 "PD=%d" "s=%s"
Line 541: Line 576:
 The command batches contain mixed 'R' and 'S' markers which means that their commands are executed by itself and by shell in console box. The command batches contain mixed 'R' and 'S' markers which means that their commands are executed by itself and by shell in console box.
  
-The wildcard //%s// refers to Geany's selection. The wildcard //%dd// is the same as //%s// but it's used to get rid of special symbols as ", $, %, {, }, [, ].+The wildcard //%s// refers to Geany's selection. The wildcard //%dd// is the same as //%s// but it's used to get rid of special symbols as ", $, %, {, }, [, ], <, >, *.
  
-The wildcard //%q// is a query with 'title' and 'query text'. Being answered 'Cancel' it cancels the execution of batch.+The wildcard //%Q// is a query with 'title' and 'query text'. Being answered 'Cancel' it cancels the execution of batch.
  
-In // %// command you should use edging double quotes and internal single quotes in a title and a message. Symbol \//n// stands for an empty line.+In // %// command you should use edging double quotes and internal single quotes in a title and a message. Symbol \//n// stands for an empty line.
  
-    # git menu for e_menu.tcl+    # git menu for e_menu
          
     R:git status R: cd %PD     R:git status R: cd %PD
Line 558: Line 593:
     S:git add * S: git add *      S:git add * S: git add * 
          
-    R:git commit -m "%dd" R: %"Committing changes" "Commit with message\n\n'%dd' ?"+    R:git commit -m "%dd" R: %"Committing changes" "Commit with message\n\n'%dd' ?"
     R:git commit -m "%dd" R: cd %PD     R:git commit -m "%dd" R: cd %PD
     S:git commit -m "%dd" S: git commit -m "%dd"     S:git commit -m "%dd" S: git commit -m "%dd"
          
-    R:git commit -am "%s" R: %"Committing changes" "Add and commit with message\n\n'%s' ?"+    R:git commit -am "%s" R: %"Committing changes" "Add and commit with message\n\n'%s' ?"
     R:git commit -am "%s" R: cd %PD     R:git commit -am "%s" R: cd %PD
     S:git commit -am "%s" S: git commit -am "%s"     S:git commit -am "%s" S: git commit -am "%s"
          
-    R:git log --since="1 day ago" R: cd %PD +    R:git log "--since=1 day ago" R: cd %PD 
-    S:git log --since="1 day ago" S: git log --since="1 day ago"+    S:git log "--since=1 day ago" S: git log "--since=1 day ago"
          
-    R:git log -p --since="1 day ago" R: cd %PD +    R:git log -p "--since=1 day ago" R: cd %PD 
-    S:git log -p --since="1 day ago" S: git log -p --since="1 day ago"+    S:git log -p "--since=1 day ago" S: git log -p "--since=1 day ago"
          
     MW: Others MW: m=menus/git2.mnu w=40     MW: Others MW: m=menus/git2.mnu w=40
  
 +\\
  
 ===== Using e_menu ===== ===== Using e_menu =====
Line 605: Line 641:
  
   * //Ctrl+Left// to decrease a menu width   * //Ctrl+Left// to decrease a menu width
 +
 +If not redefined in the menu F1 calls this wiki page.
  
 You can use the right and the left arrow keys for calling and closing a submenu respectively. You can use the right and the left arrow keys for calling and closing a submenu respectively.
 +
 +\\
  
 ===== Detailed example ===== ===== Detailed example =====
  
- The following example illustrates step by step how to create and use [[using_with_tcl_tk|e_menu]] in Windows. Linux version is mostly the same and even more simple than Windows'. There is only one resulting Linux screenshot below.+ The following example illustrates step by step how to create and use [[using_with_tcl_tk|e_menu]] in Windows. Linux version is mostly the same and even more simple than Windows'. There are only two resulting Linux screenshots below.
  
 +\\
 ==== Step 1. Initial testing. ==== ==== Step 1. Initial testing. ====
  
Line 618: Line 659:
 It's also assumed in the next sections that [[using_with_tcl_tk|e_menu]] has been unpacked into //C:\UTILS\e_menu// directory. It's also assumed in the next sections that [[using_with_tcl_tk|e_menu]] has been unpacked into //C:\UTILS\e_menu// directory.
  
-Try [[using_with_tcl_tk|e_menu]] now. Set the caret on a word of your text edited in Geany IDE. You may also select a piece of text. Call //'Context action'// from popup menu or by a hotkey mapped to it.+Try [[using_with_tcl_tk|e_menu]] now. Set the caret on a word of your text edited in Geany IDE. You may also select a piece of text. Call //'Context action'// from popup menu or with a hotkey mapped to it.
  
 You should see the following: You should see the following:
Line 635: Line 676:
   * include the h= parameter into Geany context action:   * include the h= parameter into Geany context action:
  
-    wish C:\UTILS\e_menu\e_menu.tcl "s=%s" h=C:\DOC\www.tcl.tk\man\tcl8.6+    wish C:\UTILS\e_menu\e_menu "s=%s" h=C:\DOC\www.tcl.tk\man\tcl8.6
  
   * download the [[http://www.tcl.tk|Tcl/Tk]] help to C:\DOC directory with commands:   * download the [[http://www.tcl.tk|Tcl/Tk]] help to C:\DOC directory with commands:
Line 645: Line 686:
     wget -r -k -l 2 -p --accept-regex=.+/man/tcl8\.6.+ https://www.tcl.tk/man/tcl8.6/     wget -r -k -l 2 -p --accept-regex=.+/man/tcl8\.6.+ https://www.tcl.tk/man/tcl8.6/
  
-Now the offline help should be ready to call. If not, check the version of your //wget// utility. You may also check //C:\UTILS\e_menu\e_help.tcl// for the strings containing //htm// links to the offline help.+Now the offline help should be ready to call. If not, check the version of your //wget// utility.
  
 Retry [[http://www.tcl.tk|Tcl/Tk]] help calling. Select in your text (or place the caret on), for example, //package// and call Geany's context action. You should see something like: Retry [[http://www.tcl.tk|Tcl/Tk]] help calling. Select in your text (or place the caret on), for example, //package// and call Geany's context action. You should see something like:
Line 653: Line 694:
 Click on the first item and you would see the [[http://www.tcl.tk|Tcl/Tk]] help on //package//. Click on the first item and you would see the [[http://www.tcl.tk|Tcl/Tk]] help on //package//.
  
-==== Step 2. Creating menu. ====+\\ 
 +==== Step 2. Creating menu. ====
  
 Let's try and create a simple menu of 2 commands that would be available from Geany's context. Let's try and create a simple menu of 2 commands that would be available from Geany's context.
  
-The menu file will be //C:\UTILS\e_menu\test1.mnu//. We shall use commands that process Geany's selected text to:+The menu file will be //C:\UTILS\e_menu\menus\test1.mnu//. We shall use commands that process Geany's selected text to:
  
   * seek the selected internet pages   * seek the selected internet pages
   * view the selected words in a dictionary   * view the selected words in a dictionary
  
-Fill the //C:\UTILS\e_menu\test1.mnu// with the following:+Fill the //C:\UTILS\e_menu\menus\test1.mnu// with the following:
  
     R/ Firefox search for "%s" R/ ""C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -search "%s"     R/ Firefox search for "%s" R/ ""C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -search "%s"
Line 673: Line 715:
 After that include the menu file into the call string of Geany's context, for example: After that include the menu file into the call string of Geany's context, for example:
  
-    wish C:\UTILS\e_menu\e_menu.tcl "s=%s" h=C:\DOC\www.tcl.tk\man\tcl8.6 m=menus/test1.mnu+    wish C:\UTILS\e_menu\e_menu "s=%s" h=C:\DOC\www.tcl.tk\man\tcl8.6 m=menus/test1.mnu
  
 NOTE: if you dislike to have the HELP/EXEC/SHELL commands in your menu though the context would be desirable, you can use: NOTE: if you dislike to have the HELP/EXEC/SHELL commands in your menu though the context would be desirable, you can use:
Line 682: Line 724:
 For example, you can write Geany's context command as: For example, you can write Geany's context command as:
  
-    wish C:\UTILS\e_menu\e_menu.tcl "s0=%s" m=menus/test1.mnu+    wish C:\UTILS\e_menu\e_menu "s0=%s" m=menus/test1.mnu
  
 ... and //test1.mnu// as: ... and //test1.mnu// as:
Line 704: Line 746:
 {{:howtos:e_menu:p22.png|}} {{:howtos:e_menu:p22.png|}}
  
- +\\ 
-==== Step 3. Creating submenu. ====+==== Step 3. Creating submenu. ====
  
 The [[using_with_tcl_tk|e_menu]]'s menus are hierarchical. You can include a submenu into any menu with the following e.g.: The [[using_with_tcl_tk|e_menu]]'s menus are hierarchical. You can include a submenu into any menu with the following e.g.:
Line 744: Line 786:
     SW: echo %%PD is %PD SW: echo %%PD is %PD     SW: echo %%PD is %PD SW: echo %%PD is %PD
          
-    R: git init R: %"Init GIT" "Are you sure to init git in\n\n%PD ?"+    R: git init R: %"Init GIT" "Are you sure to init git in\n\n%PD ?"
     R: git init R: cd %PD     R: git init R: cd %PD
     S: git init S: git init     S: git init S: git init
Line 757: Line 799:
     S: git add * S: git add *      S: git add * S: git add * 
          
-    R: git commit -am '%s0' R: %"Committing changes" "Do you really want to commit with message\n'%s0' ?"+    R: git commit -am '%s0' R: %"Committing changes" "Do you really want to commit with message\n'%s0' ?"
     R: git commit -am '%s0' R: cd %PD     R: git commit -am '%s0' R: cd %PD
     S: git commit -am '%s0' S: git commit -am "%s0"     S: git commit -am '%s0' S: git commit -am "%s0"
Line 773: Line 815:
 First items only echo the options passed to [[using_with_tcl_tk|e_menu]]. Echos are useful for debugging btw. Other items refer to GIT system so that they would be working if you had installed GIT. First items only echo the options passed to [[using_with_tcl_tk|e_menu]]. Echos are useful for debugging btw. Other items refer to GIT system so that they would be working if you had installed GIT.
  
 +\\
 ==== Usage in Linux ==== ==== Usage in Linux ====
  
-Actually all previous considerations apply also to Linux usage of [[using_with_tcl_tk|e_menu]]. Therefore, Linux screenshot only is given here.+Actually all previous considerations apply also to Linux usage of [[using_with_tcl_tk|e_menu]]. Therefore, two Linux screenshot only are given here.
  
 {{:howtos:e_menu:tcl_geany_linux.png|}} {{:howtos:e_menu:tcl_geany_linux.png|}}
 +
 +\\
 +\\
 +\\
 +
 +{{:howtos:e_menu:geany_tcl_linux.png|}}
 +
 +\\
  
 ===== Tips and hints ===== ===== Tips and hints =====
  
 +\\
 ==== What's all those R, RE, RW, S, SE, SW, M, ME, MW mean? ==== ==== What's all those R, RE, RW, S, SE, SW, M, ME, MW mean? ====
  
Line 793: Line 845:
 ** W ** stands for //wait for completion of action// ** W ** stands for //wait for completion of action//
  
 +\\
 ==== Changing menus' look and feel ==== ==== Changing menus' look and feel ====
  
 Let me remind you how [[using_with_tcl_tk|e_menu]] is called: Let me remind you how [[using_with_tcl_tk|e_menu]] is called:
  
-    wish /home/me/UTILS/e_menu/e_menu.tcl "s=%s" [options]+    wish /home/me/UTILS/e_menu/e_menu "s=%s" [options]
  
 The following call options of [[using_with_tcl_tk|e_menu]] can influence on menus' look and feel: The following call options of [[using_with_tcl_tk|e_menu]] can influence on menus' look and feel:
Line 819: Line 872:
   * c=0   - sets an index of color scheme; 0 is default.   * c=0   - sets an index of color scheme; 0 is default.
  
-The following colors are available from c=0 to c=6:+The following colors are available from c=0 to c=12:
  
-{{:howtos:e_menu:c0.png?100|}} {{:howtos:e_menu:c1.png?100|}} {{:howtos:e_menu:c2.png?100|}} {{:howtos:e_menu:c3.png?100|}} {{:howtos:e_menu:c4.png?100|}} {{:howtos:e_menu:c5.png?100|}} {{:howtos:e_menu:c6.png?100|}}+{{:howtos:e_menu:c0.png?70|}} {{:howtos:e_menu:c1.png?70|}} {{:howtos:e_menu:c2.png?70|}} {{:howtos:e_menu:c3.png?70|}} {{:howtos:e_menu:c4.png?70|}} {{:howtos:e_menu:c5.png?70|}} {{:howtos:e_menu:c6.png?70|}} {{:howtos:e_menu:c7.png?70|}} {{:howtos:e_menu:c8.png?70|}} {{:howtos:e_menu:c9.png?70|}} {{:howtos:e_menu:c10.png?70|}} {{:howtos:e_menu:c11.png?70|}} {{:howtos:e_menu:c3.png?70|}}
  
 and their shadowed counterparts (3rd scheme is of special highlight as you see): and their shadowed counterparts (3rd scheme is of special highlight as you see):
  
-{{:howtos:e_menu:c0h.png?100|}} {{:howtos:e_menu:c0h.png?100|}} {{:howtos:e_menu:c0h.png?100|}} {{:howtos:e_menu:c3h.png?100|}} {{:howtos:e_menu:c0h.png?100|}} {{:howtos:e_menu:c5h.png?100|}} {{:howtos:e_menu:c0h.png?100|}}+{{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c3h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c5h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c0h.png?70|}} {{:howtos:e_menu:c0h.png?70|}}
  
 5th color scheme can be used to open a potentially dangerous menu, e.g. containing some irrevocable commands. 5th color scheme can be used to open a potentially dangerous menu, e.g. containing some irrevocable commands.
- 
-You can use a special form of item name to set a separator before it, namely: 
- 
-    R: ?N? name R: command 
- 
-where ?N? contains a number negative to set a visible separator (e.g. ?-5?) or positive to set a separating empty space (e.g. ?5?). The N number sets a vertical size of separator. 
  
 The dangerous and irrevocable commands may be collected under a red menu as big as a monitor screen, e.g.: The dangerous and irrevocable commands may be collected under a red menu as big as a monitor screen, e.g.:
Line 843: Line 890:
 {{:howtos:e_menu:danger2.png|}} {{:howtos:e_menu:danger2.png|}}
  
 +You can use a special form of menu item name to set a separator, namely:
  
 +    R:    R: N
 +    
 +       or
 +    
 +    R: -- R: N
 +
 +where N sets a vertical size of separator. If the item name contains "-" symbol(s) it means a visible separator, otherwise it sets a separating blank space.
 +
 +
 +\\
 +==== Warnings of menus ====
 +
 +Using //a1=// call parameter, you can warn a user about potential risks of an open menu, e.g.:
 +
 +    MW: Dangerous MW: m=menus/git2.mnu w= bd=7 fs=50 c=5 "a1=if {![Q \"DANGER!\" \"These commands are dangerous\nand can set the world on fire!\n\nContinue?\"]} exit"
 +
 +Here the Tcl commands are used to exit and close the dangerous menu possibly open by mistake. Q is a query with "head" and "message" that can contain the above mentioned wildcards. Q returns 'false' if answered 'Cancel' so that 'exit' Tcl command closes the menu.
 +
 +When calling a menu item, you can use //%Q "head" "message"// in a command batch. It's the same query with the difference that [[using_with_tcl_tk|e_menu]] stops the batch of commands after answering 'Cancel'. For example:
 +
 +    R:git reset --hard HEAD R: %Q "RESET" "This cancels the last uncommitted changes and resets to the last commited state!\n\nDo you want to RESET ?\n\n(VERY LIKELY IT'S CANNOT BE UNDONE)"
 +    R:git reset --hard HEAD R: cd %PD
 +    S:git reset --hard HEAD S: git reset --hard HEAD
 +
 +- here the cancelled commands are 'cd' and 'git reset'.
 +
 +\\
 ==== Counting and timing commands ==== ==== Counting and timing commands ====
  
Line 858: Line 933:
   * // %i9 // - are counters of item runs   * // %i9 // - are counters of item runs
  
-It's useful feature for commands that are logging or marking their data (files, directories etc.) with a current time, date and/or counter. There are 10 run counters per a menu and time/date formats that can be set at call.+It's useful feature for commands that are logging or marking their data (files, directories etc.) with a current time, date and/or counter. There are 10 run counters per a menu and 10 time/date formats that can be set at call.
  
 Here is a typical example: Here is a typical example:
Line 868: Line 943:
     "My_function_of_all: amending N3 made at 2018-03-31_14:15:07"     "My_function_of_all: amending N3 made at 2018-03-31_14:15:07"
  
 +\\
 ==== Running commands at start ==== ==== Running commands at start ====
  
Line 880: Line 956:
 Then, if you would desire to destroy and/or re-run the 'autorun' suite of menus, you may press //Ctrl+D// and/or //Ctrl+R// on the 'master' menu. Then, if you would desire to destroy and/or re-run the 'autorun' suite of menus, you may press //Ctrl+D// and/or //Ctrl+R// on the 'master' menu.
  
-The master menu could be colored in 3rd color scheme that would distinguish it among others. 3rd color scheme menus aren't shadowed even while losing a focus. And of course [[using_with_tcl_tk|e_menu]] being //open source// allows you to change and expand its color schemes (see //e_menu.tlc//). +The master menu could be colored in 3rd color scheme that would distinguish it among others. 3rd color scheme menus aren't shadowed even while losing a focus. And of course [[using_with_tcl_tk|e_menu]] being //open source// allows you to change and expand its color schemes list (see //e_menu.tcl//). 
  
 See above //'Calling a menu'// section, options //a=, ah=//. Also //'Creating a menu'// section describes how to include hidden commands into a menu. See above //'Calling a menu'// section, options //a=, ah=//. Also //'Creating a menu'// section describes how to include hidden commands into a menu.
Line 889: Line 965:
  
     cd %DIR%     cd %DIR%
-    start wish %EMDIR%/e_menu.tcl "m=menus/gitmenu.mnu" +    start wish %EMDIR%/e_menu "m=menus/gitmenu.mnu" 
-    start wish %EMDIR%/e_menu.tcl "m=menus/menu.mnu"+    start wish %EMDIR%/e_menu "m=menus/menu.mnu"
     start cmd.exe /c "C:\Program Files (x86)\Geany\bin\geany.exe" readme.md wiki.txt e_help.tcl e_menu.tcl     start cmd.exe /c "C:\Program Files (x86)\Geany\bin\geany.exe" readme.md wiki.txt e_help.tcl e_menu.tcl
  
Line 915: Line 991:
 Insert into "menus/menu.mnu" the following line (it will be useful by itself in future): Insert into "menus/menu.mnu" the following line (it will be useful by itself in future):
  
-    R: Open all R: %readme.md wiki.txt e_help.tcl e_menu.tcl+    R: Open all R: %readme.md wiki.txt e_help.tcl e_menu.tcl
  
 ... and assuming that "Open all" entry is number 8 in menu.mnu, change its call so: ... and assuming that "Open all" entry is number 8 in menu.mnu, change its call so:
  
-    start wish %EMDIR%/e_menu.tcl "m=menus/menu.mnu" a=8+    start wish %EMDIR%/e_menu "m=menus/menu.mnu" a=8
  
 That's all. Minus a special start of Geany in batch file. Plus a useful menu command that allows __to restore your project file list__ in Geany IDE. That's all. Minus a special start of Geany in batch file. Plus a useful menu command that allows __to restore your project file list__ in Geany IDE.
  
 +\\
 ==== Starting menu items at intervals ==== ==== Starting menu items at intervals ====
  
Line 946: Line 1022:
          
     R: Run periodic reminding of rest at 45 min interval R: ?-45*60/-15*60? stopwork_arbeiten %TI     R: Run periodic reminding of rest at 45 min interval R: ?-45*60/-15*60? stopwork_arbeiten %TI
-    R: Run batches of commands periodically R: ?60*60-2/-1:a=4,5/-1:ah=1,2? begin_of_batch 
  
-The last two tasks should be explained in details. The common format of periodic command is following:+The last task should be explained in details. The common format of periodic command is following:
  
     ?NSEC/NSEC1:a=n1,n2/NSEC2:ah=n3,n4/.../TN=X:ah=n5/? TASK_COMMAND %TI     ?NSEC/NSEC1:a=n1,n2/NSEC2:ah=n3,n4/.../TN=X:ah=n5/? TASK_COMMAND %TI
Line 975: Line 1050:
     * repeat all     * repeat all
  
-The batch 
- 
-    ?60*60-2/-1:a=4,5/-1:ah=1,2? begin_of_batch 
- 
-means: 
- 
-    * run "begin_of_batch" 
-    * wait 1 hour-2 seconds 
-    * run "begin_of_batch" 
-    * wait 1 second 
-    * run commands of menu with numbers 4 and 5 
-    * wait 1 second 
-    * run hidden commands of menu with numbers 1 and 2 
-    * repeat all 
  
 We could easily set the task of theater show: We could easily set the task of theater show:
Line 1022: Line 1083:
     * 20 seconds of part 3 showing     * 20 seconds of part 3 showing
     * curtain     * curtain
 +
 +Here is the show and even a spectator:)
 +
 +{{:howtos:e_menu:miaou.jpg|}}
  
 You may desire to stop this periodical stuff manually. Just call it again and [[using_with_tcl_tk|e_menu]] would stop it on your confirmation. You may desire to stop this periodical stuff manually. Just call it again and [[using_with_tcl_tk|e_menu]] would stop it on your confirmation.
  
 +\\
 ==== Making menus 'project sensitive' ==== ==== Making menus 'project sensitive' ====
  
Line 1032: Line 1098:
  
     cd /home/me/PG/projects/my_best_project     cd /home/me/PG/projects/my_best_project
-    wish /home/me/UTILS/e_menu.tcl ... (run common menus) +    wish /home/me/UTILS/e_menu ... (run common menus) 
-    geany ...                          (run Geany IDE)+    geany ...                     (run Geany IDE)
  
 then 'my_best_project' will be 'project name'. then 'my_best_project' will be 'project name'.
Line 1043: Line 1109:
 So, you can have a lot of menus in "%PN" subdirectory of [[using_with_tcl_tk|e_menu]] that are specific for your current project and the one and only Geany context command for all projects like that: So, you can have a lot of menus in "%PN" subdirectory of [[using_with_tcl_tk|e_menu]] that are specific for your current project and the one and only Geany context command for all projects like that:
  
-    wish /home/me/UTILS/e_menu.tcl "s=%s" "m=%PN/main.mnu" ...+    wish /home/me/UTILS/e_menu "s=%s" "m=%PN/main.mnu" ...
  
 It would open the main menu of your current project as Geany's context command. It would open the main menu of your current project as Geany's context command.
  
 Also you can set in the calling string of [[using_with_tcl_tk|e_menu]] "PN=projectname" parameter that would override a value of %PN wildcard taken from a working directory. It may be suitable when your different projects are named equally (e.g. /.../Java/Project1 and /.../JavaScript/Project1). Also you can set in the calling string of [[using_with_tcl_tk|e_menu]] "PN=projectname" parameter that would override a value of %PN wildcard taken from a working directory. It may be suitable when your different projects are named equally (e.g. /.../Java/Project1 and /.../JavaScript/Project1).
 +
 +The environment variable E_MENU_PN has the highest priority in setting the project name. E.g., in Linux you can call [[using_with_tcl_tk|e_menu]] this way:
 +
 +    export E_MENU_PN=myproject
 +    wish /home/me/UTILS/e_menu "s=%s" "m=%PN/main.mnu" ...
  
 It would be convenient to have a batch of common menus that are not related to Geany's context and are called just before starting Geany IDE. Using g=+X+Y (geometry) and t=1 (stay on top) parameters you can dispose the common menus at left or right side of screen to have them at hand. And while coding in Geany IDE, you are free to use a project specific menu bound to Geany context command. It would be convenient to have a batch of common menus that are not related to Geany's context and are called just before starting Geany IDE. Using g=+X+Y (geometry) and t=1 (stay on top) parameters you can dispose the common menus at left or right side of screen to have them at hand. And while coding in Geany IDE, you are free to use a project specific menu bound to Geany context command.
  
 +\\
 ==== Closing all menus ==== ==== Closing all menus ====
  
Line 1063: Line 1135:
 However, it's worth noticing that this feature is buggy under Linux and generally doesn't work under Windows. However, it's worth noticing that this feature is buggy under Linux and generally doesn't work under Windows.
  
 +\\
 ==== Sort of debugging ==== ==== Sort of debugging ====
  
Line 1074: Line 1147:
  
 If your calling [[using_with_tcl_tk|e_menu]] fails at start, you can call it in console so that you would see its error messages. You can use also a0=, a1=, a2= parameters to check if your starting list (a=) is run properly. See above "Calling e_menu" section. If your calling [[using_with_tcl_tk|e_menu]] fails at start, you can call it in console so that you would see its error messages. You can use also a0=, a1=, a2= parameters to check if your starting list (a=) is run properly. See above "Calling e_menu" section.
 +
 +A command useful for debugging is a console echo if properly included in a menu, e.g.:
 +
 +    S: Echo: %%s1  S: echo %s1
  
 D and S commands can be used in a0=, a1=, a2= parameters to show messages and run commands in console, e.g.: D and S commands can be used in a0=, a1=, a2= parameters to show messages and run commands in console, e.g.:
  
     "a0=D starting e_menu" "a1=D start inits" "a2=D end of inits"     "a0=D starting e_menu" "a1=D start inits" "a2=D end of inits"
 +
 +\\
  
 ===== Issues ===== ===== Issues =====
  
-[[using_with_tcl_tk|e_menu]] is still under development and for now is under a heavy testing, so it isn't totally faultless and ideal as all in the world. As my Geany too, alas.+Although being simple and humble, [[using_with_tcl_tk|e_menu]] isn't totally faultless and ideal as all in the world. As my Geany too, alas.
  
-Regretfully, there are some bugs with Geany's passing of selected text to its context command.+Regretfully, there are some issues with Geany's passing of selected text to its context command.
  
 E.g. there is a problem of calling the context action in Windows version of Geany, namely a hotkey doesn't work if you select something more complex than just Latin letters (e.g. ## or {}) though the popup menu copes with this selection OK. E.g. there is a problem of calling the context action in Windows version of Geany, namely a hotkey doesn't work if you select something more complex than just Latin letters (e.g. ## or {}) though the popup menu copes with this selection OK.
Line 1094: Line 1173:
  
 You should take this into account, being aware of this behaviour of Geany. You should take this into account, being aware of this behaviour of Geany.
 +
 +\\
  
 ===== Downloading ===== ===== Downloading =====
Line 1099: Line 1180:
 [[using_with_tcl_tk|e_menu]]'s zip file is available here: [[using_with_tcl_tk|e_menu]]'s zip file is available here:
  
-{{ :howtos:e_menu:tcl_geany.zip |}}+[[https://github.com/aplsimple/e_menu/archive/master.zip|github.com/aplsimple/e_menu]]
  
-Notice that it's still a raw version of [[using_with_tcl_tk|e_menu]]. Its contents and structure are //very likely// disposed to change.+or here: 
 + 
 +[[https://chiselapp.com/user/aplsimple/repository/e_menu/zip/trunk/e_menu.zip|chiselapp.com]] 
 + 
 +Home page: 
 + 
 +[[https://aplsimple.github.io/en/tcl/e_menu/|aplsimple.github.io]] 
 + 
 +Notice that [[using_with_tcl_tk|e_menu]] is still disposed to updateI would try and support its [[https://aplsimple.github.io/en/tcl/e_menu/|aplsimple.github.io]] version in a working state. 
 + 
 +\\
  
 ===== Acknowlegements ===== ===== Acknowlegements =====
Line 1111: Line 1202:
 To be so light and at that to be so predictable and powerful as those software behemoths like Eclipse or PyCharm - isn't it a wonder? To be so light and at that to be so predictable and powerful as those software behemoths like Eclipse or PyCharm - isn't it a wonder?
  
-Thanks so much\\+Also, the applied tool, namely the great and awful Tcl/Tk would never stop to amaze as well. Though the first impression of Tcl is 'What a s...!' Second, third, fourth and ..th impressions are the same till one day this thing begins to tease your brains and make to wonder. 
 + 
 +An unexpected and pleasant discovery had occurred while me coding [[using_with_tcl_tk|e_menu]], namely the wonderful [[http://fossil-scm.org|Fossil VCS]]. Somehow its power and lightweight resemble Geany's. 
 + 
 +And these wonders tend to become //a movable feast//. 
 + 
 +Thankful so much to all \\
 Alex Plotnikov Alex Plotnikov
  
 +\\
  
 ===== See also ===== ===== See also =====
  
-https://github.com/geany/geany/issues/1808+Home page: [[https://aplsimple.github.io/en/tcl/e_menu/|aplsimple.github.io]] 
 + 
 +More screenshots of [[using_with_tcl_tk|e_menu]]: 
 +  * https://github.com/geany/geany/issues/1808 
 + 
 +A sort of proposal: 
 +  * https://github.com/geany/geany/issues/1836
  
-https://github.com/geany/geany/issues/1807+A sort of conversation: 
 +  * https://github.com/geany/geany/issues/1807
  
-https://wiki.geany.org/howtos/pydocw+Using Geany's context to get Python 2.7 help: 
 +  * https://wiki.geany.org/howtos/pydocw
  
-https://wiki.geany.org/howtos/using_git_with_geany+Using //git// in Geany IDE: 
 +  * https://wiki.geany.org/howtos/using_git_with_geany
  
  
 {{tag>howto tcl}} {{tag>howto tcl}}
Print/export