Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2009
    Posts
    3

    Creating shortcut help

    First let me say i'm new and I do not script. I am trying to add a shortcut to the desktop via shell create shortcut. i can put in all the info (description, point it to the exe etc) and it works fine.. that is when I hit O.K. it seems like it works fine.. but.. I have command line parameters and when I add those to the shortcut CMDLine I get a syntax error. All I am doing is copying and pasting the command line info from the shortcut properties to this CMDline box. Oh and if it helps.. this is the 3rd action I have in the post install area

    Here is the command line parameters:

    C:\TNM\System\TNM.exe -hax0r INI="C:\TNM\TNM\System\TNM.ini" USERINI="C:\TNM\TNM\System\TNMUser.ini" log=TNM.log

    I have tried with the whole line in quotes and without the quotes. I get an error either way. Here is the error I get:

    Without the line in quotes:

    Line 3 <name> expected error '\'

    If I put the whole thing in quotes I get:

    Line=3" ')' expected near 'C'

    The setup factory program should not care what my command line says.. it should just add what I tell it to. This is strange to me because it works fine without the command line, but then of course the shortcut will not work.

    I know the shortcut works with my command line parameters, there is no error in the command line for the shortcut itself. Please help :-)
    Last edited by John P; 07-22-2009 at 04:39 PM.

  2. #2
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    You need to 'escape' your quotes and backslashes....
    and you need to seperate it out -- one bit is the "file to run" the 2nd bit is the parameters; assuming you're creating a desktop shortcut, try this:

    Code:
    Shell.CreateShortcut(_DesktopFolder, "My Desktop Shortcut", "C:\\TNM\\System\\TNM.exe", "-hax0r INI=\"C:\\TNM\\TNM\\System\\TNM.ini\" USERINI=\"C:\\TNM\\TNM\\System\\TNMUser.ini\" log=TNM.log", "C:\\TNM\\System", "", 0, SW_SHOWNORMAL, {}, "Sample Shortcut with parameters")
    NOTE: This assumes a fixed location -- you should be using SessionVar.Expand("%AppFolder%\\System\\TNM.EXE") etc.

    (btw: it's always good to post what you've tried so we can see where you went wrong)


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  3. #3
    Join Date
    Jul 2009
    Posts
    3
    Er.. O.k. here is the whole thing you wish to see:
    (sorry I don't know how to put it in code on this forum.)

    Shell.CreateShortcut(Shell.GetFolder(SHF_DESKTOP), "The Nameless Mod Standalone", SessionVar.Expand("%AppFolder%\\System\\TNM.exe"), "C:\TNM\System\TNM.exe -hax0r INI="C:\TNM\TNM\System\TNM.ini" USERINI="C:\TNM\TNM\System\TNMUser.ini" log=TNM.log", "", "", 0, SW_SHOWNORMAL, nil, "");, "", "", , , , "")

    The above is the version with errors.

    Can you explain more about what it means to 'escape' the quotes and backslashes so I will understand it for future reference?

    The file to run.. I assume that's when I pointed the shortcut to the target..

    the 2nd bit yes, the command line parameters..

    Oh.. I see, the line that is created takes all the info from the above boxes and puts them together as one string. That is where the syntax error comes in at. If I were coding the script by hand, I may know how to avoid the errors but the program does not?? Is that correct?

  4. #4
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    [QUOTE=John P;141335]Er.. O.k. here is the whole thing you wish to see:
    (sorry I don't know how to put it in code on this forum.)

    Shell.CreateShortcut(Shell.GetFolder(SHF_DESKTOP), "The Nameless Mod Standalone", SessionVar.Expand("%AppFolder%\\System\\TNM.exe"), "C:\TNM\System\TNM.exe -hax0r INI="C:\TNM\TNM\System\TNM.ini" USERINI="C:\TNM\TNM\System\TNMUser.ini" log=TNM.log", "", "", 0, SW_SHOWNORMAL, nil, "");, "", "", , , , "")[/QUPTE]

    Did you look at my example?

    Quote Originally Posted by John P View Post
    Can you explain more about what it means to 'escape' the quotes and backslashes so I will understand it for future reference?
    some characters are special - namely the " -- which says "this is josh" as a string; but if you wish to say "Josh said "Hi there"" now it's confused, it sees one string of "josh said " and then some jibberjabber, then an empty string ""

    so you need to escape the inner quotes
    "Josh said \"Hi there\""
    the \" will then be interpreted as a " w/in a string.

    Now you have a problem with paths "c:\program files\my app" this is interpreted as c:rogra filesy app" since \p and \m don't mean anything like \" does. so you need to now escape the backslash
    "c:\\program files\\my app"

    This is all VERY standard stuff.


    Quote Originally Posted by John P View Post
    Oh.. I see, the line that is created takes all the info from the above boxes and puts them together as one string. That is where the syntax error comes in at. If I were coding the script by hand, I may know how to avoid the errors but the program does not?? Is that correct?
    I used the builder.. the problem is you didn't escape your inner quotes or you backslashes.

    Review the differences.


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  5. #5
    Join Date
    Jul 2009
    Posts
    3
    Yeah I put your example and mine side by side and studied them. Your explanation helped a lot.. thanks.. I know it's standard stuff to you, but I am/was trying to get this done without having to learn the script coding. I can see now that it's helpful to know. And I do see the help file has a good guide to learning to script. Thanks again!

  6. #6
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    You are welcome -- if you have any issues.. post a new thread!

    btw; based on your follow up; this is probably better suited to your needs:

    Code:
    Shell.CreateShortcut(_DesktopFolder, "The Nameless Mod Standalone", SessionVar.Expand("%AppFolder%\\System\\TNM.exe"), SessionVar.Expand("-hax0r INI=\"%AppFolder%\\System\\TNM.ini\" USERINI=\"%AppFolder%\\System\\TNMUser.ini\" log=TNM.log"), SessionVar.Expand("%AppFolder%\\System"), "", 0, SW_SHOWNORMAL, {}, "");


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts