#43277 - 2003-07-24 12:09 AM
Adding IE Favourites
|
Anonymous
Anonymous
Unregistered
|
Hello All, I am in need of some help from you good people. I am trying to add addresses to the IE favourites via kix to the users profile when they login.
Since, its possible to lock down the proxy address, I assuming this should be possible too. I would be grateful for assistance on this issue. Many thanks in advance. regards, Af.
|
Top
|
|
|
|
#43278 - 2003-07-24 01:26 AM
Re: Adding IE Favourites
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
there are many ways to do this: copy the shortcut in from a network share create the new shortcut in place
see WSHShortcut()in the UDF forum for the 'create' method
See fnAllSpecialFolders() for a method of determining the destination folder
|
Top
|
|
|
|
#43279 - 2003-07-24 02:25 AM
Re: Adding IE Favourites
|
Anonymous
Anonymous
Unregistered
|
I had a look at the UDF forum. I want to achieve something like the following in the All users\favourites folder.
wshShortcut("KiXtart Web Page","http://www.kixtart.org")
I know I'm being stupid, but I'm still not quite sure how the code works. Do you have a simple example of what the code would look like to create the above shortcut and place it in the All users\favourites folder.
Also do I need to do anything extra to ensure the WSH function is working? I am using Kix 4.02
Many thanks for your assistance. Regards, AF.
|
Top
|
|
|
|
#43281 - 2003-07-24 11:25 AM
Re: Adding IE Favourites
|
ChristopheM
Hey THIS is FUN
Registered: 2002-05-13
Posts: 309
Loc: STRASBOURG, France
|
an other solution is to create all the shortcuts on your station and then copy them to a shared place.
in your kix script, you copy theses files to the user profile.
I use these solution to set a common favorite subdir in the user favorites menu. with the script below, I create the "your favorite" subdir with all favorites organized in subdirs. When the subdirs are ready, I use robocopy to update workstation. Copy is done the first time and then, only modified or added shortcut are copied
code:
break on
cls
$inifile = @scriptdir + "\" + @scriptname + ".ini"
$section = ReadProfileString ( $inifile, "", "") $arrSection = split($section,chr(10)) for each $section in $arrSection if $section ? "Répertoire $section"
$localpath = "Your Favorites\$section" MD $localpath $url = ReadProfileString ( $inifile, $section, "" ) $arrUrl = split($url,chr(10)) for each $url in $arrUrl if $url $desc = ReadProfileString ( $inifile, $section, $url ) $ = CreateURL( $url, $desc, $localpath ) endif next endif next
exit 0
function CreateURL( $url, $description, $path ) ? $vbTab + $url + $vbTab + $description $WshShell = CreateObject("WScript.Shell")
if $description="" $description=$url endif
$oUrlLink = $WshShell.CreateShortcut("$path\$description.url") $oUrlLink.TargetPath = "http://$url" $oUrlLink.Save endfunction
with the sample ini file below, I list the shortcut to be created
code:
[subdir 1] www.microsoft.com=Microsoft Site url2=description 2 url3=description 3
[subdir 1\subdir 1.1] www.kixtart.org=kixtart site http://www.kixtart.org/cgi-bin/Ultimatebb.cgi=kixtart bulletin board
[subdir 2] url2=description 2
section name is the relative path name key is the url value is the description (the name of the shortcut file
_________________________
Christophe
|
Top
|
|
|
|
#43282 - 2003-07-25 11:20 AM
Re: Adding IE Favourites
|
Anonymous
Anonymous
Unregistered
|
Thanks guys for all your help. All the code I've seen so far seems to be very long and overly complicated for what I wanted to acheive, So for lesser mortals like me, here is the very basic code that I used to create the shortcuts on the users favourites folder.
Note: for some reason VBScript does not run, so instead I used Java script.
Shell = new ActiveXObject("WScript.Shell"); DesktopPath = Shell.SpecialFolders("Favorites"); link = Shell.CreateShortcut(DesktopPath + "\\BBC.lnk"); link.Description = "html"; link.IconLocation = "C:\\WINNT\\system32\\url.dll"; link.TargetPath = "http://news.bbc.co.uk"; link.WindowStyle = 3; link.WorkingDirectory = "c:\\winnt"; link.Save();
The next step for me is to check if any existing shortcuts in the favourites folder contain the same URL. If they do to delete/rename them.
The deleting/renaming is to ensure all users have exactly the same shortcut name for any given URL.
As always, any help will be greatly appreciated.
|
Top
|
|
|
|
#43283 - 2003-07-25 11:40 AM
Re: Adding IE Favourites
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
kix will do that just fine.
use enumdir() to get an array of all the filename.url in your favorite folder
code:
$folder=readvalue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Favorites') for each $file in enumdir($folder,'*.url',1) if readprofilestring($file,'InternetShortcut','URL')=$MyOldURL $=writeprofilestring($file,'InternetShortcut','URL',$MyNewURL) endif next
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 557 anonymous users online.
|
|
|