Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 17th April 2009, 11:09   #1
grendell2099
Junior Member
 
Join Date: Dec 2007
Posts: 4
Special ShortCut with Short File Paths

I need some help creating a “special” shortcut. I have read a lot of posts here but am not finding my answer. The shortcut is for an Access file with workgroup security so it has a long string by the time you get the 3 filepaths and commands put together. I am trying to use short paths for the necessary files so I do not hit the 256 character limit on the string.
I figured out how to get the quotes in the correct places, but now I cannot get the short file path to show up in the shortcut. It appears correctly in the String2 variable, but the shortcut created has the long path. Below is the code I am using (with short file paths just for testing- the real ones are quite long). Can anyone advise on what I am missing?

# name the installer
outFile "CreateShortCut.exe"

Var String2
!define MyTest "MSACCESS.EXE"

section
SetOutPath $INSTDIR
GetFullPathName /SHORT $String2 "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE"
DetailPrint $String2
CreateShortCut "TESTshortCut.lnk" $String2 '/user BOB /wrkgrp "F:\WRKGP.mdw"/pwd "PW" "C:\TEMP_JUNK\TEST.mde"' ""
;Quit
sectionEnd
grendell2099 is offline   Reply With Quote
Old 17th April 2009, 11:42   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
windows probably thinks its helping out and coverts the path for you

its probably better to create a shortcut to a batch file (or a little nsis app or a windows scripting host script) that runs the command for you

code:

@echo off
start MSACCESS.EXE /foo /bar
cls


only problem with that is that it will flash a black screen for 1 second (you can probably set the shortcut to start minimized)

or a scripting host script, something like
code:

var s=WScript.CreateObject("WScript.Shell");
s.Run("MSACCESS.EXE /param1 \"quoted param\" /param3");


the shortcut would have to execute "$sysdir\wscript.exe" with "$instdir\yourscript.js" as a parameter

BUT, the real way to do this is to use COM automation in a windows scripting host script

in VBScript it would probably look something like
code:

dim acc
set acc = CreateObject("Access.Application")
with acc
.Visible=true
.OpenCurrentDatabase "C:\path\file.mdb"
....etc...
end with


(not that I have ever done any office automation)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th April 2009, 11:57   #3
grendell2099
Junior Member
 
Join Date: Dec 2007
Posts: 4
Thanks for the input Anders. I had been thinking of this in terms of getting a shortcut set up during installation (there is always one computer with a weird exe location). However, I already use a small NSIS "launcher" to check for updates and open the database... it makes more sense to have the launcher find the correct exe and use it there.
I will approach it that way and see what I come up with.
grendell2099 is offline   Reply With Quote
Old 17th April 2009, 12:05   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
with com automation, you don't need to know where the exe is

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 20th April 2009, 10:33   #5
grendell2099
Junior Member
 
Join Date: Dec 2007
Posts: 4
Thanks again Anders for the assist. I haven't used com automation so I have some studying to do...
grendell2099 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump