Jump to content
Macro Express Forums

terrypin

Members
  • Posts

    2,230
  • Joined

  • Last visited

  • Days Won

    23

Posts posted by terrypin

  1. Yes, that’s a viable option and for a while that was the way I used to handle capturing paths. But i soon reverted. For me a condensed window title is far preferable overall. I wouldn’t mind betting that, if you switch to full path titles, some of your existing macros will fail. I even had a period when I used a macro to toggle between those options, but that proved impractical after a while.

  2. Yes, I get the same problem occasionally. I suppose I've been lucky so far in not using my macro in any of them. What prompted it was my video projects covering family holidays, because to maintain a semblance of order I would file resources for a fortnight's vacation in subfolders like Day01, Day02... Walk-01, Walk-02, etc.

     

    EDITED 20 mins later:

    I suppose the easiest solution would be to include a few IF commands, like IF name = Pictures then change name to ...

     

    I haven't tried it but if you're keen you could consider the following advice from my archives. If you do so successfully, let me know and I'll hack it too.

    --------------------

     

    These special folders are called KnownFolders by the Windows Shell.

    The mappings of the KnownFolders to the ParsingName are stored in the registry here:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\

    The key names are the GUIDs for the KnownFolder, see below.

    To make Explorer stop opening the KnownFolder rather than the opening drive path as a normal folder, change its ParsingName property by removing either the shell::: or :: from the beginning, but leaving the rest of it as-is.

    So to change Downloads, open the following key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{374DE290-123F-4565-9164-39C4925E467B}

    Change ParsingName from this:

    shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{374DE290-123F-4565-9164-39C4925E467B}

    to this:

    {20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{374DE290-123F-4565-9164-39C4925E467B}

    You can also just delete the ParsingName property, but I don't recommend this since if you ever want to undo the change, you will have to find your backup. If you leave the GUID, you can just add shell::: or :: at the beginning. (They are interchangeable.)

    For changes to take effect, you need to log out and back in or restart.

    Here are GUIDs for some of the common folders:

    User Profile Root (C:\Users\<username>\)
    {f3ce0f7c-4901-4acc-8648-d5d44b04ef8f}

    Contacts
    {56784854-C6CB-462b-8169-88E350ACB882}

    Desktop
    {754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5}

    Downloads
    {374DE290-123F-4565-9164-39C4925E467B}

    Documents
    {FDD39AD0-238F-46AF-ADB4-6C85480369C7}

    Favorites
    {1777F761-68AD-4D8A-87BD-30B759FA33DD}

    Links
    {bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}

    Pictures
    {33E28130-4E1E-4676-835A-98395C3BC3BB}

    Music
    {4BD8D571-6D19-48D3-BE97-422220080E43}

    OneDrive
    {A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}

    Videos
    {18989B1D-99B5-455B-841C-AB7C74E4DDFC}

    For the full list, see the Microsoft Docs page:
    https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid

    --------------------

    Terry

  3. Hi Alan,

     

    That was quick! But perhaps you made it harder than necessary. I assumed that when I wanted to add subfolders I would always start with the parent folder active. So Alt+d immediately selects the path.


    Also, my optional separator was just part of subfolder name. And I padded the suffix to ensure correct sorting.

     

    // This should create a set of up to 99 new folders with names in form FolderName01, FolderName02, etc.
    // Typically enter name 'Day' to get subfolders called Day01, Day02, etc in the current project folder.
    Text Type (Simulate Keystrokes): <ALT>d
    Clipboard Copy
    Variable Set String %tParent% from the clipboard contents
    Variable Set String %tFolderName%: Prompt
    Variable Set Integer %nFolders%: Prompt
    Variable Set Integer %nStart%: Prompt
    Variable Set Integer %nCount% to 1
    Repeat Start (Repeat %nFolders% times) // Repeat for every folder
      Variable Modify Integer %nCount%: Convert to Text String (%tCount%)
      If Variable %nCount% Is Less Than or Equal To "9" // Need to pad with a zero
        Variable Set String %tPad% to "0"
      Else
        Variable Set String %tPad% to ""
      End If
      Variable Modify String: Replace "%tCount%" in %tCount% with "%tPad%%tCount%"
      Create Folder "%tParent%\%tFolderName%%tCount%"
      Delay: 0.1 seconds
    End Repeat
    
    <COMMENT Value="This should create a set of up to 99 new folders with names in form FolderName01, FolderName02, etc."/>
    <COMMENT Value="Typically enter name 'Day' to get subfolders called Day01, Day02, etc in the current project folder."/>
    <TEXT TYPE Action="0" Text="<ALT>d"/>
    <CLIPBOARD COPY/>
    <VARIABLE SET STRING Option="\x02" Destination="%tParent%" NoEmbeddedVars="FALSE"/>
    <VARIABLE SET STRING Option="\x01" Destination="%tFolderName%" Prompt="Enter the folder name prefix, including any separator required." Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/>
    <VARIABLE SET INTEGER Option="\x01" Destination="%nFolders%" Prompt="How many folders to create?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/>
    <VARIABLE SET INTEGER Option="\x01" Destination="%nStart%" Prompt="What should be the starting number?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/>
    <VARIABLE SET INTEGER Option="\x00" Destination="%nCount%" Value="1"/>
    <REPEAT START Start="%nStart%" Step="1" Count="%nFolders%" Save="TRUE" Variable="%nCount%" _COMMENT="Repeat for every folder"/>
    <VARIABLE MODIFY INTEGER Option="\x04" Destination="%nCount%" Variable="%tCount%"/>
    <IF VARIABLE Variable="%nCount%" Condition="\x05" Value="9" IgnoreCase="FALSE" _COMMENT="Need to pad with a zero"/>
    <VARIABLE SET STRING Option="\x00" Destination="%tPad%" Value="0" NoEmbeddedVars="FALSE"/>
    <ELSE/>
    <VARIABLE SET STRING Option="\x00" Destination="%tPad%" NoEmbeddedVars="FALSE"/>
    <END IF/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%tCount%" ToReplace="%tCount%" ReplaceWith="%tPad%%tCount%" All="FALSE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/>
    <CREATE FOLDER Path="%tParent%\\%tFolderName%%tCount%"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END REPEAT/>
      

     

    Terry

  4. I assumed that you wanted to do this from any folder. And with any of its files.

     

    It’s even easier if the folder is unchanged. But how can you, or therefore the macro, “grab a specified .mp3 file”? How is it specified, if not by selecting it in an open folder or typing its name? Once it’s “grabbed” it can then be opened by the macro automatically as I described.

     

     

  5. Hi Alan,

     

    After adjusting the number of arrow  up/down steps your macro worked fine here, although I didn't have time to test all the pane and ribbon configurations.

     

    One thing that I'd assumed from your description was that it should behave the same regardless of what was selected or focused in the target folder. IOW, the same behaviour as the built-in right click behaviour. But I see that if a subfolder is selected then the new element is created in that, not in the open folder. Or was that your intention?

     

    BTW, isn't it curious that our versions of MX Pro use different command text 🙂

     

      Text Type (Simulate Keystrokes): <UP ARROW><UP ARROW><UP ARROW><ARROW UP><ARROW UP>

     

    Turning to your earlier point about my own approach not working if the target folder is off screen, that's easily fixed by a single windows position command.

     

    Apart from its relative simplicity, my approach covers all file types in any user's context menu, without your 'Other' step. In my case I was surprised that there are 18 options, although most I haven't used for years!

     

    Folder
    Shortcut
    Microsoft Access Database
    AutoHotkey Script
    AviSynth Script
    Bitmap image
    Microsoft Word Document
    Project Machinery
    Microsoft Access Database
    Microsoft PowerPoint Presentation
    Microsoft Publisher Document
    WinRAR archive
    Rich Text Format
    Text Document
    Visio 2000 Drawing
    X3D Document
    Microsoft Excel Worksheet
    WinRAR ZIP archive

     

    Terry

  6. If no assumptions can be made about the starting conditions (such as what, if anything, is already selected) I'd try something like this:

     

    1. From the folder's dimensions, calculate the position of the point 10px from the its left edge and 90 px from its bottom edge, which should always be empty.

    2. Left click and use Shift+F10, or use right click, to open the context menu, followed by W to open the New menu.

    3. Then pop-up a message or multiple choice dialog allowing the choice of Enter for a folder or whatever types of 'a file' you are offering.

     

     

  7. Hi Alan,

     

    But curiously, on my Windows 10 system, the context menu that appears after right-clicking (or pressing Shift + 10) has NO options for creating a new folder or a new file!

     

    I think you've selected a folder before clicking in an empty area of the current folder (or hovering there and using Shift+F10).

     

    I do have an especially large context menu, but I think New is standard.

     

    Let's clear that up first before moving on to your other points.

     

     

  8. Thanks, that's  much clearer.

     

    The macro to do that should be straightforward, with steps as follows.

    1. The macro will be activated from File Explorer, with a file selected (e.g an MP3 or any other type that Ableton can open/import)

    2. It then captures its full path and filename and copies that text to the clipboard. Use both edit mode on the file and the Address box to achieve this. Post again showing us your macro if you can't get it working.

    3. The macro then activates Ableton and uses either its menu or KB shortcuts to open the File Open or File Import dialog

    4. Finally it pastes in the required file details. (Or, for greater flexibility, define a variable in step 2 and type that in here.)

    5. That music track should then open in Ableton.

     

    Terry

     

  9. Alexis,

     

    I'm still unclear about what it is you want to copy/paste? Activated and copied from where? Pasted to where? Apparently not copying the content, you said. (That's what I'd have assumed 'add a file' meant.) So do you mean its full path and filename?

     

    I have a macro that does that, used many times daily. With a filename in File Explorer selected, it copies its full path and filename to the clipboard. I can then do various things with it, typically paste it manually somewhere else, such as in a Save As dialog. Or an Open dialog of any other application.

     

    As usual, the devil is in the details!

     

    Terry

     

  10. I wrote a macro years ago that has proved very useful. On activation with its hot key it asks me to click two positions on the screen. Then it tells me the width and height of the rectangle. Usually it’s just the horizontal or vertical difference between those clicked positions that I’m seeking. The macro uses the same simple command as the example offered by @rberq.

     

    Like others I’m unclear about your exact objective, but let me know if you want my macro’s code.

     

    Terry

     

  11. And after another six years I'm looking again!

     

    This time it's prompted by a recently arisen frustrating problem. My DELL U2415 24" monitor loses all window positions and sizes if I power it off with its button. When I switch on the desktop is normal (and taskbar, icons, etc),  but the windows are all arranged in in some 'standard'-looking layout that would probably fit a smaller screen than my 1920 x 1200. So I have to tediously restore them. PITA.

     

  12. Back at my PC and I see that the only change needed is trivial, but I'll show the full code for the OP.

     

    Variable Set Integer %x% to 1
    Text File Begin Process: C:\Tmp\File Start.txt // This text file contains the index you want to process
      If Variable %Line[%x%]% Contains ","
        Variable Set Integer %CommaPosition% to the position of "," in %Line[%x%]%
        Variable Modify Integer: %CommaPosition% = %CommaPosition% - 1
        Variable Modify String: Copy part of text in %Line[%x%]% starting at 1 and %CommaPosition% characters long to %Line[%x%]%
        Variable Modify String: Append %Line[%x%]% to text file, "C:\Tmp\File End.txt" // This file receives the results
      Else
      // If line does not contain a comma it must be a header capital.
      // So it needs to be replaced by a blank line.
        Variable Modify String: Append %Blank% to text file, "C:\Tmp\File End.txt"
      End If
    Text File End Process

     

    <VARIABLE SET INTEGER Option="\x00" Destination="%x%" Value="1"/>
    <TEXT FILE BEGIN PROCESS Filename="C:\\Tmp\\File Start.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%Line[%x%]%" _COMMENT="This text file contains the index you want to process"/>
    <IF VARIABLE Variable="%Line[%x%]%" Condition="\x06" Value="," IgnoreCase="FALSE"/>
    <VARIABLE SET INTEGER Option="\x0E" Destination="%CommaPosition%" Text_Variable="%Line[%x%]%" Text="," Ignore_Case="FALSE"/>
    <VARIABLE MODIFY INTEGER Option="\x01" Destination="%CommaPosition%" Value1="%CommaPosition%" Value2="1"/>
    <VARIABLE MODIFY STRING Option="\x09" Destination="%Line[%x%]%" Variable="%Line[%x%]%" Start="1" Count="%CommaPosition%" NoEmbeddedVars="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x12" Destination="%Line[%x%]%" Filename="C:\\Tmp\\File End.txt" Strip="TRUE" NoEmbeddedVars="FALSE" _COMMENT="This file receives the results"/>
    <ELSE/>
    <COMMENT Value="If line does not contain a comma it must be a header capital."/>
    <COMMENT Value="So it needs to be replaced by a blank line."/>
    <VARIABLE MODIFY STRING Option="\x12" Destination="%Blank%" Filename="C:\\Tmp\\File End.txt" Strip="TRUE" NoEmbeddedVars="FALSE"/>
    <END IF/>
    <TEXT FILE END PROCESS/>

     

  13. Hi Alan,

     

    Thanks, so yours is the same as mine. But none of the available sounds by that route is a Beep.

     

    I'd like the MX Pro command to revert to a Beep, as its name implies. Mainly because it's distinctive and not dependent on my having switched on my speakers, as it uses the internal speaker. Which I understood is the one that helps identify bootup issues. Of course, it's possible my memory is failing faster than I'd like, and this PC doesn't have an internal speaker!  😉

     

     

     

×
×
  • Create New...