• {rightclick} New | Text Document

    From Wolf Greenblatt@21:1/5 to All on Tue Oct 15 08:47:44 2024
    XPost: alt.comp.os.windows-11

    When I open a new text file, I just want it to open with some lines in it
    like this which would come from some kind of Microsoft Windows template.

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    What is the Windows magic that will allow a rightclick context menu
    selection of "{rightclick} New | Text Document" to create those lines?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Big Al@21:1/5 to Wolf Greenblatt on Tue Oct 15 09:53:51 2024
    XPost: alt.comp.os.windows-11

    On 10/15/24 08:47 AM, Wolf Greenblatt wrote:
    When I open a new text file, I just want it to open with some lines in it like this which would come from some kind of Microsoft Windows template.

    <snip>
    What is the Windows magic that will allow a rightclick context menu
    selection of "{rightclick} New | Text Document" to create those lines?
    Try this link. Go down to the response that's had 75 up votes.

    https://superuser.com/questions/34704/how-can-i-add-an-item-to-the-new-context-menu
    --
    Linux Mint 21.3, Cinnamon 6.0.4, Kernel 5.15.0-122-generic
    Al

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Herbert Kleebauer@21:1/5 to Wolf Greenblatt on Tue Oct 15 16:43:37 2024
    XPost: alt.comp.os.windows-11

    On 15.10.2024 14:47, Wolf Greenblatt wrote:

    When I open a new text file, I just want it to open with some lines in it like this which would come from some kind of Microsoft Windows template.

    =============================================================================

    =============================================================================

    =============================================================================

    I would use a batch to put the text into the Windows clipboard:

    @echo off
    (for /l %%i in (1,1,10) do @echo ==============================&echo.)|clip

    Then, when editing a text file, just press <CTRL>-V (or <WIN>-V
    if you have added more content to the clipboard) to insert the lines
    at any position you like. The batch also could ask which one of
    a collection of templates it should put into the clipboard.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Newyana2@21:1/5 to Wolf Greenblatt on Tue Oct 15 11:26:02 2024
    XPost: alt.comp.os.windows-11

    On 10/15/2024 8:47 AM, Wolf Greenblatt wrote:

    What is the Windows magic that will allow a rightclick context menu
    selection of "{rightclick} New | Text Document" to create those lines?


    You can add items to the right-click menu fairly easily. I have lots
    of them to "Open With" specific programs. In this case, if it were me,
    I'd just make a file the way I want it, leave it on the Desktop, then doubleclick that when I want the template, saving it as something
    else. I actually do that with Libre Office docs. I have contract templates
    and receipt templates for my business. When I write a new one I just
    copy the template, rename it to the new file, then use that.

    That's also what MSWord does with templates. The only difference
    is that it enforces not saving the file as the original because it has
    an extension .DOT.

    You could do all sorts of things with something like VBScript. But
    none of it would be easier than just leaving your template on the Desktop.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolf Greenblatt@21:1/5 to Herbert Kleebauer on Tue Oct 15 13:04:08 2024
    XPost: alt.comp.os.windows-11

    Herbert Kleebauer wrote on Tue, 15 Oct 2024 16:43:37 +0200 :

    I would use a batch to put the text into the Windows clipboard:

    @echo off
    (for /l %%i in (1,1,10) do @echo ==============================&echo.)|clip

    Then, when editing a text file, just press <CTRL>-V (or <WIN>-V
    if you have added more content to the clipboard) to insert the lines
    at any position you like. The batch also could ask which one of
    a collection of templates it should put into the clipboard.

    That worked! Thanks!

    I created C:\batchfiles\cliptext.bat containing the 3 lines below.
    @echo off
    REM cliptext.bat cliptext.bat seeds clipboard for subsequent paste
    (for /l %%i in (1,1,10) do @echo &=============================================================================&echo.)|clip

    Clicking on the batch file worked, but to make it a run command I added
    this key to the registry to invoke it from the run box.
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\cliptext.exe
    Value: C:\batchfiles\cliptext.bat

    Subsequently typing "Win+R | cliptext" instantly seeds the clipboard.
    Hooray! Thanks!

    Oops.
    Since I will use it a lot, I also wanted to pin a shortcut to the taskbar.

    But when created a shortcut to that batch file, Windows wouldn't allow me
    to pin it to the taskbar.

    To get Windows to allow me to pin the shortcut pointing to that batch file
    to the taskbar, I changed the shortcut target from
    C:\batchfiles\cliptext.bat
    to
    %comspec% /c start "" C:\batchfiles\cliptext.bat
    which allowed me to pin that shortcut pointing to that batch file to the Windows taskbar.

    But that shortcut also left an orphan command window on the screen every
    time it's clicked.

    To try to get rid of the orphan command window, I changed the shortcut
    target line to
    C:\Windows\System32\schtasks.exe /run /TN "cliptext"
    and I changed the shortcut comment line to
    %comspec% /c start "" C:\batchfiles\cliptext.bat
    and then I added a taskschd.msc system scheduled task of
    Create Task
    Name: cliptext
    Description: cliptext.bat seeds clipboard for subsequent paste.
    Actions > New
    Action: Start a program
    Program/script: %comspec%
    Add arguments: /c start "" C:\batchfiles\cliptext.bat

    But the shortcut still brought up an extraneous orphan command window.
    I'm out of tricks to try to get the orphan command window to disappear.

    But the batch file & the run box call to that batch file works fine!
    Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul@21:1/5 to Wolf Greenblatt on Tue Oct 15 13:38:47 2024
    XPost: alt.comp.os.windows-11

    On Tue, 10/15/2024 8:47 AM, Wolf Greenblatt wrote:
    When I open a new text file, I just want it to open with some lines in it like this which would come from some kind of Microsoft Windows template.

    ============================================================================= 12345678901234567890123456789012345678901234567890123456789012345678901234567 =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    =============================================================================

    What is the Windows magic that will allow a rightclick context menu
    selection of "{rightclick} New | Text Document" to create those lines?


    You did not say how many lines you wanted.

    Where is the interface going to be, to select the line count ?

    *******

    I could easily do that with Gawk.exe .

    BEGIN {
    { for (j=1; j<=9; j++) {
    for (i=1; i<=77; i++) printf("=")
    printf("\n\n")
    }
    }
    }

    gawk.exe -f lines.awk > output.txt

    *******

    [Picture]

    https://i.postimg.cc/Nf58KPSb/gawk-lines-awk.gif

    Paul

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Herbert Kleebauer@21:1/5 to Wolf Greenblatt on Wed Oct 16 00:44:55 2024
    XPost: alt.comp.os.windows-11

    On 15.10.2024 19:04, Wolf Greenblatt wrote:

    I created C:\batchfiles\cliptext.bat containing the 3 lines below.
    @echo off
    REM cliptext.bat cliptext.bat seeds clipboard for subsequent paste
    (for /l %%i in (1,1,10) do @echo &=============================================================================&echo.)|clip

    Clicking on the batch file worked, but to make it a run command I added
    this key to the registry to invoke it from the run box.
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\cliptext.exe

    But when created a shortcut to that batch file, Windows wouldn't allow me
    to pin it to the taskbar.

    Instead of messing around with shortcuts and the registry, I would
    use a small exe to start the batch. Execute the batch at the
    end of the posting to generate runbat.exe. If you execute
    runbat.exe a batch file with the same name in the same directory
    is executed.

    In your case, rename runbat.exe to cliptext.exe and your batch
    file to cliptext.exe.bat and store both files in the same directory.
    Now you can drag&drop cliptext.exe to the taskbar. If you click
    on it, cliptext.exe.bat is executed.

    The source code:

    winmain::
    jsr.l (GetCommandLine)

    eor.l r1,r1 ; not within "" flag
    move.l r0,r5
    move.l #name,r6
    _20: cmp.b #0,(r5)
    beq.b _10
    cmp.b #'"',(r5)
    bne.b _30
    not.l r1
    inc.l r5
    br.b _20
    _30: or.l r1,r1
    bne.b _40
    cmp.b #' ',(r5)
    beq.b _10
    _40: move.b (r5)+-,(r6)+-{s1}
    cmp.l #name_end,r6
    blo.b _20
    eor.l r0,r0
    br.b _100

    _10: move.l #'tab.',(r6)
    move.b #0,4.b(r6)

    moveq.l #1,-(sp) ; nShowCmd: 1 SW_SHOWNORMAL
    moveq.l #0,-(sp) ; lpDirectory
    moveq.l #0,-(sp) ; lpParameters
    move.l #name,-(sp) ; lpFile
    move.l #op,-(sp) ; lpOperation
    moveq.l #0,-(sp) ; hwnd
    jsr.l (ShellExecuteA)

    _100: move.l r0,-(sp)
    jsr.l (ExitProcess)

    op: dc.b "open",0
    name: blk.b 2000
    name_end:blk.b 10




    The binary:


    @echo off
    certutil -f -decode %~f0 runbat.exe>nul
    goto :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vcGVuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAA==
    -----END CERTIFICATE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Herbert Kleebauer@21:1/5 to Herbert Kleebauer on Wed Oct 16 01:49:56 2024
    XPost: alt.comp.os.windows-11

    On 16.10.2024 00:44, Herbert Kleebauer wrote:
    On 15.10.2024 19:04, Wolf Greenblatt wrote:

    I created C:\batchfiles\cliptext.bat containing the 3 lines below.
    @echo off
    REM cliptext.bat cliptext.bat seeds clipboard for subsequent paste
    (for /l %%i in (1,1,10) do @echo &=============================================================================&echo.)|clip

    Clicking on the batch file worked, but to make it a run command I added
    this key to the registry to invoke it from the run box.
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\cliptext.exe

    But when created a shortcut to that batch file, Windows wouldn't allow me
    to pin it to the taskbar.

    Instead of messing around with shortcuts and the registry, I would
    use a small exe to start the batch.

    It is even much simpler. Just rename cliptext.bat to cliptext.exe,
    then you can drag&drop it to the taskbar. Then rename it back to
    cliptext.bat and right-click in the taskbar and change the link in
    properties also to cliptext.bat.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolf Greenblatt@21:1/5 to Herbert Kleebauer on Tue Oct 15 23:12:41 2024
    XPost: alt.comp.os.windows-11

    On Wed, 16 Oct 2024 01:49:56 +0200, Herbert Kleebauer wrote:

    But when created a shortcut to that batch file, Windows wouldn't allow me >>> to pin it to the taskbar.

    Instead of messing around with shortcuts and the registry, I would
    use a small exe to start the batch.

    It is even much simpler. Just rename cliptext.bat to cliptext.exe,
    then you can drag&drop it to the taskbar. Then rename it back to cliptext.bat and right-click in the taskbar and change the link in
    properties also to cliptext.bat.

    That worked! Thanks! You're full of Windows tricks.
    How do you learn them all!

    Your suggestion above is a really neat trick because Windows can pin a shortcut to an exe to the taskbar but not a shortcut to a batch file, so, with your trick, the bat is temporarily renamed as an exe whose shortcut gets pinned first to the taskbar and then it's a matter of tidying up the automatic
    changes to the target to get the now-pinned shortcut to point to the batch file!

    It worked like a charm. Now I can seed the "New | Text Document" by either "Win+R | cliptext" or clicking on the "cliptext.lnk" pinned to the taskbar.

    However - only after it worked did I realize there's an *EVEN SIMPLER WAY!*

    All I had to do was pin a link to *any* existing executable file,
    and edit that link's target line to point to C:\batchfiles\cliptext.bat

    Arbitrarily I picked to make a shortcut to Notepad++ on the taskbar
    and then I changed that shortcut's target to C:\batchfiles\cliptext.bat

    I could have made a link to anything actually, but I was already using Notepad++ so I used that link (plus the icon is ok as it w/o changing it).

    It's this simple:

    1. Pin *any* executable shortcut to the taskbar (for example, Notepad++)
    2. Change the shortcut target to C:\batchfiles\cliptext.bat

    That's it!

    This is the current content of C:\batchfiles\cliptext.bat

    @echo off
    REM cliptext.bat seeds the clipboard for subsequent pastes
    (for /l %%i in (1,1,10) do @echo &=============================================================================&echo.)|clip

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Herbert Kleebauer@21:1/5 to Wolf Greenblatt on Wed Oct 16 09:44:38 2024
    XPost: alt.comp.os.windows-11

    On 16.10.2024 05:12, Wolf Greenblatt wrote:

    It's this simple:

    1. Pin *any* executable shortcut to the taskbar (for example, Notepad++)

    But if you pin an exe (or a shortcut to an exe), which already has
    an icon, to the taskbar, you can't later change the icon in the taskbar.
    If you pin an exe without an icon, for example the renamed batch file (cliptext.bat -> cliptext.exe) to the taskbar, you can later add an
    icon (for example the standard icon with 4 horizontal lines) .

    2. Change the shortcut target to C:\batchfiles\cliptext.bat

    And change the icon to anything you like (but you can do this only
    once).

    That's it!

    This is the current content of C:\batchfiles\cliptext.bat

    @echo off
    REM cliptext.bat seeds the clipboard for subsequent pastes
    (for /l %%i in (1,1,10) do @echo &=============================================================================&echo.)|clip

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Newyana2@21:1/5 to Wolf Greenblatt on Wed Oct 16 08:52:26 2024
    XPost: alt.comp.os.windows-11

    On 10/15/2024 11:12 PM, Wolf Greenblatt wrote:

    I could have made a link to anything actually, but I was already using Notepad++ so I used that link (plus the icon is ok as it w/o changing it).

    It's this simple:

    1. Pin *any* executable shortcut to the taskbar (for example, Notepad++)
    2. Change the shortcut target to C:\batchfiles\cliptext.bat

    That's it!

    It's even simpler. Dump the pinning nonsense and use a Quick
    Launch toolbar, which then acts normally. Though this is cross-posted
    to Win10/11. I've heard that QL is broken on Win11.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolf Greenblatt@21:1/5 to Herbert Kleebauer on Wed Oct 16 16:31:52 2024
    XPost: alt.comp.os.windows-11

    On Wed, 16 Oct 2024 09:44:38 +0200, Herbert Kleebauer wrote:

    It's this simple:

    1. Pin *any* executable shortcut to the taskbar (for example, Notepad++)

    But if you pin an exe (or a shortcut to an exe), which already has
    an icon, to the taskbar, you can't later change the icon in the taskbar.

    Slowly I'm finding that out. You're way ahead of me!
    It's clear you've done this before so you know the gotchas that I don't.

    If you pin an exe without an icon, for example the renamed batch file (cliptext.bat -> cliptext.exe) to the taskbar, you can later add an
    icon (for example the standard icon with 4 horizontal lines).

    In hindsight, I agree with you. I should probably keep a dummy exe around
    so that I don't have to bother changing names though - but same thing.

    I have to pin an exe without an icon & then change the icon once,
    once that icon is pinned to the taskbar. Otherwise it screws up.


    2. Change the shortcut target to C:\batchfiles\cliptext.bat

    And change the icon to anything you like (but you can do this only
    once).

    Thanks for those caveats, where I think I'll name it clipseed.
    Or, maybe "seedclip" as it's seeding the clipboard with text.

    Thank you very much for your wonderful batch file to seed the clipboard.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)