#185449 - 2008-02-18 10:43 PM
Login Scripts copy function
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
I am looking to replace
function copy_files($personal,$desktop,$start,$server,$program)
DIM $file
$file=$server + "icons$\" + $program
if not exist ("$personal")
md "S:\icons\"
endif
if not exist ("$personal$program")
;? "need in personal drive"
COPY "$file" "$personal" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $personal")
endif
if not exist ("$desktop$program")
;? "need in desktop"
COPY "$file" "$desktop" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $desktop")
endif
if not exist ("$start")
md "C:\documents and settings\"+@USERID+"\start menu\programs\apps\"
endif
if not exist ("$start$program")
;? "need in startmenu"
COPY "$file" "$start" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $start")
endif
endfunction
With
function copy_files($personal,$desktop,$start,$server,$program)
DIM $comp_return,$icons_path,$file
$icons_path='icons$\'
$file=$server + $icons_path + $program
if not exist ($personal)
md $personal ;make sure personal location exists
endif
if not exist ($start)
md $start ;make sure start location exists
endif
$comp_return=CompareFileTimes('$server+$icons_path+$program','$personal+program$')
if $comp_return <> 0
;? "need in personal drive"
COPY "$file" "$personal" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $personal")
endif
$comp_return=CompareFileTimes('$server+$icons_path+$program','$desktop+program$')
if $comp_return <> 0
;? "need in desktop"
COPY "$file" "$desktop" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $desktop")
endif
$comp_return=CompareFileTimes('$server+$icons_path+$program','$start+program$')
if $comp_return <> 0
;? "need in startmenu"
COPY "$file" "$start" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $start")
endif
endfunction Here are my current params
if $osname="Windows Vi"
;Vista Paths
$vista=1
$personal_loc="S:\icons\"
$desktop_loc="C:\Users\"+@USERID+"\Desktop\"
$start_loc="C:\Users\"+@USERID+"\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\apps\"
else
;XP,2k,2k3 Paths
$personal_loc="S:\icons\"
$desktop_loc="C:\documents and settings\"+@USERID+"\desktop\"
$start_loc="C:\documents and settings\"+@USERID+"\start menu\programs\apps\"
endif
Any warnings from someone who's done something simalar?
Edited by duo (2008-02-18 10:54 PM) Edit Reason: fixed code to where no errors are generated
|
|
Top
|
|
|
|
#185451 - 2008-02-18 11:11 PM
Re: Login Scripts copy function
[Re: Glenn Barnas]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
so like $desktop_loc='%USERPROFILE%\Desktop' $start_loc='%USERPROFILE%\Start Menu';XP $start_loc='%APPDATA%\Microsoft\Windows\Start Menu\Programs\apps\';vitha
This what your getting at?
|
|
Top
|
|
|
|
#185457 - 2008-02-19 02:26 AM
Re: Login Scripts copy function
[Re: duo]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
|
$Desktop_Loc = '%USERPROFILE%\Desktop'
$Start_Loc = IIf("%APPDATA% = '', '%USERPROFILE%\Start Menu', '%USERPROFILE%\appdata')
My AppData folder has Local, LocalLow, and Roaming subfolders, with a Microsoft folder only under Local. I DO NOT have a roaming profile, yet my AppData variable points to "C:\Users\Glenn.DOMAIN\AppData\Roaming". The point is - APPDATA doesn't appear to be that valuable by itself. My code example tests the APPDATA value, which isn't set on XP. If it's null, it sets the StartLoc var accordingly to the BASE folder. You'll need further tests to determine how to dig into the start folder from there, depending on what you want to do and what O/S you have.
BTW - I'm running Vista Ultimate x64, so I checked the other two workstations here and found the same "roaming" folder on the tail, including the one PC that's got Vista X86 Home still on it.
Again, the environment vars will generally be a better representation of the base location on the computer you're connected to.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
#185471 - 2008-02-19 08:27 AM
Re: Login Scripts copy function
[Re: duo]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Desktop is in the registry Key=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders Name=Desktop
Start Menu is also in the registry Key=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders Name=Start Menu
Break On
Dim $ShellFolders, $Desktop, $StartMenu
$ShellFolders="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
$Desktop = ReadValue($ShellFolders,"Desktop")
$StartMenu = ReadValue($ShellFolders,"Start Menu")
? $Desktop
? $StartMenu
|
|
Top
|
|
|
|
#185476 - 2008-02-19 04:00 PM
Re: Login Scripts copy function
[Re: Witto]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
I dont like going the registry route, because once i go down that path, im going to want to add ridiculous things, mapping my documents to S:\My Documents. auto syncing and that sort of jazz
|
|
Top
|
|
|
|
#185479 - 2008-02-19 04:21 PM
Re: Login Scripts copy function
[Re: duo]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Your choice. I just suggested a (IMHO) good way to get the path of the folders you are looking for. Maybe you can do it this way: GetSpecialFolders() - Returns the Name and Path of Special Folders
Break On
Dim $objFolderItem
;Desktop
$objFolderItem=createobject('Shell.Application').Namespace(16).Self
? $objFolderItem.Name
? $objFolderItem.Path
;Start Menu
$objFolderItem=createobject('Shell.Application').Namespace(11).Self
? $objFolderItem.Name
? $objFolderItem.Path
$objFolderItem=0
|
|
Top
|
|
|
|
#185481 - 2008-02-19 04:33 PM
Re: Login Scripts copy function
[Re: Glenn Barnas]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
My AppData folder has Local, LocalLow, and Roaming subfolders, with a Microsoft folder only under Local. I DO NOT have a roaming profile, yet my AppData variable points to "C:\Users\Glenn.DOMAIN\AppData\Roaming". The point is - APPDATA doesn't appear to be that valuable by itself. My code example tests the APPDATA value, which isn't set on XP. If it's null, it sets the StartLoc var accordingly to the BASE folder. You'll need further tests to determine how to dig into the start folder from there, depending on what you want to do and what O/S you have.
BTW - I'm running Vista Ultimate x64, so I checked the other two workstations here and found the same "roaming" folder on the tail, including the one PC that's got Vista X86 Home still on it.
Again, the environment vars will generally be a better representation of the base location on the computer you're connected to.
Glenn
Where is the default supposed to be? I had a hard crash one time and when it rebooted all my files/settings were gone. I assume it screwed up the profile at that point.
|
|
Top
|
|
|
|
#185484 - 2008-02-19 05:54 PM
Re: Login Scripts copy function
[Re: Glenn Barnas]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
hair...hell im 23 and losing it rapidly as is(had a massive head injury at 18 that started the trigger)
|
|
Top
|
|
|
|
#185509 - 2008-02-20 03:41 PM
Re: Login Scripts copy function
[Re: Björn]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
Alright how about this, whats the best way to alter the shell paths? Change My documents to per say S:\My Documents, etc. Looking for the most proper way, and i would like to encorporate the best method for setting $start_loc and such
Edited by duo (2008-02-20 04:07 PM)
|
|
Top
|
|
|
|
#185513 - 2008-02-20 04:46 PM
Re: Login Scripts copy function
[Re: Mart]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
GPOs are not my neighbor...
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 857 anonymous users online.
|
|
|