World Cup Icons

Just a little noddy program to set various icons to your Country's flag for the World Cup.

You need to have an icon set up - download a little flag, save it as an icon, make sure it is icon sized. Then run the program, put in the path and away you go.

Don't forget to check with System Administrators etc. before you do this! I am one, so I'm OK :)

The program is below, in case the attachment didn't work.

Simon


/*
Program worldcup.p
Description: Sets certain icons on the desktop/Start Menu in World Cup colours
*/

def var WSHShell as COM-HANDLE NO-UNDO.
def var ShortCut as COM-HANDLE NO-UNDO.
def var dirlist as char initial "c:\dir.lst".
def var global_iconfile as char no-undo.

def temp-table t_list
field filename as char form "x(60)".

form t_list.filename with frame fr_list.
form
global_iconfile label "Icon File" form "x(100)" view-as fill-in size 60 by 1
with frame fr_icon side-labels 1 down three-d.

global_iconfile = "c:\mycountry.ico".
/* Pick a flag, make an icon, save it wherever you want change this path */
repeat:
update global_iconfile label "Icon File" with frame fr_icon.
if search (global_iconfile) <> ? then leave.
end.

if search (dirlist) <> ? then os-delete value (dirlist).

/* Get commonly used directory settings - you could use system directories instead, this is just a quick noddy */

dos silent value ("dir ""c:\my documents\*.lnk"" /s /b > " + dirlist).
dos silent value ("dir ""c:\windows\desktop\*.lnk"" /s /b >> " + dirlist).
dos silent value ("dir ""c:\windows\start menu\*.lnk"" /s /b >> " + dirlist).
dos silent value ("dir ""c:\documents and settings\*.lnk"" /s /b >> " + dirlist).
/* Import to an internal temp-table list */

if search (dirlist) <> ? then do:
input from value (dirlist).
repeat:
create t_list.
import unformatted t_list.filename.
end.
input close.
os-delete value (dirlist).
end.

find first t_list where t_list.filename <> "" no-lock no-error.
if not available t_list then return.

/* Change the icons */
if NOT valid-handle(WSHShell) then do:
create "WScript.Shell" WSHShell NO-ERROR.
if valid-handle(WSHShell) then for each t_list no-lock:
if t_list.filename = "" then next.
if search (t_list.filename) = ? then next.
/* Just in case it has changed */
display t_list.filename with frame fr_list down.
down with frame fr_list.
pause 0.

ShortCut = WSHShell:CreateShortcut(t_list.filename).

if ShortCut:TargetPath matches "*dlc*" then do:
/* Or whatever criteria you want */
ShortCut:IconLocation = global_iconfile.
ShortCut:Save.
end.
release object ShortCut NO-ERROR.
end.
release object WSHShell NO-ERROR.
end.
hide frame fr_list.


 

Attachments

  • worldcup.p
    2.3 KB · Views: 9
Top