Page 1 of 1 1
Topic Options
#43277 - 2003-07-24 12:09 AM Adding IE Favourites
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 Offline
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
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43279 - 2003-07-24 02:25 AM Re: Adding IE Favourites
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
#43280 - 2003-07-24 02:45 AM Re: Adding IE Favourites
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Please read the FAQ Forum on how to use UDFs and read the UDF header for its functionality. The UDF header contains specific instruction on how to use it and illustrates it via an example.

The Favorites folder contains shortcuts with an .URL entension.

You might also want to consider updating kiXtart to v4.21.

For proxy settings see for example the SetProxy() UDF.
_________________________
There are two types of vessels, submarines and targets.

Top
#43281 - 2003-07-24 11:25 AM Re: Adding IE Favourites
ChristopheM Offline
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
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 Offline
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

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#43284 - 2003-07-25 03:46 PM Re: Adding IE Favourites
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
The reson why the codes most likely look overly complicated is that we normally write rather generic code with lots of error checks. However, the UDFs are all well tested, thus one only needs to copy them and use them according to their headers.
_________________________
There are two types of vessels, submarines and targets.

Top
#43285 - 2003-07-25 03:46 PM Re: Adding IE Favourites
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
The reason why the codes most likely look overly complicated is that we normally write rather generic code with lots of error checks. However, the UDFs are all well tested, thus one only needs to copy them and use them according to their headers.

[ 25. July 2003, 16:32: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#43286 - 2003-07-25 04:09 PM Re: Adding IE Favourites
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I don't think newbies realize that UDFs should be just taken 'as-is' and do not require modification. They take one look at it, panic when the cannot understand all the logic, and hit the back button.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 557 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.06 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org