function Cre8Shortcut >> lparameters m.lcLinkname,m.lcApplication,m.cAppParameters,; >> m.lcWorkingdir,m.lcInFolder,m.lcWinstyle,m.lcHotKey, m.cIconLoc >> *!* parameters >> *!* 1. name of link >> *!* 2. Target application or file >> *!* 3. Parameters for target >> *!* 4. Workingdir >> *!* 5. location for shortcut "Desktop" >> *!* <Default> , "Startup", "Programs" "PROGRAMS\MYFOLDER\"... >> *!* 6. Window Style "MIN" "MAX", "NORM" <DEFAULT> >> *!* 7. startup HOT KEY >> *!* 8. Icon Location - defaults to target file (assumes embedded icon if not passed") >> #DEFINE SC_MAXIMIZED 3 >> #DEFINE SC_MINIMIZED 7 >> #DEFINE SC_NORMAL 4 >> if type("m.lcApplication") <> "C" .or. !file(m.lcApplication) >> return .f. >> endif >> m.lcApplication = locfile(m.lcApplication) >> if type("m.lcLinkname") <> "C" >> m.lcLinkname = juststem(m.lcApplication)+".LNK" >> else >> m.lcLinkname = juststem(m.lcLinkname)+".LNK" >> endif >> if type("m.lcWorkingdir") <> "C" .or. !directory(m.lcWorkingdir) >> m.lcWorkingdir = justpath(m.lcApplication) >> endif >> do case >> case type("m.lcWinstyle") <> "C" >> m.lnWinstyle = SC_NORMAL >> case atc("NORM",m.lcWinstyle) > 0 >> m.lnWinstyle = SC_NORMAL >> case atc("MAX",m.lcWinstyle) > 0 >> m.lnWinstyle = SC_MAXIMIZED >> case atc("MIN",m.lcWinstyle) > 0 >> m.lnWinstyle = SC_MAXIMIZED >> otherwise >> m.lnWinstyle = SC_NORMAL >> endcase >> >> *!* Create the Windows Script Host >> loWsh = CREATEOBJECT("Wscript.shell") >> >> *!* Locate the user's start up folder >> **lcFolder = loWsh.SpecialFolders("StartUp") >> *lcFolder = loWsh.SpecialFolders("Desktop") >> >> do case >> case type("m.lcInFolder") <> "C" >> lcFolder = loWsh.SpecialFolders("Desktop") >> m.lcInFolder = lcFolder >> case atc("Desktop",m.lcInFolder) > 0 >> lcFolder = loWsh.SpecialFolders("Desktop") >> m.lcInFolder = strtran(Lower(m.lcInFolder),"desktop\","") >> m.lcInFolder = addbs(addbs(lcFolder)+m.lcInfolder) >> case atc("Startup",m.lcInFolder) > 0 >> lcFolder = loWsh.SpecialFolders("StartUp") >> m.lcInFolder = strtran(Lower(m.lcInFolder),"startup\","") >> m.lcInFolder = addbs(addbs(lcFolder)+m.lcInfolder) >> case atc("Programs",m.lcInFolder) > 0 >> lcFolder = loWsh.SpecialFolders("Programs") >> m.lcInFolder = strtran(Lower(m.lcInFolder),"programs\","") >> m.lcInFolder = addbs(addbs(lcFolder)+m.lcInfolder) >> otherwise >> m.lcInFolder = addbs(fullpath(m.lcInFolder)) >> endcase >> if !empty(m.lcInFolder) .and. cre8dir(m.lcInFolder) >> *!* create specified folder in programs if it does not exist >> lcFolder = m.lcInFolder >> endif >> >> *!* Create a shortcut object >> loShortCut= loWsh.CreateShortcut(addbs(lcFolder) + m.lcLinkname) >> >> *!* Set the properties of the shortcut. Note that no error occurs if >> *!* one of the parameters is wrong. The shortcut just won't be saved. >> *!* Also, if the shortcut already exists, it will be overwritten w/o >> *!* warning. >> *!* >> lcAppPath = addbs(JUSTPATH(fullpath(m.lcApplication))) && For example >> lcAppName = justfname(m.lcApplication) && For example >> if type("m.cAppParameters") = "C" .and. !empty(m.cAppParameters) >> loShortCut.Arguments = m.cAppParameters >> endif >> loShortCut.WorkingDirectory = m.lcWorkingdir >> loShortCut.TargetPath = '"' + lcAppPath + lcAppName + '"' >> loShortCut.IconLocation = iif(type("m.cIconLoc") = "C" .and. ; >> file(m.cIconLoc), m.cIconLoc,loShortCut.TargetPath) >> ** Assumes built-in ICO if not passed >> loShortCut.WindowStyle = m.lnWinstyle >> >> if type("m.lcHotKey") = "C" >> loShortCut.HOTKEY = m.lcHotKey && For example >> endif >> *!* Save the shortcut >> loShortCut.SAVE() >> >> loShortCut = .null. >> release loShortCut >> >> return file(addbs(lcFolder) + m.lcLinkname) >>>>