#171012 - 2006-12-04 11:10 PM
Re: IF...ENDIF Script help please
[Re: vitaly91]
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
I think you have answered your own question, now all you need to do is modify your code to reflect what you have just defined.
Edited by Benny69 (2006-12-04 11:11 PM)
|
|
Top
|
|
|
|
#171013 - 2006-12-04 11:17 PM
Re: IF...ENDIF Script help please
[Re: Benny69]
|
vitaly91
Fresh Scripter
Registered: 2006-12-01
Posts: 12
|
Benny,
This is what I had all along... Yet it doesn't work! No idea why!
if ingroup("ChicagoMM")
WshShortCut("%userprofile%\desktop\MicroMainXM.lnk","D:\Citrix MicroMain\Chicago\micromainxm.mde")
WshShortCut("%userprofile%\desktop\xmREPORT.lnk","D:\Citrix MicroMain\Chicago\xmreport.mde")
WshShortCut("%userprofile%\desktop\xmEXEC.lnk","D:\Citrix MicroMain\MicroMain Training\xmexec.mde")
endif
if ingroup("LansingMM")
WshShortCut("%userprofile%\desktop\MicroMainXM.lnk","D:\Citrix MicroMain\Lansing Mall\micromainxm.mde")
WshShortCut("%userprofile%\desktop\xmREPORT.lnk","D:\Citrix MicroMain\Lansing Mall\xmreport.mde")
endif
if ingroup("Test_LansingMallMM")
WshShortCut("%userprofile%\desktop\MicroMainXM.lnk","D:\Citrix MicroMain\Test Lansing Mall\micromainxm.mde")
WshShortCut("%userprofile%\desktop\xmREPORT.lnk","D:\Citrix MicroMain\Test Lansing Mall\xmreport.mde")
endif
function WshShortCut($path,$targetpath,optional $arguments,optional $startdir,optional $iconpath,optional $style)
dim $shell,$shortcut
$shell=createobject("wscript.shell")
if $shell
$shortcut=$shell.createshortcut($path)
if $shortcut
$shortcut.targetpath=$targetpath
if $arguments
$shortcut.arguments=$arguments
endif
if $startdir
$shortcut.workingdirectory=$startdir
endif
if $iconpath
$shortcut.iconlocation=$iconpath
endif
if $style
$shortcut.windowstyle=$style
endif
$shortcut.save
$shortcut=0
endif
$shell=0
endif
exit @error
endfunction
|
|
Top
|
|
|
|
#171018 - 2006-12-04 11:28 PM
Re: IF...ENDIF Script help please
[Re: vitaly91]
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
one thing i can see is that in each of your wshshortcut() statments you have the %userprofile% inside the quotes, it should be outside like this:
WshShortCut(%USERPROFILE%+"\desktop\MicroMainXM.lnk","D:\Citrix MicroMain\Chicago\micromainxm.mde")
then modify each one to reflect this change.
|
|
Top
|
|
|
|
#171061 - 2006-12-05 04:46 PM
Re: IF...ENDIF Script help please
[Re: NTDOC]
|
vitaly91
Fresh Scripter
Registered: 2006-12-01
Posts: 12
|
I understand that. And several posts ago I put this up for discussion:
So if I understand you right, I need to do this:
:
if ingroup("ChicagoMM")
if exist("%userprofile%\desktop\ChicagoMicroMainXM.lnk")=0
$=WshShortCut("%userprofile%\desktop\ChicagoMicroMainXM.lnk","D:\Citrix MicroMain\Chicago\micromainxm.mde")
? @serror
else
? "Already Exists"
endif
if exist("%userprofile%\desktop\ChicagoxmREPORT.lnk")=0
$=WshShortCut("%userprofile%\desktop\ChicagoxmREPORT.lnk","D:\Citrix MicroMain\Chicago\xmreport.mde")
? @serror
else
? "Already Exists"
endif
if ingroup("Test_LansingMallMM")
if exist("%userprofile%\desktop\TestLansingMicroMainXM.lnk")=0
$=WshShortCut("%userprofile%\desktop\TestLansingMicroMainXM.lnk","D:\Citrix MicroMain\Test Lansing Mall\micromainxm.mde")
? @serror
else
? "Already Exists"
endif
if exist("%userprofile%\desktop\TestLansingxmREPORT.lnk")=0
$=WshShortCut("%userprofile%\desktop\TestLansingxmREPORT.lnk","D:\Citrix MicroMain\Test Lansing Mall\xmreport.mde")
? @serror
else
? "Already Exists"
endif
endif
But, as I was told, this isn't quite correct either... So I think at this point I am lost!
Should I remove "Already Exists" parts and just make it this way:
if ingroup("Test_LansingMallMM")
if exist("%userprofile%\desktop\TestLansingMicroMainXM.lnk")=0
$=WshShortCut("%userprofile%\desktop\TestLansingMicroMainXM.lnk","D:\Citrix MicroMain\Test Lansing Mall\micromainxm.mde")
endif
if exist("%userprofile%\desktop\TestLansingxmREPORT.lnk")=0
$=WshShortCut("%userprofile%\desktop\TestLansingxmREPORT.lnk","D:\Citrix MicroMain\Test Lansing Mall\xmreport.mde")
endif
endif
Edited by vitaly91 (2006-12-05 04:49 PM)
|
|
Top
|
|
|
|
#171067 - 2006-12-05 06:38 PM
Re: IF...ENDIF Script help please
[Re: vitaly91]
|
vitaly91
Fresh Scripter
Registered: 2006-12-01
Posts: 12
|
Guys,
I think the way I posted in my previous message works!!! I just tested it and it put 6 shortcuts on the desktop (test user is in all 3 groups).
I would like to thank you ALL for all your help and patience!!
|
|
Top
|
|
|
|
#171242 - 2006-12-08 05:49 PM
Re: IF...ENDIF Script help please
[Re: vitaly91]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
IF Exist()=0 is pretty weird way imo to put the code. Way I put it is
If Exist()
? "It Exists!!"
Else
? " It's Gone!!"
EndIf
Or
If Not Exist()
? "It's Gone!!"
Else
? "It Exists!!"
EndIf
Not that your way is wrong though....
Edited by apronk (2006-12-08 05:50 PM)
|
|
Top
|
|
|
|
#171262 - 2006-12-08 09:28 PM
Re: IF...ENDIF Script help please
[Re: Les]
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: CA
|
Too bad Shawn is not around anymore. He once showed and explained an example where the If 1= was better in some instances. Alas, I don't recall the details and example 
.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 583 anonymous users online.
|
|
|