Hello Everyone...this is the first ever script I try to write...I am having an issue with the XLSINPUTBOX section, it looks like when the script gets to that point it fails....any ideas?? I know formatting is probably not all there.....TIA
Code:
break on
;setconsole("hide")
DEBUG ON
;------Win32Admin Dll--------------------------------
$DLL1="WIN32ADMIN.DLL"
$SYS="%SYSTEMROOT%\system32\"
If Not exist ($SYS+$DLL)
Copy $DLL1 $SYS
Shell '%comspec% /c "regsvr32 win32admin.dll"'
endif
$Win32Admin = createobject("Win32Admin")
if vartypename($Win32Admin) <> "Object"
? "@serror"
endif
$Version = $Win32Admin.Version
if @error <> 0
? "@serror"
endif
? "DLL Version = " + $Version
;--------User Prompt-----------------------------------
$username=XlsInputBox("Enter New User Logon Name","User Name")
;-------Create Folders & Copy Files---------------------------------
$Profile="\\miafiler1\Profiles\"
$Work="\\miafiler1\Work\"
$NotesFiles="\\miafiler1\work\mrwindow\Notes"
$IDLOCATION="\\miafiler2\ITDLA$\NotesIDs\
$NotesID="$USERNAME.ID"
if not exist($Profile+$Username)
md $Profile+$Username
endif
if not exist($Work+$username)
md $work+$username
endif
Shell '%comspec% /c CACLS "'+$profile+''+$USERNAME+'" /T /E /R Everyone'
Shell '%comspec% /c CACLS "'+$profile+''+$USERNAME+'" /T /E /C /G INT\'+$USERNAME+':C'
Shell '%comspec% /c CACLS "'+$work+''+$USERNAME+'" /T /E /R Everyone'
Shell '%comspec% /c CACLS "'+$work+''+$USERNAME+'" /T /E /C /G INT\'+$USERNAME+':C'
GUICopy("Copy",$NotesFiles,"$WORK$USERNAME")
? "Exit Code: " @error
GUICOPY("Copy",$IDLOCATION$NOTESID,"$WORK$USERNAME\Notes")
? "Exit Code: " @error
if $Win32Admin.NetShareAdd ("MIAFILER1", "$USERNAME$", "STYPE_DISKTREE", "Users Work Directories", -1, "C:\vol\Vol1\work\$USERNAME")
? "Share successfully created"
else
? "Error @serror"
endif
;------FUNCTIONS-----------------------------------------------------
function XlsInputBox( $prompt, optional $title, optional $default, optional $left, optional $top, optional $type)
dim $xls
$xls = createobject("excel.application")
if $xls
$xlsInputBox = $xls.inputbox($prompt,$title,$default,$left,$top,,,2)
if not $xlsInputBox $xlsInputBox = @wksta endif
$xls.quit
$xls = 0
endif
endfunction
function GUICopy($CMD, $Source, $Destination, OPTIONAL $Flags)
If not $Flags $Flags=0 Endif
If not exist($Source) Beep ? "Source does not exist." Exit (1) Endif
If not exist($Destination) Beep ? "Destination does not exist." Exit (2) Endif
$objShell=CreateObject("Shell.Application")
$objFolder=$objShell.NameSpace($Destination)
If not $objFolder Beep ? "Cannot create namespace. Incorrect Shell32.dll version." Exit (3) Endif
Select
Case $CMD="Copy" $objFolder.CopyHere($Source, $Flags)
Case $CMD="Move" $objFolder.MoveHere($Source, $Flags)
Case 1 Beep ? "GUICopy Syntax Incorrect. Use COPY or MOVE." $objShell=0 Exit (4)
EndSelect
$objShell=0
Exit @error
endfunction