Previously there have been some questions about the Quick Launch folder (in the AMS and the SUF forum). Due to a thread in the AMS50 forum I started to write a function to find the QL folder path. The intention was to create a function usable in both SUF70 and AMS50 (thanks to the common LUA engine) and to support all OSes.
I have tested the function with Win98 (Norwegian), WinNT4 (English) and WinXP (English). It would be nice if any of you would test the function; and please: Report the result.
The function is shown below. To call the function:
Per-User-Profile
sQLpathUser = GetQuickLaunchFolder() or sQLpathUser = GetQuickLaunchFolder("user")
All Users Profile
sQLpathCommon = GetQuickLaunchFolder("common")
If you want to download a ready-to-use sf7 project I have attached a zipped project file (with the function in 'Global Actions').
Good luck; and please remember to publish your test results if you find the function usable. Tell about your OS version (+ language version).
I have tested the function with Win98 (Norwegian), WinNT4 (English) and WinXP (English). It would be nice if any of you would test the function; and please: Report the result.
The function is shown below. To call the function:
Per-User-Profile
sQLpathUser = GetQuickLaunchFolder() or sQLpathUser = GetQuickLaunchFolder("user")
All Users Profile
sQLpathCommon = GetQuickLaunchFolder("common")
If you want to download a ready-to-use sf7 project I have attached a zipped project file (with the function in 'Global Actions').
Code:
function GetQuickLaunchFolder(profileArg) --[[ function: GetQuickLaunchFolder() Purpose: Get the full path to the Quick Launch Folder Arguments: (String)'user' = Current user's pahth [or no argument] (String) 'common' [or no argument] = All Users path Returns: String (full path [without a trailing slash]) Usage: sQLpath = GetQuickLaunchFolder() = Current user's path sQLpath = GetQuickLaunchFolder("user") = Current user's path sQLpath = GetQuickLaunchFolder("common") = All Users path ]] if not profileArg then -- nil as argument profileArg = "user"; end if type(profileArg) ~= "string" then Dialog.Message("Function GetQuickLaunchFolder()", "Argument 1 must be of type string".. "\r\neither 'common' og 'user' or a nil value (='user')".. "\r\nThe argument sent was of type "..type(profileArg)); profileArg = "user"; end profileArg = String.Lower(profileArg); -- always use lower case if profileArg ~= "common" and profileArg ~= "user" then profileArg = "user" end -- incorrect argument, set it to default value 'user' -- WinXP: NOT in Registry -- Win2k: NOT in Registry -- WinNT: -- Registry Key -- Win9x: -- Registry Key -- [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\GrpConv\MapGroups] -- Value "Quick Launch" sPath = Shell.GetFolder(SHF_APPLICATIONDATA); -- returns: -- WinXP: C:\Documents and Settings\<UserName>\Application Data -- Win2k: Like WinXP?? -- WinNT: C:\WINNT\Profiles\<UserName>\Application Data -- Win9x: C:\WINDOWS\Application Data -- sPath can be used as FIRST part of the folderpath (all systems) -- but we have to add the second part of the path (fixed value) -- This is for the current user's Quick Launch folder -- From Win2k off there are two folders: Common and Per-User (= "New systems") -- "Old systems" have only one folder (common = per-user) and the folder path can be found in the Registry -- The segregation is NOT bundled to NT-based system or not... if profileArg == "common" then -- Is the QL Folder path found in the Registry? -- If YES: A non-NT based system ot NT3 or NT4 ("0ld OS") -- If NO: "New OS" like Win2k or WinXP sQLKey = "Software\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroups"; sQLRegPath = Registry.GetValue(HKEY_CURRENT_USER, sQLKey, "Quick Launch", true); if sQLRegPath ~= "" then -- old system sPath = sQLRegPath; else -- new system tLANinfo = System.GetLANInfo(); nPos = String.Find(sPath, tLANinfo.User, 1, false); if nPos ~= -1 then -- the User Name was found sPath = String.Replace(sPath, tLANinfo.User, "All Users", false); end --now add part 2 sPath = sPath.."\\Microsoft\\Internet Explorer\\Quick Launch" -- without trailing slash! end else --now add part 2 sPath = sPath.."\\Microsoft\\Internet Explorer\\Quick Launch" -- without trailing slash! end return sPath end
Comment