1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed MKSC and @SCINFO fail when LNK file name starts with space

Discussion in 'Plugins' started by Steve Fabian, Apr 4, 2012.

  1. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    I have some shortcut files whose name starts with space character - done for both vertical alignment and for sorting purposes. Apparently both MKSC and @SWINFO build a full path using trimmed filenames, even when the command quotes the name. The problem only occurs if the first character of the quoted string is space; if the full path is passed (quoted, of course) it's OK.
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    I had no idea that it was even possible to have a filename beginning with a space. I would have bet against it.

    I've uploaded a new build. If you want a space at the start of an argument, you're going to have to quote it -- even in a function.
     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    Thanks! It does the job perfectly! I used it to update a shortcut (changing only the "argument" field) that changes both screen resolution and screen saver timeout and exits - using two other commands of UIstuff. Three altogether in just one usage.

    BTW, in order to have "%+" in the "argument" field of the shortcut, I had to use "... %%+ ..." in the /a: field of MKSC. Without doubling the % signs it was expanded by the parser to the CommandSep character of the TCC instance executing MKSC, instead of being inserted into the link as the pseudovariable representing CommandSep.
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    That happens before my code ever sees it, as you can verify by inserting an ECHO before the real command. So yeah, you'll have to double the percent sign, or put it in strong quotes or whatever.
     
  5. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    As moderator, you might wish to change "Bug" to "Fixed". As the OP I should be able to do that... and it is less appropriate for the author of code to declare it fixed than for the one who reported it. WAD would be a different proposition.
     
  6. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    Still there is a minor problem - shortcut files on mapped network drives pointing to some system applications "cannot resolve file". Internal SHORTCUT command fails, too. The two I use that failed are "Add or Kill" and "Display" (i.e., window characteristics), both on the "All Users" desktop. In the user desktop several work correctly: link to IE's option dialog (use it to clear IE cache), control panel, date and time, network connections. I am not sure this can be solved. BTW, both the local and the mapped network drive use WinXP SP3, NTFS.
     
  7. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    I'm afraid I don't understand this. Can you give me instructions to create such a file?
     
  8. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    Open Control Panel. Right click on the application you want on the desktop. Select "Create shortcut". When it complains "... not ... here. ... desktop?" select Yes. Now you have a desktop shortcut to e.g. "Network Connections". The shortcut can now be modified, e.g., change its name, add a hotkey, etc. Note that SHORTCUT, MKSC and @SCINFO handle all shortcuts on local drives (intended to be run on the local system) perfectly; it is only some (but not all) shortcuts on mapped network drives (designed to be run only on the remote system) fail. Finding a solution is not essential for me; I can do anything I desire on the other system by walking a few steps. However, others who do not have physical access to remote systems may be interested (though they probably have remote access to the desktops and can deal with the issues without getting out of their chairs).
     
  9. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    If the shortcut is pointing to something on the remote system, I doubt that there's much I can do about it if it doesn't work. Sorry.
     
  10. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    As expected. Not a problem. Thanks for a very useful toolkit. Now if I could figure out how the same .INI directives specifying paths can be used on different systems with different drive letters...
     
  11. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    Suggestion for @SCREENRES: Like @SCINFO, accept letter codes used in SCREENRES command instead of magic numbers (or even full words)

    Suggestion for SCREENRES command and @SCREENRES function: report 1Hz as "default refresh rate", not as number

    Suggestions for SCREENRES command:
    - option to suppress final report without redirecting to NUL.
    - highlight the random number that must be reentered to verify screen parameter change
    - documentation: add the words "random" and "same" so text will read:
    "will prompt you to enter a three-digit random number to verify that you can still read the display. If you don’t enter the same number"

    add word "random" changing "enter a three-digit number to verify" to "enter a random three-digit number to verify"
     
  12. dcantor

    Joined:
    May 29, 2008
    Messages:
    505
    Likes Received:
    3
    I suggest instead of "random", the word "arbitrary".
     
  13. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    How on earth are you getting refresh rate of 1Hz? That shouldn't be possible!
     
  14. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Okay, I have a new build up for you.
     

Share This Page