#193503 - 2009-04-17 08:43 PM
Re: Multiple Scripts and Parsing
[Re: Gargoyle]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
So, borrowing on Gargoyle's example, you could Function DoStuff($1,$2)
Dim $
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'Station', $1, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'Extension', $2, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons", "1", "REG_SZ")
Exit 0
EndFunction
Select
Case @USERID = "xxx" DoStuff('601100', '601100')
Case @USERID = "yyy" DoStuff('601200', '601200')
EndSelect Basically, you are doing the same thing many times with slightly different values. You pass those unique values to the function, which plugs them in to the proper place.
This is an EXAMPLE which may not be complete for your needs and does not have any error checking.. it's a place for you to start, not finish!
Glenn
Edited by Glenn Barnas (2009-04-17 08:47 PM) Edit Reason: added disclaimer
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#193792 - 2009-05-12 03:00 PM
Re: Multiple Scripts and Parsing
[Re: crmsonknight]
|
crmsonknight
Fresh Scripter
Registered: 2009-03-20
Posts: 17
Loc: NH USA
|
Can one of you tell me what I did wrong in this script please?
Function UsrEnv($1,$2,$3,$4,5$)
Dim $
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'Station', $1, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'Extension', $2, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'PTCPort', $3, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'PUIPort', $4, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'Formcache', $5, "REG_SZ")
Exit 0
EndFunction
Select
Case @USERID = "608Mgr_100" UsrEnv('608100', '608100', '12800', '13000', 'C:\Cache\cache608100')
Case @USERID = "608Mgr_101" UsrEnv('608101', '608101', '12801', '13001', 'C:\Cache\cache608101')
Case @USERID = "608Mgr_102" UsrEnv('608102', '608102', '12802', '13002', 'C:\Cache\cache608102')
Case @USERID = "608Mgr_103" UsrEnv('608103', '608103', '12803', '13003', 'C:\Cache\cache608103')
Case @USERID = "608Mgr_104" UsrEnv('608104', '608104', '12804', '13004', 'C:\Cache\cache608104')
Case @USERID = "608Mgr_105" UsrEnv('608105', '608105', '12805', '13005', 'C:\Cache\cache608105')
I seem to be pulling what little hairs I have left and can't make heads or tales out of it!
|
Top
|
|
|
|
#193794 - 2009-05-12 03:19 PM
Re: Multiple Scripts and Parsing
[Re: crmsonknight]
|
Gargoyle
MM club member
Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
|
Function UsrEnv($1,$2,$3,$4,5$)
Dim $
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'Station', $1, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'Extension', $2, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'PTCPort', $3, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'PUIPort', $4, "REG_SZ")
$ = writevalue ("HKEY_CURRENT_USER\Environment", 'Formcache', $5, "REG_SZ")
EndFunction
Select
Case @USERID = "608Mgr_100"
UsrEnv('608100', '608100', '12800', '13000', 'C:\Cache\cache608100')
Case @USERID = "608Mgr_101"
UsrEnv('608101', '608101', '12801', '13001', 'C:\Cache\cache608101')
Case @USERID = "608Mgr_102"
UsrEnv('608102', '608102', '12802', '13002', 'C:\Cache\cache608102')
Case @USERID = "608Mgr_103"
UsrEnv('608103', '608103', '12803', '13003', 'C:\Cache\cache608103')
Case @USERID = "608Mgr_104"
UsrEnv('608104', '608104', '12804', '13004', 'C:\Cache\cache608104')
Case @USERID = "608Mgr_105"
UsrEnv('608105', '608105', '12805', '13005', 'C:\Cache\cache608105')
Case 1
'No Match Found' ?
EndSelect
Try it this way. Note the removal of "Exit 0" and the Addition of "EndSelect" as well as the Case 1 to catch all the fall out
_________________________
Today is the tomorrow you worried about yesterday.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 248 anonymous users online.
|
|
|