ladybird
(Fresh Scripter)
2002-11-12 08:56 AM
Copy to Desktop

I am trying to copy some shortcut which i created through ADDPROGRAMGROUP and synchronise to Desktop by creating same folder

Shell '%comspec% /c MD "%USERPROFILE%\Desktop\Application Folder"'
Shell '%comspec% /c COPY "%USERPROFILE%\Start Menu\Programs\Application Folder\*.*" "%USERPROFILE%\Desktop\Application Folder\*.*"'

My questions:
1. Is there better way?
2. How can I change the folder icon to something else?

Thanks in advance


LonkeroAdministrator
(KiX Master Guru)
2002-11-12 09:09 AM
Re: Copy to Desktop

you could create the shortcuts directly to that folder with udf's foundable in our udf-forum.
checking from www.gwspikval.com/jooel/UDF gives at least:
shortcut()
softlink()
wshshortcut()


Sealeopard
(KiX Master)
2002-11-12 02:59 PM
Re: Copy to Desktop

You should also read our great FAQ collection, especially Copy a shortcut to the Desktop, Start Menu, etc. . And use native KiXtart commands/functions wherever possible instead of SHELLing out.

ladybird
(Fresh Scripter)
2002-11-12 04:04 PM
Re: Copy to Desktop

Correct me if i am wrong. I see all the link that you have given to me, it's creating shortcut one by one.

It means that i should create one line of code for each shortcut.

For my case, i just put my code at the bottom of my script, it will copy whatever shortcut which is created by ADDPROGRAMGROUP earlier.

Please advise me on this

Is there any disadvantage of using shell command?

Thanks


Sealeopard
(KiX Master)
2002-11-12 04:08 PM
Re: Copy to Desktop

There are different ways to accomplish the same task. However, it is never good to hardcode stuff like the Desktop folder. Your script would for example not work under Windows 9x.

Why SHELL out if there's a KiXtart command for it? Definitley less overhead and slightly faster.


ladybird
(Fresh Scripter)
2002-11-12 06:10 PM
Re: Copy to Desktop

Alright, i am getting understand. Just another a few questions. I need to create the shortcut on the specific folder on desktop. That folder will contain all the shortcut.

I won't use shortcut() UDF, because it use another program (shortcut.exe). For wshshortcut(), I believe all workstation should install with WSH program. Am I right?

$desktop = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Common Desktop")copy "Yourshortcut.LNK" $desktop

This code is only for existing folder. I can't point to new specific folder e.g Application folder.

Softlink() UDF, it might work. I will test it. I am new in Kixtart, and not sure how to run by using UDF.


Sealeopard
(KiX Master)
2002-11-12 06:14 PM
Re: Copy to Desktop

See How to use UDFs

Chris S.
(MM club member)
2002-11-13 04:37 AM
Re: Copy to Desktop

Well, if you aren't averse to using WSH you can give this a try to get your 'special folder' variables...

code:
$objWshShell = CreateObject("WScript.Shell")
$sDesktop = $objWshShell.SpecialFolders("Desktop")
$sDesktop ?



Chris S.
(MM club member)
2002-11-13 05:37 AM
Re: Copy to Desktop

Here, I even turned it into a UDF for you... fnGetSpecialFolder()

NTDOCAdministrator
(KiX Master)
2002-11-13 05:52 AM
Re: Copy to Desktop

Not bad Chris... thanks for feeding the kitty.

ladybird
(Fresh Scripter)
2002-11-15 02:52 AM
Re: Copy to Desktop

I guess i found what i want. I just use showprogramgroup command.

It works. So, the user just refer to this program group for any shortcut rather on desktop.

Thanks all of you!!!


ladybird
(Fresh Scripter)
2002-11-15 01:48 PM
Re: Copy to Desktop

I thought it's successful.

I am using this code:

IF ShowProgramGroup("Application Folder", 5, 0) = 0
SHOWPROGRAMGROUP("Application Folder",6,0)
ENDIF

The result is not consistent. How can I keep the window always active?

[ 15. November 2002, 14:48: Message edited by: ladybird ]