• Re: {rightclick} New | Text Document

    From Wolf Greenblatt@3:633/280.2 to All on Tue Nov 26 09:50:41 2024
    On Sat, 9 Nov 2024 10:20:21 -0500, Zaidy036 wrote:

    Most of my stuff is written by you & others like Zaidy03 <Eric@Bloch.com>.

    Thanks for the mention.
    If I was doing something similar I would use one batch and its first
    step would be to ask how many (0-9) , kill batch if 0 otherwise use the number to do what I want. Why have multiple batches when one will work
    and take less file space? The make a shortcut to start the batch and
    perhaps also a "Shortcut Key" which would give efficient activation.+

    Thanks for noticing. I keep in my REM comments the name of the person
    who helped as I've tried at least once probably every script posted
    to this ng.

    Thanks for contributing to the newsgroup so we can find your stuff
    when we search the archives for your name and some related batch
    keyword!

    This one, for example, is by you based on the comments in the file.

    @echo off
    REM nettoggle.bat by Zaidy036 20210207 on alt.comp.os.windows-10
    REM Win10 network on/off toggle with admin privileges, Feb 7, 2021
    REM https://groups.google.com/g/alt.msdos.batch/c/sDNRLfXlUHo
    REM With an attempt to get admin privileges programmatically
    REM https://stackoverflow.com/questions/22367173/get-default-gateway-from-batch-file
    REM for /f "tokens=1-5" %%a in ('route -4 print 0.*') do @if "%%e"=="" if "%%a"=="%%b" set "ip=%%c"

    :: Verify permissions
    nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

    :: On Error No Admin
    if '%errorlevel%' NEQ '0' (
    echo Getting administrative privileges...
    goto DoUAC
    ) else ( goto getAdmin )

    :DoUAC
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

    :getAdmin
    pushd "%CD%"
    CD /D "%~dp0"
    REM
    set defgw=192.168.0.1
    set "ip="
    for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get DefaultIPGateway /value | find "I" "') do if not defined ip set ip=%%~a
    IF "%ip%"=="%defgw%" ( %comspec% /c %windir%\system32\route.exe delete 0.0.0.0 %defgw%) ELSE ( %comspec% /c %windir%\system32\route.exe add 0.0.0.0 mask 0.0.0.0 %defgw%)
    exit

    --- MBSE BBS v1.0.8.4 (Linux-x86_64)
    * Origin: Private News Server (3:633/280.2@fidonet)
  • From Wolf Greenblatt@3:633/280.2 to All on Tue Nov 26 10:04:40 2024
    On Mon, 25 Nov 2024 22:42:09 +0100, Herbert Kleebauer wrote:

    On 09.11.2024 05:14, Wolf Greenblatt wrote:

    Many of my programs are those you wrote that I found on the archives for
    this newsgroup whenever I search for things - like your spelling program.

    I love that it gives me three chances to spell a word and if I get it
    right, then it removes the word from my misspelled word list.

    Just found out, that it doesn't work properly in Win11, you have to
    insert a small pause before the word is spoken:

    cscript //nologo speak.vbs "<silence msec='700'/> %*"

    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: >:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    @echo off
    :: you have to create spell.txt with the words to be spoken
    :: enter x to terminate program

    chcp 65001>nul
    :: win11 Terminal doesn't support mode con
    :: MODE CON: COLS=50 LINES=10
    :: color f0
    cls

    ::echo createobject("sapi.spvoice").speak wsh.arguments(0)>speak.vbs

    :: or with rate/volume specified
    echo Set sapi = createObject("sapi.spvoice") >speak.vbs
    echo sapi.Rate = -3 >>speak.vbs
    ::echo sapi.Volume = 100 >>speak.vbs
    echo sapi.Speak wsh.arguments(0) >>speak.vbs

    for /f "tokens=*" %%i in (spell.txt) do call echo %%random%% %%i>>spellerr.txt
    sort /o spelltmp.txt spellerr.txt
    del spellerr.txt
    set /a ok=0
    set /a not_ok=0

    for /f "tokens=1*" %%i in (spelltmp.txt) do call :sub %%j
    :end
    del speak.vbs
    del spelltmp.txt
    echo.
    echo %ok% W”rter richtig, %not_ok% W”rter falsch
    echo.
    pause
    exit

    :sub
    echo.
    set /a n=0
    :sub1
    set /a n=n+1
    if %n%==3 goto :sub2
    :: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms717077(v=vs.85)
    cscript //nologo speak.vbs "<silence msec='700'/> %*"
    set a=
    set /p a=
    if /i "%a%"=="x" goto :end
    if /i not "%*"=="%a%" goto :sub1
    set /a ok=ok+1
    goto :eof

    :sub2
    echo 0 %*>>spellerr.txt
    echo ---------- %*
    set /a not_ok=not_ok+1
    timeout /t 2 >nul

    Thanks for that update. I'm on Windows 10 so I wasn't aware of this change. I'll fix mine so that when I move to Windows 11, it will still work.
    The way I run it is I have an app paths key called "spell".

    So I bring up the Runbox and then I type "spell" to add a squiggled word.
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
    spell.exe = C:\path-to\spelltxt.txt

    Then when I have time, type "bee" to test my personal spelling errors.
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
    bee.exe = C:\path-to\spellingbee.bat

    @echo off
    REM spellingbee.bat for Windows 10, originally by Herbert Kleebauer 20220211
    REM A self-test of redsquiggled words with a self-reinforcing misspelled DB.
    REM Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.usage.english
    REM Message-ID: <su5ifp$300$1@gioia.aioe.org>
    REM Customized for only the words that YOU misspell (just yours!)
    REM Randomly speaks thos words giving you a chance to type them correctly.
    REM Strategy being it _must_ be quick & easy; otherwise you won't do it.
    REM Purposefully uses audio instead of a visual to present the word.
    REM Strategically, this uses a visual to reinforce the correct spelling.
    REM Logic being that seeing it _before_ trying to spell it taints memory.
    REM Logic being seeing it _after_ an attempt tends to reinforce memory.
    REM Tactic is auto-honing of just the words _you_ have recently misspelled.
    REM Tactic is repetition specifically for the words _you_ misspelled most.
    REM Recommended one-time setup:
    REM 1. Set up an AppPath for a quick command: "Run > spell"
    REM (Use that command to add redsquiggled words into spelltxt.txt)
    REM HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
    REM spell.exe = C:\data\database\tts\spelltxt.txt
    REM 2. Set up an AppPath for a quick command: "Run > spellingbee"
    REM (Use that command to initiate the audio-visual testing process)
    REM HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
    REM spellingbee.exe = C:\data\database\tts\spellingbee.bat
    REM 3. Optionally, choose a filespecs for the spell txt, err & tmp files
    REM Note any explicit path is optional (it can be %TEMP% as the default).
    REM spelltxt.txt is manually maintained redsquiggled words (1 per line)
    REM spelltxt.err is a dynamic error file autocreated & automaintained
    REM spelltxt.tmp is a dynamic tmp file autocreated by this script
    REM Note: %TEMP% defaults to C:\Users\<username>\AppData\Local\Temp\
    REM Recommended daily-use model
    REM 4. Ad hoc, as words are redsquiggled, rightclick, correct & copy...
    REM Run > spell
    REM Paste the now-correctly-spelled redsquiggle into that spell.txt file
    REM Note: Most people pin a "Run" shortcut icon to their Win10 taskbar.
    REM Note: Otherwise, they press "Windows+R" to pop up the Run box.
    REM 5. Periodically, as needed, to refresh & reinforce spelling memory...
    REM Run > spellingbee
    REM a. Speaks words you previously doubly misspelled (in spellerr.txt)
    REM (if you spell it incorrectly, another entry is added)
    REM (if you spell it correctly, only one entry is removed)
    REM b. Then randomly speaks the list of misspelled words (in spelltxt.txt)
    REM (if you spell it incorrectly, one entry is added to the error file)
    REM (if you spell it correctly, it moves to the next word in the file)
    REM The more you misspell a word, the more it shows up in the error file.
    REM Each time a word is presented you have two chances to spell it out.
    REM The more you correctly spell it, the less it shows up.
    REM When incorrect, a "pause" allows timely introspection of errors.
    REM Pressing "x" will end the session (as will pressing "Control+C").
    REM
    REM Please choose a desired filespec for the spelling text, error & temp files.
    REM set spelltxtfile=%TEMP%\spelltxt.txt
    REM set spellerrfile=%TEMP%\spellerr.txt
    REM set spelltmpfile=%TEMP%\spelltmp.txt
    set spelltxtfile=C:\data\database\tts\spelltxt.txt
    set spellerrfile=C:\data\database\tts\spellerr.txt
    set spelltmpfile=C:\data\database\tts\spelltmp.txt
    MODE CON: COLS=50 LINES=10
    color f0
    cls
    echo createobject("sapi.spvoice").speak wsh.arguments(0)>speak.vbs

    for /f "tokens=*" %%i in (%spelltxtfile%) do call echo %%random%% %%i>>%spellerrfile%
    sort /o %spelltmpfile% %spellerrfile%
    del %spellerrfile%
    set /a ok=0
    set /a not_ok=0

    for /f "tokens=1*" %%i in (%spelltmpfile%) do call :sub %%j
    :end
    del speak.vbs
    del %spelltmpfile%
    echo.
    echo %ok% words correct, %not_ok% words incorrect
    echo.
    pause
    exit

    :sub
    echo.
    set /a n=0
    :sub1
    set /a n=n+1
    if %n%==3 goto :sub2
    cscript //nologo speak.vbs "%*"
    set a=
    set /p a=
    if /i "%a%"=="x" goto :end
    if /i not "%*"=="%a%" goto :sub1
    set /a ok=ok+1
    goto :eof

    :sub2
    echo 0 %*>>%spellerrfile%
    echo ---------- %*
    timeout /t 4 >nul
    set /a not_ok=not_ok+1

    --- MBSE BBS v1.0.8.4 (Linux-x86_64)
    * Origin: Private News Server (3:633/280.2@fidonet)