Jump to content

Yzöwl

Patron
  • Posts

    4,113
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

Everything posted by Yzöwl

  1. As much as I love this stuff, why is it that I find your code so difficult to read?Is there a 'code prettier' in vbsedit? This is what I've done to it to make it more readable to me! <HEAD> <TITLE>Gsm_List Process</TITLE> <HTA:APPLICATION ID="Gsm_List Process" SYSMENU="Yes" SCROLL="Yes" SCROLLFLAT="No" SINGLEINSTANCE="Yes" SHOWINTASKBAR="Yes" SYSMENU="No" MAXIMIZEBUTTON="No" MINIMIZEBUTTON="Yes" BORDER="Thin" BORDERSTYLE="Complex" INNERBORDER="No" CAPTION="Yes" WINDOWSTATE="Normal" APPLICATIONNAME="Gsm_List Process" ICON="http://www3.telus.net/GSMJAK1E/AUABuilder/BgImgs/Hta2.ico" > </HEAD> <HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40" > <!--[if !mso]> <STYLE> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);}.shape {behavior:url(#default#VML);} </STYLE> <![endif]--> <!--[if gte mso 9]> <XML> <o:DocumentProperties> </w:LatentStyles> </XML> <![endif]--> <STYLE> .TKT2{ font-size:10.75pt; font-family:Palatino-Linotype; font-weight:Bold-Italic; line-height:110%; color:#0926ed; background-color:#c7c3be; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#c7c3be',endColorStr='#e8e4de'); padding-top:3; padding-bottom:3; padding-left:8; padding-right:8; margin-right:8; } .BTN1{ font-size:9.75pt; font-family:Palatino-Linotype; font-weight:Bold-Italic; line-height:110%; color:#008000; background-color:; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#c7c3be',endColorStr='#e8e4de'); padding-top:3; padding-bottom:3; padding-left:8; padding-right:8; margin-right:8; width:125; } TD.BTN2{ font-size:9.75pt; font-family:Palatino-Linotype; font-weight:Bold-Italic; line-height:110%; color:#008000; background-color:; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#c7c3be',endColorStr='#e8e4de'); padding-top:3; padding-bottom:3; padding-left:8; padding-right:8; margin-right:8; width:175; } </STYLE> <!--[if gte mso 10]><STYLE></STYLE><![endif]--> <!-- ======================== SCRIPT SEPARATOR ======================== --> <script LANGUAGE="VBScript"> Window.resizeto 520,705 Const forreading=1, forwriting=2, forappending=8 Dim inta inta=0 Dim sp_pid, sp_name, fr_name, txt_line, mb, act, dtop, fso, ts, uname Set act=Createobject("Wscript.Shell") Set fso=Createobject("Scripting.Filesystemobject") dtop=act.specialfolders("Desktop") uname=act.expandenvironmentstrings("%Username%") strcomputer="." Set objwmiservice=Getobject("Winmgmts:{Impersonationlevel=Impersonate}!\\" _ &strcomputer &"\Root\Cimv2") Set colprocesses=objwmiservice.execquery("Select * From Win32_Process") mb=1024 * 1024 '''' Sub window_onload getinfo itimerid=Window.setinterval("Getinfo", 300, "Vbscript") lb1.innerhtml=uname &"<BR> Process List" End Sub '''' Sub getinfo For i=(objtable.rows.length - 1) To 0 Step -1 mynewrow=Document.all.objtable.deleterow(i) Next Set objrow=objtablebody.insertrow() objrow.style.fontweight="Bold" Set objrow=objtable.insertrow() objrow.style.color="Red" Set objcell=objrow.insertcell() objcell.innertext="Process ID" Set objcell=objrow.insertcell() objcell.innertext="Process Name" Set objcell=objrow.insertcell() objcell.innertext="Working Set Size" Set colprocesses=objwmiservice.execquery("Select * From Win32_Process") For Each strprocess In colprocesses sp_pid=strprocess.processid sp_name=strprocess.name fr_name=Formatnumber(strprocess.workingsetsize,0,,,-1) /1024 txt_line=Space(5) &sp_pid &Space(5) &sp_name &Space(5) &fr_name Set objrow=objtablebody.insertrow() Set objcell=objrow.insertcell() objrow.style.color="#0000c8" objrow.style.fontweight="Bold" objcell.innertext=strprocess.processid Set objcell=objrow.insertcell() objcell.innertext=strprocess.name Set objcell=objrow.insertcell() mem=Formatnumber(strprocess.workingsetsize,0,,,-1) / mb mem=Left(mem,4) objcell.innertext=mem &" Mb" Next End Sub Function killtask strcomputer="." Dim tkill tkill=Inputbox("Type In The Name Of The Process To Kill", _ "Task Kill Process",,5500,4800) If tkill="" Then Window.alert "User Has Cancelled Task Kill" End If If tkill <> "" Then Window.alert "Preparing To Taskkill, " &tkill Set objwmiservice=Getobject _ ("Winmgmts:{Impersonationlevel=Impersonate}!\\" &strcomputer _ &"\Root\Cimv2") Set colprocesslist=objwmiservice.execquery _ ("Select * From Win32_Process Where Name='" &tkill &"'") For Each objprocess In colprocesslist objprocess.terminate() Next End If Exit Function End Function Function htaexit If fso.fileexists("Listprocess.Hta") Then fso.deletefile("Listprocess.Hta") End If Window.close Exit Function End Function </SCRIPT> <BODY SCROLL="Yes" STYLE="8.25pt Palatino Linotype; color:#000080; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#e8e4de', EndColorStr='#c7c3be')" > <TABLE WIDTH="455" ALIGN="Center"> <TR> <TD CLASS="BTN2"> <TABLE WIDTH="425" ALIGN="Center"> <TR> <TD> <INPUT TYPE="Button" LANGUAGE="Vbscript" VALUE="Task Kill Process" CLASS="BTN1" TITLE="" ONCLICK="KillTask" > </TD> <TD> </TD> <TD CLASS="BTN2" WIDTH="275" ALIGN="Center"> <SPAN ID="Lb1"> </SPAN> </TD> <TD> </TD> <TD> <INPUT TYPE="Button" LANGUAGE="Vbscript" VALUE="Exit App" CLASS="BTN1" TITLE="" ONCLICK="HTAEXIT" > </TD> </TR> </TABLE> <CENTER> <TABLE ID="objTable" CLASS="TKT2" WIDTH="425"> <TBODY ID="objTableBody" CLASS="TKT2" WIDTH="425"> </TBODY> </TABLE> </CENTER> </TD> </TR> </TABLE> <TABLE> <TR> <TD HEIGHT="15"> </TD> </TR> </TABLE> <TABLE ALIGN="Center"> <TR> <TD> <INPUT TYPE="Button" LANGUAGE="Vbscript" VALUE="Task Kill Process" CLASS="BTN1" TITLE="" ONCLICK="KillTask" > </TD> </TR> </TABLE>Which one is best for who is down to individuals, but for me as a relative learner, I prefer my way. Comments please… <Edit> Updated to remove the initial unnecessary <HTML> tag, include several missing <TR> and </TR> tags and a missing </CENTER> tag, replace an incorrect </TABLE> tag with a </TD> tag and change some code character Case. None of this stuff I noticed in the original format. </Edit>
  2. I would try the install without those keys in the first instance. The majority of them are found programatically, and can be markedly different for all users. If your install didn't open the application, you may have problems, but I would like to think that those keys will be auto-completed on first run for each individual %username%. At the most, I would only attempt to use the entries for WINDOWS SHARED and INSTALL, bearing in mind that those of us not installing Program Files to %SystemDrive% and /or with %SYSTEMROOT% not on C: will not be able to use your installer as is.
  3. :: COMMENT :LABEL :INVALID LABEL REM COMMENTUse syntax in either of lines 1 or 4
  4. @ WotC You should be able to do that with this! @ECHO OFF &SETLOCAL ENABLEEXTENSIONS FOR /F "TOKENS=3 DELIMS= " %%? IN ('REG QUERY "HKCU\Software\Microsoft\Windows\Currentversion\Explorer\Shell Folders"^|FIND "My Music"') DO (SET USERMM="%%?") IF DEFINED USERMM (ECHO/Your 'My Music' folder is located at %USERMM%) ENDLOCAL &GOTO :EOFObviously DELIMS=<tab> still. <Edit> note Just change the stuff inside the parentheses on line 3 to suit your requirements. </Edit>
  5. There should be no problems with whitespace in my code, both variables used are enclosed within quotes and spaces are not used as delimiters!As for a tab problem, my only guess is a limitation with your editor and /or chosen font. Try using the attached copy, in order to prevent duplication of that problem. ffext.zip
  6. Nice try Mikka, how's this? @ECHO OFF &SETLOCAL ENABLEEXTENSIONS FOR /F "TOKENS=3 DELIMS= " %%? IN ('REG QUERY "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /S ^|FINDSTR "\<PathToExe\>" 2^>NUL') DO (IF ERRORLEVEL 0 (SET FFFP="%%?")) IF NOT DEFINED FFFP (ENDLOCAL &GOTO :EOF) FOR /F "DELIMS=" %%? IN ('DIR/B/OD *.XPI ^2^>NUL') DO (IF ERRORLEVEL 0 (START "" /WAIT %FFFP% -INSTALL-GLOBAL-EXTENSION "%%?")) ENDLOCAL &GOTO :EOFNotes: Any lines not beginning with two spaces have line-wrapped On line 2 `delims=<tab>`
  7. FOR /R "C:\MY MUSIC" %? IN (FRONT.JPG) DO REN "%?" X.JPG<Edit> The above is simply a slight modification to Delprat's code to allow for the possibility of spaces in the directory path </Edit>
  8. Although not a direct response to your problem, you may be interested in replacing that application with something else. System Information for Windows As a bonus, it is a standalone application, meaning it'll run from any directory without installation!
  9. There are actually a number of flaws in the reg file posted! 1. You may invoke the file accidentally even though you haven't got Firefox installed. Doing so will change many registry keys for no reason, and require a roll back or manual edit to fix. 2. PROGRA~1\\MOZILL~1 could be machine specific depending upon your current directory contents. You could have for instance PROGRA~1\\MOZILL~1 for Mozilla Thunderbird. If Firefox is installed and in the default location, then that is unlikely, but still remains a possibility. This of course also highlights the possibility that Firefox may not be installed under 'Program Files' never mind with a folder named 'Mozilla Firefox' 3. The data values for HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Desktop may be completely different. The existing data from your current keys are backed up to those keys and are therefore machine specific. You have assumed that the .htm and .html keys had not previously been registered to as another filetype. The StartMenuInternet key may have also been assigned to an application other than Internet Explorer. Taking all these things into account, the registry file would probably be better suited to new unattended builds and or users who always accept the defaults. If you wanted something a little more universal, (for win2k with resource kit and above), try the attached outrageous specimen, it is untested. setfirefoxdefault.cmd
  10. I'll try to explain with an example: I entered the commands at the commandline to show you the resulting output Microsoft Windows XP [Version 5.1.2600] © Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Yzöwl>PUSHD %ALLUSERSPROFILE%\..\DEFAULT USER C:\Documents and Settings\Default User>REG LOAD HKU\TEMPHIV NTUSER.DAT The operation completed successfully C:\Documents and Settings\Default User>REG UNLOAD HKU\TEMPHIV The operation completed successfully C:\Documents and Settings\Default User>POPD C:\Documents and Settings\Yzöwl>Now adding the >NUL prevents the 'standard output' message of The operation completed successfully being shown by redirecting it to nul, (nothing or nowhere), whereas 2>&1 would prevent any subsequent 'standard error' message by redirecting it to the same place as the 'standard output'. You will also notice the >NUL at the end of the reg command which also prevents the 'successfully' message. From the PUSHD message you can see that it basically puts you at another location, the clever bit is that it stores the location you were at when you moved. When you need to go back, use POPD and it will return you to the previous location as stored.
  11. I actually said It happens to be the same nlite preset file that they also posted, in its entirety, in the nlite forum an hour and a half prior to posting it here.
  12. Okay then, please don't confuse criticism or a request for 'explanation' with rudeness! You mentioned: .reg files registry runonce nlite You then posted an very long ini file of some sort. Since that ini file has no bearing in this forum to any of the points in the list above, it would be considered as pointless. It's not me asking for help, it is you. I have both asked for an explanation, which you have so far failed to provide and suggested an nlite forum as a possible better location for your problem to be better understood. Now take another look at: why I used the word pointless the format of the code you posted the lack of information in your opening post the definition of rude Come back, furnish me with more detail, and I may well be better equipped to point you in a more suitable direction.
  13. You have posted what appears to be a very long, and rather pointless ini file of some sort. How about an explanation or possibly posting it in an forum area where its content will be understood. You mentioned nLite, I believe that there is a button nearby which takes you to an nLite forum!
  14. 1. It sounds to me like you've got a little script coming on 2. Scripting that in shouldn't prove a problem, it's more the fact that I tend to think with a similar logical progression to batch scripting, and for the sake of some unused folders, I didn't want to go through the rethink. As I said, I am still considering it, I'm just not ready to do it yet!
  15. @ Djé 1. I would suggest using the default users runonce key @ECHO OFF PUSHD %ALLUSERSPROFILE%\..\DEFAULT USER REG LOAD HKU\TEMPHIV NTUSER.DAT >NUL 2>&1 REG ADD HKU\TEMPHIV\Software\Microsoft\Windows\CurrentVersion\RunOnce /V NewMyDoc /D "cscript /B /nologo \"%%ALLUSERSPROFILE%%\redirect.vbs\"" /F >NUL REG UNLOAD HKU\TEMPHIV>NUL 2>&1 POPD GOTO :EOFThis example would of course mean that you woud need to locate the redirect.vbs in %AllUsersProfile%. 2. I understand what you mean, and it is something I thought about, originally and am still considering. With my lack of confidence in my vbscripting techniques, I just didn't want all my eggs in one basket!
  16. Just another method for reusing /redirecting to an existing My Documents The task: Search all Local hard and Network drives except for the System drive Find the 'My Documents' folder attributed to the current User name Redirect the My Documents, My Music and My Pictures to the found location The problems: The folder does not always get named My Documents or *Documents in fact People for some unknown reason do not always use the User name within the path How to attribute the folder contents to the current user only The thinking: Use something common to all 'My Documents' folders (desktop.ini) Search for all files named desktop.ini on all local and network drives Read each desktop.ini file looking for the name of the current user If found look for something in that file unique to the 'My Documents' ini If a match is found, add the new locations to the appropriate registry keys The result: In order to read all those files, a batch file took far too long. (you wouldn't believe how many desktop.ini files can exist on your system) The vbscript may still take a while, especially searching networks What therefore follows is my attempt at a vbscript to do the job. redirect.vbs sComputerName="." Set oWMI=GetObject("winmgmts:{impersonationLevel=impersonate}//" _ &sComputerName &"\root\cimv2") Set oDriveSet=oWMI.ExecQuery _ ("Select Name From Win32_LogicalDisk WHERE DriveType=3 OR DriveType=4") Set oOSSet=oWMI.ExecQuery("Select * From Win32_OperatingSystem",,48) Set oCompuSet=oWMI.ExecQuery("Select * From Win32_ComputerSystem",,48) For Each sOS In oOSSet sSys=sOS.SystemDrive Next For Each sCompu In oCompuSet sUser=Split(sCompu.UserName,"\") sUser(1)=Trim(sUser(1)) Next For Each sDrive In oDriveSet If sDrive.Name=sSys Then Else FindFile sDrive.Name End If Next Sub FindFile(sDLetter) sDrive=sDLetter sName="desktop" sExtension="ini" sWQL="Select Name From CIM_DataFile WHERE Drive='" _ &sDrive &"' AND Filename='" &sName &"' AND Extension='" _ &sExtension &"'" Set oResult=oWMI.ExecQuery(sWQL,,48) For Each oFile In oResult ReadFile oFile.Name Next End Sub Sub ReadFile(sFName) sIni=sFName sMyDocs=Left(sIni,InStrRev(sIni,"\")) sMyDocs=Left(sMyDocs,Len(sMyDocs)-1) sExpLoc=Replace(sMyDocs,sUser(1),"%UserName%") Set oFS=CreateObject("Scripting.FileSystemObject") Set oIn=oFS.OpenTextFile(sIni,1) bFound=False Do Until oIn.AtEndOfStream sLine=oIn.Readline If InStr(sLine,"Owner=" &sUser(1))>0 Then bFound=True Exit Do End If Loop If bFound=True Then Do Until oIn.AtEndOfStream sLine=oIn.Readline If InStr(sLine,"InfoTip=@Shell32.dll,-22914")>0 Then Set wShell=CreateObject("Wscript.shell") sKey="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\" wShell.RegWrite sKey &"User Shell Folders\Personal",sExpLoc,"REG_EXPAND_SZ" wShell.RegWrite sKey &"Shell Folders\Personal",sMyDocs,"REG_SZ" wShell.RegWrite sKey &"User Shell Folders\My Music",sExpLoc &"\My Music","REG_EXPAND_SZ" wShell.RegWrite sKey &"Shell Folders\My Music",sMyDocs &"\My Music","REG_SZ" wShell.RegWrite sKey &"User Shell Folders\My Pictures",sExpLoc &"\My Pictures","REG_EXPAND_SZ" wShell.RegWrite sKey &"Shell Folders\My Pictures",sMyDocs &"\My Pictures","REG_SZ" Exit Do End If Loop End If End Sub I would suggest this is run as a logon script. For unattended use your initial logged in user name, usually Administrator, would need to be the name you wish to redirect to an existing location. Note It only maps existing 'My Documents' folders to users of the same name as before. Dont expect username Rosemary to take over Rose's old documents folder Disclaimer I am more proficient at coding Windows NT Command Scripts. There may therefore be better or faster ways of achieving the goal with VBScript. If any damage occurs as a direct result of this script, even if you knew me, I would take no responsibility for it.
  17. Well, I'm glad you asked! NO, I still prefer MOUNTVOL, it is however not guaranteed to pick up on every drive. Because everyone is using the (A B C... version, and that method is the one used in 'The Guide' I thought it more prudent to not confuse things. What this method actually does is, hopefully, run through the letters one at a time as usual, but, when it finds a match it breaks out of the loop. If therefore the CD-ROM is at drive H, the loop doesn't continue to look for I:\$OEM$, J:\$OEM$..., Z:\$OEM$. It is also 'more robust' because: If CMDOW is either in PATH or local to the batch it will hide the window, if it isn't then echoing is turned off. Obviously if the window is hidden, then echoing doesn't matter. It doesn't prevent the remote possibility of a CD-ROM on C:, but will not search whatever is appointed as the System Drive. It doesn't set a variable to the CDROM drive, when it isn't needed. It will only copy the contents of the $OEM$ folders if they are there, and in that case, if the window isn't hidden, you will not get a screen output of how many files were copied. If you have already redirected your profile directories using winnt.sif or other method, then it doesn't limit the location of those files to the System Drive.
  18. If only people outside of my computer appreciated me as much as people on it Then again, if that were the case, I probably wouldn't be here now! Lets just smile and celebrate the fact that Yzöwl has no real friends
  19. There are many ways to skin a rabbit. For the task you have in mind however, the problem will be finding one willing to hang around long enough for the task to complete. Hence my first response.
  20. Anyone else re-finding this old thread may be interested in this more robust example for the batch file. OemPreinstall.cmd @CMDOW.EXE @ /HID 2>NUL||@ECHO OFF SETLOCAL ENABLEEXTENSIONS FOR %%? IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( IF /I "%%?:" NEQ "%SYSTEMDRIVE%" CALL :SUB "%%?:" &&GOTO START) GOTO ENDIT :START IF EXIST %MYOEM%\$1 XCOPY %MYOEM%\$1 %SYSTEMDRIVE% /S/I/Q/Y >NUL IF EXIST %MYOEM%\$$ XCOPY %MYOEM%\$$ %SYSTEMROOT% /S/I/Q/Y >NUL IF EXIST %MYOEM%\$Docs XCOPY %MYOEM%\$Docs "%ALLUSERSPROFILE%\.." /S/I/Q/Y >NUL IF EXIST %MYOEM%\$Progs XCOPY %MYOEM%\$Progs %PROGRAMFILES% /S/I/Q/Y >NUL :ENDIT ENDLOCAL &GOTO :EOF :SUB IF NOT EXIST %~1\$OEM$ EXIT/B 1 SET "MYOEM=%~1\$OEM$" EXIT/B 0It should be okay run as is without alteration.
  21. It can be dependent upon the content of your other sub-keys and since I do not have MSN, I cannot test the following code, however I am led to believe that the key you are after is numeric only, therefore @ECHO OFF &SETLOCAL SET "PARTKEY=HKCU\Software\Microsoft\MSNMessenger\PerPassportSettings" FOR /F "DELIMS=" %%? IN ('REG QUERY "%PARTKEY%" /S ^|FINDSTR "\\[0-9]*$" ^2^>NUL') DO IF ERRORLEVEL 0 (SET FULLKEY=%%?) IF DEFINED FULLKEY ( echo/REG ADD "%FULLKEY%" /V DisableTabs /T REG_DWORD /D 1 /F) ENDLOCAL &GOTO :EOFIf you are happy with the result, remove echo/ from line 5. Note, in order to identify line wrap, I have indented each line with two spaces, any line therefore not starting with two spaces has wrapped.
  22. It may look like a solution, but I doubt that you will be able to copy an entire I386 directory from a batch file ran at cmdlines.txt.
  23. You could kill two birds with one stone if you copied over and installed from 'dos'!
  24. I'm not getting at you specifically, but why do people insist on creating CDs with nLite, then posting their, likely related, problems in a non-nLite forum. I'm not saying that it definitely is an nLite problem, but if you used that to integrate SP2, and you have an SP2 problem, then there's a strong possibility, that an nLite forum would be better suited.
  25. In a batch file the command would be: MOVE "%AllUsersProfile%\Start Menu\Programs\Alcohol 120%%" "%AllUsersProfile%\Start Menu\Programs\CD-Burn"
×
×
  • Create New...