Dynamic Array as pivot table SourceData..?
Hi,
As far as I know, the SourceData for a Pivot Table can be an array of
ranges, but it's not working for me. The following code creates a dynamic
array of ranges, which is then supplied to the SourceData parameter of the
PivotTableWizard. This causes an error "Pivot Table Wizard method of
Worksheet class failed".
----------------------------------------------------------------------------
-----
im i As Integer
Dim m As Integer
Dim pivotTableRangeArray() As Range
Dim dataSheetNames() As String
Dim re As New RegExp
' Populate an array of data sheet names
re.IgnoreCase = True
re.Pattern = "[a-z]\.[a-z\_]"
m = 1
For i = 1 To ActiveWorkbook.Sheets.Count
If re.Test(Sheets(i).Name) Then
ReDim Preserve dataSheetNames(1 To m)
dataSheetNames(m) = Sheets(i).Name
'Debug.Print "Sheet:", i, m, dataSheetNames(m)
m = m + 1
End If
Next i
Set re = Nothing
' Populate an array of ranges for the pivot table
For i = 1 To UBound(dataSheetNames)
' populate the pivotTableRangeArray
ReDim Preserve pivotTableRangeArray(1 To i)
Set pivotTableRangeArray(i) =
Sheets(dataSheetNames(i)).Range("A1").CurrentRegion
'Debug.Print i, UBound(pivotTableRangeArray)
Next i
' Create the pivot table - use the
With ActiveSheet
.PivotTableWizard SourceType:=xlDataBase, _
SourceData:=pivotTableRangeArray, _
TableName:="sdc.vsim_c", _
TableDestination:=.Range("A65536").End(xlUp).Offset(2, 0)
End With
----------------------------------------------------------------------------
------
Can anyone shed any light on this?
Thank you very much,
Robert Stober Tag: Capture Cancel button Tag: 144246
newbie problems with ASP querystrings
I'm trying to figure out how to do basic form/querystring handling in
asp and I thought I had it figured out but even though I follow all
the examples I can find, I can't seem to get it to work. Here's a
sample page that will not show the values on my system (on neither the
test server or the live server).
---------------- file: response.asp -----------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Untitled Document</title></head>
<body>
<p>Form Input</p>
<form action="response.asp" method="post" name="response"
id="response">
<table border="2" cellspacing="4" cellpadding="2">
<tr>
<td align="right">FirstName</td>
<td><input name="FirstName" type="text" id="FirstName"
value="Noone"></td>
</tr>
<tr>
<td align="right">LastName</td>
<td><input name="LastName" type="text" id="FirstName22"
value="Special"></td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="Submit"
value="Submit"></td>
</tr>
</table>
</form>
<% If Request.ServerVariables("REQUEST_METHOD") = "POST" Then %>
<p>Form Response</p>
<table border="1" cellspacing="4" cellpadding="2">
<tr>
<td align="right">FirstName</td>
<td><%=Request.QueryString("FirstName")%></td>
</tr>
<tr>
<td align="right">LastName</td>
<td><%=Request.QueryString("LastName")%></td>
</tr>
</table>
<% End If %>
</body>
</html>
--------------- end of file inclusion -----------------
I have had some scripts working with Request.QueryString but I will be
damned if I can see the differences between those and the one's I am
working on now. What am I missing here? If I submit that form, the
second table builds blank right columns...
Kathy Lynn Tag: Capture Cancel button Tag: 144244
Getting Access is Denied Errors
After combining two different scripts (to make one that not only looks
to see if a directory is installed but install one of two different
packages depending) I'm getting so close. I get to line 12 when I get
an Access is Denied error (80070005). I'm trying to use the Domain
Administrators account to no only check but to install the software...
Any help would be appreciated. (BTW, the script is completely
finished so don't mind the crap at the bottom...
1) Const wbemImpersonationLevelDelegate = 4
2) Const wbemAuthenticationLevelDelegate = 1
3) strComputer = "jairo"
4) Set objwbemLocator = CreateObject("WbemScripting.SWbemLocator")
5) Set objWMIService = GetObject("winmgmts:" _
6) & "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
7) Set objConnection = objwbemLocator.ConnectServer _
8) ("jairo", "root\cimv2", "rogers\administrator", _
9) "wideawake")
10) objConnection.Security_.ImpersonationLevel =
wbemImpersonationLevelDelegate
11) objConnection.Security_.AuthenticationLevel =
wbemAuthenticationLevelDelegate
12) Set objSoftware = objConnection.Get("Win32_Product")
13) Set objFSO = CreateObject("Scripting.FileSystemObject")
14) Select Case objFSO.FolderExists("C:\Program Files\IBM\Client
Access")
15) Case objFSO.FolderExists("C:\Program Files\IBM\Client Access")
16) errReturn =
objSoftware.Install("\\file1\common\CAUpgrade.msi", , True)
17) Case Else
18) errReturn = objSoftware.Install("\\file1\common\CA.msi", ,
True)
19) End Select
20) Wscript.Echo errReturn Tag: Capture Cancel button Tag: 144243
Variable Size (character) Limits???
I have an application that uses client side VB Script to create and fill a
variable with items in a HTML multi select list.
Everything works great, but as soon as len(variable) > 1,910 my application
fails. Tag: Capture Cancel button Tag: 144242
new to vbscript : DEBUG
hi,
i write vbs file for an application. My vbs are call for a VB application.
I don't know how to debug my script?
I see some message that spoke about wscript.exe but when i run this program
nothing append
Is there a program for debugging vbscript like in visual basic
Regards
seb Tag: Capture Cancel button Tag: 144241
Wildcards for Set Commands **please help**
Here is what I have, we have over 400 branches in our company each one name
Branch 004, Branch 005, Branch 006, and so on. I want to create one script
that will use a wild card for each Branch name and with that load the proper
Set Commands. Each Branch has its own Snap Server or Network Storage Device,
named Branch 004 Snap, Branch 005 Snap and so on. We used to have it set in
the Autoexec for each PC (SET SNAP=\\BR004snap) , but now that we are an
entirely Windows 2000 or XP, I want to use Active Directory.
Basically what I want to do is this, based on the Branch number set the
variable based on the branch number to the Branch Snap name, for example, if
branch name = branch 004 then 'set snap = branch 004', but I want this to be
done with a wildcard if possible using the Branch number (so I dont have to
key in 400 different scripts for each branch).
Any help would be greatly appreciate, thanks!! Tag: Capture Cancel button Tag: 144239
Listing Processes By Username
I currently have a script that will list all running
processes and the usersnames of the user that the process
was started as.
When I run this script on a machine within a domain I can
list all processes and all usernames, but when the same
script is run on a Windows 2000 Server in a workgroup I
can only list processes running as SYSTEM or the currently
logged on user. I am logged on with the administrator
account but this has no effect. Any ideas as to what could
be causing this would be greatly appreciated.
Thanks
Rhys Tag: Capture Cancel button Tag: 144234
UserAccountControl property values
Hello,
Can anyone please confirm what the UserAccountControl values 4130
and 4128 mean?
4096 is a default workstation account
32 is No password is required
2 is The user account is disabled
My guess is:
4096 + 32 = 4128 = No password is required for the workstation
account.
4096 + 32 +2 = 4130 = The workstation account which does not require a
password is disabled.
Is that the way it works?
Thanks for any replies.
Charles Tag: Capture Cancel button Tag: 144232
Set primary group
I try to set the primary group.
Set objGroup = Getobject(strLDAPPriGroup)
objGroup.GetInfoEx Array("primaryGroupToken"), 0
intPrimaryGroupToken = objGroup.Get("primaryGroupToken")
but i get the Error 0x80005000
Code 80005000
This happens on a Windows 2003 Enterprice DC
Can any one help me?
Thanks already.
Sjoerd Tag: Capture Cancel button Tag: 144229
consistent modified file date format
Hello,
I've written a pretty simple .asp page that displays the file name and date
of a file on the server. When I move this .asp page onto a different server
the modified file date format is not the same as it was on my server. I am
sure the settings on the server where the page is located are much different
than mine, nonetheless I still need to display the proper modified file
date.
On my server the modified file date is displayed as this (after I trim the
string of course)
M/DD/YYYY
On the current server the format looks like this:
M/D/YY
So is there a way for me to build the modified file date? I tried using the
DatePart function on the pointer to the fileObject but it didn't work.
Can this be done?
Cheers,
devin M. arnold
The code looks like this:
<%
Dim oFolder, oFile, oFSO, oFolderCollection, oSubFolder, oBracketToggle,
oCommaToggle
myFolder = Request.QueryString("myFolder")
set oFSO = Server.CreateObject("Scripting.FileSystemObject")
set oFolder = oFSO.GetFolder(Server.MapPath(myFolder))
Response.Write "["
totalFiles = oFolder.Files.Count
fileCounter = 1
For Each oFile In oFolder.Files
myFileName = UCase(oFile.Name)
' lets filter out the files we want to use for the kiosk
if InStr(myFileName, ".BMP") <> 0 OR InStr(myFileName, ".JPG") OR
InStr(myFileName, ".GIF") then
myStr = oFile.DateLastModified
myCharPos = InStr(myStr , " ")
myModifiedDate = Left(myStr, (myCharPos-1))
myFileDay = DatePart("D", myStr )
myFileMonth = DatePart("M", myStr )
myFileYear = DatePart("YYYY", myStr )
Response.Write "myStr =" & myStr
Response.Write "myFileDay =" & myFileDay
Response.Write "myFileMonth =" & myFileDay
Response.Write "myFileYear =" & myFileDay
if fileCounter >= totalFiles then
Response.Write Chr(34) & myFileName & Chr(34) & ": " & Chr(34) &
myModifiedDate & Chr(34)
ELSE
Response.Write Chr(34) & myFileName & Chr(34) & ": " & Chr(34) &
myModifiedDate & Chr(34) & ", "
fileCounter = fileCounter + 1
end if
end if
Next
Response.Write "]"
Set oFSO = Nothing
%> Tag: Capture Cancel button Tag: 144228
Setting Permissions on OU
Is there a way to set the Permissions on OU via script?
(on windows 2003 AD)
Thanks,
Tal. Tag: Capture Cancel button Tag: 144227
1. Found a fatal bug in WinXP... 2. Delete in the Registry when backslash...
Hi,
I found a new security problem in Windows XP that could (most likely,
already happening) delete your data. Microsoft do not know about it..
Read more: http://users.cybercity.dk/~bse26236/tweak/tweak.htm#OOPS
Benny,
PS.
Here is a VBS solution that shows how to delete a variable in the
Registy
that contains a backslash. (The normal way wont work).
' SkipReg.VBS by Benny Pedersen, http://2dos.homepage.dk/
' Oct 3, 2003. Tested on WinXP.
dim wsh: set wsh = createObject("wScript.shell")
dim fso: set fso = createObject("scripting.fileSystemObject")
dim exportFile, key
exportFile = fso.getSpecialFolder(2) & ".\export.reg"
key="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion" &_
"\SharedDLLs"
if not fso.fileExists(exportFile) then
wsh.run("regedit /e """ & exportFile & """ """ & key & """"),, 1
else key = ""
end if
if key = "" or not fso.fileExists(exportFile) then
msgBox "Export failure. ", vbInformation, "Error"
if key = "" then wsh.run "explorer " & fso.getSpecialFolder(2)
else dim importFile, i, regVariableNames, numbOfVar2delRequest
importFile = fso.getSpecialFolder(2) & ".\import.reg"
i = "*"
regVariableNames =_
i & "C:\KPCMS\DCPDB\ADOBERGB.PT" &_
i & "C:\KPCMS\DCPDB\PHCDCN01.PT" &_
empty
regVariableNames = split(regVariableNames, "*")
numbOfVar2delRequest = uBound(regVariableNames)
if numbOfVar2delRequest > 0 then skip()
end if
set wsh = nothing
set fso = nothing
sub skip()
dim rFile: set rFile = fso.openTextFile(exportFile, 1)
dim wFile: set wFile = fso.openTextFile(importFile, 2, true)
dim numbOfVar2delFound, counter, rLine, ascii, w, i, ugly, eNote
numbOfVar2delFound = 0: counter = -5
do: on error resume next: rLine = rFile.readLine
if err <> 0 then exit do
on error goto 0
for each ascii in array(0,10,13,254,255)
rLine = replace(rLine, chr(ascii), "")
next
w = true
for i=1 to numbOfVar2delRequest
ugly = """" & replace(regVariableNames(i), "\", "\\") & """="
if ugly = left(rLine,len(ugly)) then _
numbOfVar2delFound = numbOfVar2delFound+1: w = false: exit for
next
counter = counter +1
if w then wFile.writeLine rLine
loop
rFile.close: set rFile = nothing
wFile.close: set wFile = nothing
if numbOfVar2delFound < 1 then
err.raise(6)
else err.clear
wsh.regDelete key & "\"
' NOTE: Cannot delete a key that contains subkey(s).
end if
select case err
case 0: eNote = "Succeeded."
case 6: eNote = "No match."
case else: err.clear: err.raise(17): eNote = err.description
end select
on error goto 0
if eNote = "Succeeded." then
wsh.run("regedit """ & importFile & """"),, 1
fso.deleteFile importFile
wsh.run("regedit /e """ & importFile & """ """ & key & """"),, 1
if not fso.fileExists(importFile) then
eNote = "FATAL ERROR."_
& string(2,vbLf) & "You just answered [NO] to put " &_
counter - numbOfVar2delFound & " variable back to the Registry"_
& " that was removed. " & string(2,vbLf) & "IMPORTANT: " &_
"To restore your system, run this file:" & string(2,vbLf) &_
"""" & exportFile & """," & string(2,vbLf) &_
"then restart """ & wScript.scriptFullName & """"
end if
end if
msgBox "Request: Delete " & numbOfVar2delRequest &_
" variable from the Registry." & vbLf & "Result: Found " &_
numbOfVar2delFound & "." & string(2,vbLf) & eNote, vbInformation,_
left(eNote,inStr(eNote,"."))
if fso.fileExists(importFile) then
fso.deleteFile importFile
fso.deleteFile exportFile
else wsh.run "explorer " & fso.getParentFoldername(exportFile)
end if
end sub Tag: Capture Cancel button Tag: 144226
Search documentation scripting
Hello everybody,
I don't know a scripting, but I want to learn it.
Do you know a good site ? or a good book?
Regards Tag: Capture Cancel button Tag: 144208
FileSystemObject
Hi,
Creating ASP page in Visual Interdev 6.0 with VBScript.
Trying to get all folders under each drive.
Code...
Dim fso, folder, s, subFolders
Set FSO = CreateObject("Scripting.FileSystemObject")
' Get Drive object.
Set folder = fso.GetFolder("c:")
Set subFolders = folder.SubFolders
' Print parent folder name.
Response.write "Parent folder name is: " & folder & "<BR><BR>"
For Each folder in subFolders
Response.Write "FolderName: " & folder.Name & "<br>"
Response.Write "Attributes: " & folder.Attributes & "<br>"
Response.Write "Type: " & folder.Type & "<br>"
Response.Write "Size: " & folder.Size & "<br>"
Response.Write "ShortName: " & folder.ShortName & "<br>"
Next
______________
fso.GetFoler("A:") - Parent folder name is:
- Works fine.
fso.GetFolder("C:") - Local drive. Parent folder name is:
"C:\winnt\System32" - Displays folder appmgmt to dhcp.
Microsoft VBScript runtime error '800a0046' Permission denied error after
that.
fso.GetFolder("D:') - Local
- Page cannot be displayed or Microsoft VBScript runtime error
'800a004c' Path not found. fso.GetFolder("H:") - CD-Rom
- Works fine.
fso.GetFolder("E:") - Mapped
- Page cannot be displayed or Microsoft VBScript runtime error
'800a004c' Path not found.
Not sure why C:\ drive parent is "winnt\System32" directory instead of
"C:\".
Not sure why D (local) and E (mapped) drive cannot be found.
Help in this matter is greatly appreciated.
- Reena Tag: Capture Cancel button Tag: 144205
Script to launch another script
I am trying to get a master script to launch small scripts as jobs and pass
parameters on to the second script.
I construct the commandline from an XML file and the exact syntax is as
follows:
<!--
cscript C:\vb\ECH\MCP\copier.vbs C:\vb\ECH\ECHO V2\upload\1\batch.txt
C:\vb\ECH\MCP\batch.txt
-->
1.)copier.vbs is the second script to be called
2.)the first param is basically the source filepath
3.)the second param is the target filepath
here is the sysntax I am using to call the other script.
CommandLine = script & " " & filepath & " " & parampath & filename
Set WshShell = CreateObject("WScript.Shell")
WshShell.Exec(CommandLine)
Brian Tag: Capture Cancel button Tag: 144200
Simple assignment of function return value fails - vbs Rusty
This is probably a really simple error, but I haven't been able to
resolve it. Your help would be much appreciated.
I return an array of objects from a function. I'm trying to assign
the result to an array without success. The code from a) the script
and b) an xml file follows. Don't get bogged down in the xml. I
think this is a really basic problem as I am rusty with vbs.
The error message is: Type Mismatch 800A000D. The error occurs on the
very last line of the script.
TIA...
'//**************************************************************
'//**************************************************************
' VB Script Document
Class Department
private deptName
private drives()
private printers()
Public Function setDeptName(strName)
deptName = strName
End Function
Public Function getDeptName()
getDeptName = deptName
End Function
Public Function setNumDrives(intNumDrives)
Redim Preserve drives(intNumDrives,1)
End Function
Public Function setDrive(row,col,val)
drives(row,col) = val
End Function
Public Function get2dDriveAry()
get2dDriveAry = drives
End Function
Public Function setNumPrinters(intNumPrinters)
Redim Preserve printers(intNumPrinters)
End Function
Public Function setPrinter(row,val)
printers(row) = val
End Function
Public Function getPrinterAry()
getPrinterAry = printers
End Function
end class
function getDrivesNPrintersByDept (xmlRscFile)
'array used to store a collection of Departmental Resource objects
dim aryRscObjects()
'*** Local object used to store Resource info ***
dim oDeptResource
set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(xmlRscFile)
Set ElemList = xmlDoc.getElementsByTagName("department")
'*** Iterate through by department ***
For i=0 To (ElemList.length -1)
'*** Get an new object
set oDeptResource = New Department
'*** print xml for the departments
'msgbox ElemList.item(i).xml
'***GET THE NAME
set dept_name= ElemList.item(i).childnodes(0)
oDeptResource.setDeptName dept_name.text
'***GET THE DRIVES
set drives = ElemList.item(i).childnodes(1).childnodes
'*** dim the array to the correct size
oDeptResource.setNumDrives(drives.length-1)
'*** iterate through the drives ***
For k=0 To (drives.length -1)
oDeptResource.setDrive k,0,drives.item(k).childnodes(0).text
oDeptResource.setDrive k,1,drives.item(k).childnodes(1).text
Next
'***GET THE PRINTERS ***
set printers = ElemList.item(i).childnodes(2).childnodes
'*** dim the array to the correct size
oDeptResource.setNumPrinters(printers.length -1)
For l = 0 To (printers.length -1)
oDeptResource.setPrinter l,printers.item(l).childnodes(0).text
Next
'*** expand the array to hold one more w/o losing current contents
redim preserve aryRscObjects(i+1)
'*** add the current object to the array
set aryRscObjects(i) = oDeptResource
Next
'*** return the array
getDrivesNPrintersByDept = aryRscObjects
end Function
'*** MAIN ***
dim aryRscs()
strXmlFile = "myXML.xml"
aryRscs = getDrivesNPrintersByDept strXmlFile
'//**************************************************************
'//**************************************************************
<?xml version="1.0" ?>
<!-- the first printer in the list of printers will be the default
-->
<departmental_resource_assignments>
<department>
<name>Development</name>
<drives>
<drive>
<letter>f:</letter>
<path>\\theat\groups</path>
</drive>
<drive>
<letter>g:</letter>
<path>\\prod\development</path>
</drive>
<drive>
<letter>r:</letter>
<path>\\raiser\dev</path>
</drive>
<drive>
<letter>s:</letter>
<path>\\theat\shared</path>
</drive>
</drives>
<printers>
<printer>
<path>\\theat\dev_hp8100</path>
</printer>
<printer>
<path>\\theat\dev_hp5M</path>
</printer>
</printers>
</department>
<department>
<name>Artistic</name>
<drives>
<drive>
<letter>f:</letter>
<path>\\theat\xxxx</path>
</drive>
</drives>
<printers>
<printer>
<path>\\theat\dev_hpxxx</path>
</printer>
<printer>
<path>\\theat\dev_hpxxx</path>
</printer>
</printers>
</department>
</departmental_resource_assignments> Tag: Capture Cancel button Tag: 144197
Mac characters
trying to display information in asp that contain mac
characters from SQL DB, the character appears as a
question mark in asp, ie the word icon?, an accent should
appear above the 'n' instead of a question mark beside
the 'n'.
please help
Cheers Tag: Capture Cancel button Tag: 144194
Problems with updated pages
Hi!
when i make a new version of my pages and i try to test it=20
i can't see the changes, i thougt it may be caused by the=20
browser cache, but i cleaned it and tested in another=20
computer but i continue without seen the changes.
It seems that the server (iis) don=B4t processed the asp=20
page and send another processed before, stored in a server=20
buffer.=20
There any way to avoid this???
Can anybody help me?
Thanks Tag: Capture Cancel button Tag: 144192
AppActivate
I am using the AppActivate statement to call a window by title, but I only
want it to run if the window is actually available. Is there a way to list
all active window titles in a collection where I can verify the window is
active? If not, is there a better way to activate a window by title only if
it is available?
TIA
Charles Tag: Capture Cancel button Tag: 144190
how to call a sub or function from case..end
Hi
i need help
i am using a vbscript for exprting users info from the AD
But i do not want to export all users
users who have the user "phonehome: prperty empty -will not be exported
As shown below
each time i am using the "then call " syntax
i recieve syntax error message
is there a way of "calling" a sub or function from within case..end proceadure
....
For Each oUser In oCont
Select Case LCase(oUser.Class)
Case "user"
If IsEmpty(oUser.homephone) Then call...
End If
else
If Not IsEmpty(oUser.st) Then
OutPutFile.WriteLine "state: " & oUser.st
End If
.
.
.
End Select
OutPutFile.WriteLine
Next
End Sub
Thnks Tag: Capture Cancel button Tag: 144189
movehere
What am I doing wrong?
I wish to move this user from one ou to another. The error I get is "null,
there is no such object on the server."
Yet when I change the path in the movehere statement and change the name at
the end and also to look in users current ou, it renames the account just
fine. So it does see the account, but I must be missing something to get it
to move.
Set Container = GetObject ("LDAP://yms12/OU=TestOU,DC=test,DC=org" )
Set NewObjectName = Container.MoveHere
("LDAP://cn=smoxey01,ou=TestOU,ou=sus,DC=test,DC=org","cn=smoxey01") Tag: Capture Cancel button Tag: 144188
Help with Script.
Guys,
I need a little help here...
This is case, I have a batch of files that I need to edit in photoshop.
I'm trying to use the below code to accomplish this, but it seems that I'm
doing something wrong or missing something.
I need an array to bound all files of type *.jpg; then open Photoshop use
automation to do minor conversion for web viewing and go to the next.
I attempted to do this but I don't know what going on.
Any help will be greatly appreciated
Neil Pilier
npilier@miami.edu
Snipped code
--------------------------------------------------------------------
Option Explicit
Dim fso, f, f1, i, s, myArray(), ws, oAutoIt, iii
redim myArray(0)
set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.GetFolder ("C:\test")
set ws = WScript.CreateObject("WScript.Shell")
set oAutoIt = CreateObject("AutoItX.Control")
For Each f1 In f.Files
redim preserve myArray(Ubound(myArray) + 1)
myArray(Ubound(myArray)) = f1.Name
Next
On Error Resume Next
for iii = 0 to ubound(myArray)
If lcase(fso.GetExtensionName(myArray(i))) = "jpg" then
ws.Run ("Photoshop.exe " & myArray(iii))
WScript.Sleep 6000
ws.AppActivate "Adobe Photoshop"
ws.SendKeys " "
ws.SendKeys "%(+^s)"
WScript.Sleep 500
oAutoIt.LeftClick 864, 296
WScript.Sleep 500
oAutoIt.LeftClick 843, 395
oAutoIt.LeftClick 843, 395
WScript.Sleep 500
ws.SendKeys "392"
WScript.Sleep 500
oAutoIt.LeftClick 864, 509
WScript.Sleep 500
oAutoIt.LeftClick 863, 56
WScript.Sleep 500
ws.SendKeys "{TAB 2}"
WScript.Sleep 500
ws.SendKeys "{ENTER}"
WScript.Sleep 500
ws.SendKeys "^(w)"
WScript.Sleep 500
ws.SendKeys "{TAB}"
WScript.Sleep 500
ws.SendKeys " "
WScript.Sleep 500
end if
Next
set fso = nothing
set f = nothing
set ws = nothing
set oAutoIt = nothing Tag: Capture Cancel button Tag: 144186
Help with Script.
Guys,
I need a little help here...
This is case, I have a batch of files that I need to edit in photoshop.
I'm trying to use the below code to accomplish this, but it seems that I'm
doing something wrong or missing something.
I need an array to bound all files of type *.jpg; then open Photoshop use
automation to do minor conversion for web viewing and go to the next.
I attempted to do this but I don't know what going on.
Any help will be greatly appreciated
Neil Pilier
npilier@miami.edu
Snipped code
--------------------------------------------------------------------
Option Explicit
Dim fso, f, f1, i, s, myArray(), ws, oAutoIt, iii
redim myArray(0)
set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.GetFolder ("C:\test")
set ws = WScript.CreateObject("WScript.Shell")
set oAutoIt = CreateObject("AutoItX.Control")
For Each f1 In f.Files
redim preserve myArray(Ubound(myArray) + 1)
myArray(Ubound(myArray)) = f1.Name
Next
On Error Resume Next
for iii = 0 to ubound(myArray)
If lcase(fso.GetExtensionName(myArray(i))) = "jpg" then
ws.Run ("Photoshop.exe " & myArray(iii))
WScript.Sleep 6000
ws.AppActivate "Adobe Photoshop"
ws.SendKeys " "
ws.SendKeys "%(+^s)"
WScript.Sleep 500
oAutoIt.LeftClick 864, 296
WScript.Sleep 500
oAutoIt.LeftClick 843, 395
oAutoIt.LeftClick 843, 395
WScript.Sleep 500
ws.SendKeys "392"
WScript.Sleep 500
oAutoIt.LeftClick 864, 509
WScript.Sleep 500
oAutoIt.LeftClick 863, 56
WScript.Sleep 500
ws.SendKeys "{TAB 2}"
WScript.Sleep 500
ws.SendKeys "{ENTER}"
WScript.Sleep 500
ws.SendKeys "^(w)"
WScript.Sleep 500
ws.SendKeys "{TAB}"
WScript.Sleep 500
ws.SendKeys " "
WScript.Sleep 500
end if
Next
set fso = nothing
set f = nothing
set ws = nothing
set oAutoIt = nothing Tag: Capture Cancel button Tag: 144185
Payflow response
Hi everyone. Using active server page I am sending a transaction to VERISIGN
and getting a response back from verisign. The response is written to the
page through the following value.
response.write name
response.write " = "
Response.Write value
I am trying to get the response split namely the PNREF,
RESPONSE,APPROVAL,ETC and insert some information into the database and
also redirect the user to a page based on the response I get back.
Can someone please help me with a script, iam entirely new to this.
Thanks
Ola Tag: Capture Cancel button Tag: 144184
Help with Script.
Guys,
I need a little help here...
This is case, I have a batch of files that I need to edit in photoshop.
I'm trying to use the below code to accomplish this, but it seems that I'm
doing something wrong or missing something.
I need an array to bound all files of type *.jpg; then open Photoshop use
automation to do minor conversion for web viewing and go to the next.
I attempted to do this but I don't know what going on.
Any help will be greatly appreciated
Neil Pilier
npilier@miami.edu
Snipped code
--------------------------------------------------------------------
Option Explicit
Dim fso, f, f1, i, s, myArray(), ws, oAutoIt, iii
redim myArray(0)
set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.GetFolder ("C:\test")
set ws = WScript.CreateObject("WScript.Shell")
set oAutoIt = CreateObject("AutoItX.Control")
For Each f1 In f.Files
redim preserve myArray(Ubound(myArray) + 1)
myArray(Ubound(myArray)) = f1.Name
Next
On Error Resume Next
for iii = 0 to ubound(myArray)
If lcase(fso.GetExtensionName(myArray(i))) = "jpg" then
ws.Run ("Photoshop.exe " & myArray(iii))
WScript.Sleep 6000
ws.AppActivate "Adobe Photoshop"
ws.SendKeys " "
ws.SendKeys "%(+^s)"
WScript.Sleep 500
oAutoIt.LeftClick 864, 296
WScript.Sleep 500
oAutoIt.LeftClick 843, 395
oAutoIt.LeftClick 843, 395
WScript.Sleep 500
ws.SendKeys "392"
WScript.Sleep 500
oAutoIt.LeftClick 864, 509
WScript.Sleep 500
oAutoIt.LeftClick 863, 56
WScript.Sleep 500
ws.SendKeys "{TAB 2}"
WScript.Sleep 500
ws.SendKeys "{ENTER}"
WScript.Sleep 500
ws.SendKeys "^(w)"
WScript.Sleep 500
ws.SendKeys "{TAB}"
WScript.Sleep 500
ws.SendKeys " "
WScript.Sleep 500
end if
Next
set fso = nothing
set f = nothing
set ws = nothing
set oAutoIt = nothing Tag: Capture Cancel button Tag: 144183
Help with Script.
Guys,
I need a little help here...
This is case, I have a batch of files that I need to edit in photoshop.
I'm trying to use the below code to accomplish this, but it seems that I'm
doing something wrong or missing something.
I need an array to bound all files of type *.jpg; then open Photoshop use
automation to do minor conversion for web viewing and go to the next.
I attempted to do this but I don't know what going on.
Any help will be greatly appreciated
Neil Pilier
npilier@miami.edu
Snipped code
--------------------------------------------------------------------
Option Explicit
Dim fso, f, f1, i, s, myArray(), ws, oAutoIt, iii
redim myArray(0)
set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.GetFolder ("C:\test")
set ws = WScript.CreateObject("WScript.Shell")
set oAutoIt = CreateObject("AutoItX.Control")
For Each f1 In f.Files
redim preserve myArray(Ubound(myArray) + 1)
myArray(Ubound(myArray)) = f1.Name
Next
On Error Resume Next
for iii = 0 to ubound(myArray)
If lcase(fso.GetExtensionName(myArray(i))) = "jpg" then
ws.Run ("Photoshop.exe " & myArray(iii))
WScript.Sleep 6000
ws.AppActivate "Adobe Photoshop"
ws.SendKeys " "
ws.SendKeys "%(+^s)"
WScript.Sleep 500
oAutoIt.LeftClick 864, 296
WScript.Sleep 500
oAutoIt.LeftClick 843, 395
oAutoIt.LeftClick 843, 395
WScript.Sleep 500
ws.SendKeys "392"
WScript.Sleep 500
oAutoIt.LeftClick 864, 509
WScript.Sleep 500
oAutoIt.LeftClick 863, 56
WScript.Sleep 500
ws.SendKeys "{TAB 2}"
WScript.Sleep 500
ws.SendKeys "{ENTER}"
WScript.Sleep 500
ws.SendKeys "^(w)"
WScript.Sleep 500
ws.SendKeys "{TAB}"
WScript.Sleep 500
ws.SendKeys " "
WScript.Sleep 500
end if
Next
set fso = nothing
set f = nothing
set ws = nothing
set oAutoIt = nothing Tag: Capture Cancel button Tag: 144182
copying data from tape drive
Hi,
How do i write a script to copy contents of remote tape drive which is
running NTBackup, to my computer?
thanks Tag: Capture Cancel button Tag: 144180
Runas script
I have a script that looks like this:
set WshShell = CreateObject("WScript.Shell")
WshShell.Run "runas /user:mrx""e:\test.exe -10.0.0.1 -
kalle -olle"""
WScript.Sleep 100
WshShell.Sendkeys "password~"
It works fine. but I want to use this script on a
terminalserver, and therefore I want to create a shortcut
that starts my vbscrip like this.
myvbscript.vbe -x -y -z
Where x= ipaddress, y= username, z=password
How du I send this startup parameters to my vbscript Tag: Capture Cancel button Tag: 144177
Independent processes and file renaming
What I need: A way to open a bunch of internet shortcuts from a vbs or
jscript script on Win2K SP3 with independent processes.
My Problem: I work in a helpdesk that has a lot of "online" tools. I
usually have 6-15 web pages open at any given time. But there is this one
that always crashes every few hours. When it crashes IE has to be
restarted. When I log on I have a bunch of URL shortcuts in my Startup
folder. If I've opened them all up (including the evil program)
automatically from the Startup folder, at logon, they all close when that
one troublesome program crashes.
I know I could just open up the evil program last by itself but I don't want
to. What can I say; I just want to make this work my way.
Is there a way to have a script read a text file full of URLs and open them
up with independent processes using an unaltered WSH from Win2K SP3? I
can't alter the computer in any way to support PERL or Python or anything
else... I'm stuck with VBScript or Jscript.
Request #2
I want to write a script that renames a bunch of files in a directory using
a certain convention like file file01.jpg, file02.jpg, etc...
Everywhere (including MSDN) says that with the FIlesystemObject in the WSH
can't do that with binaries like jpegs. Is there any way around that? What
about using .bat files? I've seen some very cool .bat files but I haven't
been able to find a reference for how to create all the detailed parts of
one. If you can help with that please let me know.
Thanks in advance
Nathan Tag: Capture Cancel button Tag: 144172
TIP - Regular Expression for Returning Text up to a Blank Line - [\s\S]*?(?:\r?\n){2}
This is a useful ditty that someone sent me. I had wanted to return a
section of a string extracted from a Text File from a particular point
up until the first blank line.
The pattern to use is "[\s\S]*?(?:\r?\n){2}".
[\s\S]*? - Any number of any characters or no character at all. The
"?" at the end makes the SubMatch non-greedy i.e. it only matches the
first occurrence. I am not sure why the "?" is necessary but you could
give it a go without it. It may just speed the matching process; just
do enough matching to say that there are "0 or more matches" and then
move on to next pattern i.e. "(?:\r?\n){2}".
(?:) - Don't return this sequence as a SubMatch. Note this is only
needed if you intend to get SubMatches and not just match the entire
string. It is a heavy price to pay for wanting to group characters
whilst also wanting SubMatches.
\r?\n - Carriage Return (optional due to "?") and Line Feed
(required). Note that some Operating Systems/Editors do not put a
Carriage Return in files.
(?:\r?\n){2} - Two such CRLF sequences in series with nothing in
between and not returned as a submatch.
Hope this is of use to someone out there 8:-)>
D. Rocke,
Scotland. Tag: Capture Cancel button Tag: 144171
Global.asa and application recordset variable ...
Hi !
I'm trying to declare and initialize application variable which will be of
type "ADODB.Recordset". I would then also fill it with values in Global.asa.
Idea is to create application recordset and fill it with some data from
database (so recordset will hold data in memory). Then every other page
would access that recordset to show data in asp pages.
How to do that ?
Thanks,
Drago. :-) Tag: Capture Cancel button Tag: 144169
HELP. WMI check and reg check script
Guys,gals,
I am working on a problem at the moment in where I need to patch about
60 Armada e500 laptops . I want to write a vbscript to do this. I was
thinking about doing a Win32_ComputerSystem _ Model and doing a quick
check of the registry to see if the patch is install .. blah.. and
then install if it doesn't exist. I have next to no Vb experience and
just need a quick hand getting going and I should be right . So far I
have
StrComputer=InputBox("Enter Computer Name ")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & StrComputer &
"\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer2 in colSettings
objFile.WriteLine "Manufacturer: " & Chr(9) &
objComputer2.Manufacturer
objFile.WriteLine "Model : " & Chr(9) & objComputer2.Model
Next
I don't know how to check with vb for a reg key . but I need to check
if
HKEY_LOCAL_MACHINE\SOFTWARE\Compaq\PWRCON32.CPL\4.10
exists and then install a install.cmd file I have created with the
approiate strings. Can someone help me through this together. Tag: Capture Cancel button Tag: 144161
How can I tell if a worksheet exists?
Hi,
I want to determine if a worksheet named Sheets("Chart") exists. How can I
do this using VBA?
Thank you,
Robert Stober Tag: Capture Cancel button Tag: 144154
add my web site to the favorite in IE
I want to make a link that allows users to add my web site to the favorite
in IE. Anyone knows how to do that? Tag: Capture Cancel button Tag: 144148
Retrive exchange mailbox info
Is there a way with vbscript to enumerate exchange mailbox info for =
users? ie mailbox size, last logon date, last logon user? similar to =
what you see from the exchange admin utility?
I can't locate anything in there.
If RTFM please point me to the proper M :-)
Thanks
-Matt Tag: Capture Cancel button Tag: 144146
Using VBS to check that an ActiveX control was installed properly?
Hi,
Is there a way to have some VBScript in a web page after an
OBJECT section to make sure that an ActiveX control or its
prerequirements (VB run-time, etc.) is correctly installed on the
client host?
I've seen some registry-related samples in VBScript, but they seem to
require the WSH package to be installed prior to running this type of
VBScript code.
Thank you
JD. Tag: Capture Cancel button Tag: 144144
Excel and HTML
Hoi,
IN vbs i used this code
--------------------------------------------------
Set objXL = GetObject(,"Excel.Application")
If objXL Is Nothing Then
rem no excel active
else
msgbox "Close Excel Please"
End If
set objxl = nothing
--------------------------------------------------
when I use this code in HTML vbscript it won't work
anyone idees
thanks
Jan Tag: Capture Cancel button Tag: 144143
regular expression for SQL fields
hi all
I have a string like this:
dbo.ManageDate(Now(),5,"A") as Mdate,mid(Company,1,5) as s,
dbo.GetSocCode(mid(Company,7,5)) as sCode
this is the part of a SQL query between SELECT and FROM.
What Regular expression returns the fields separately i.e.
- dbo.ManageDate(Now(),5,"A") as Mdate
- mid(Company,1,5) as s
- dbo.GetSocCode(mid(Company,7,5)) as sCode ?
Can't use comma as separator (appears in function, too).
i tried to use only commas NOT in () , but i failed... Tag: Capture Cancel button Tag: 144139
Prove this critical pack which comes from the M$ Corp.
--ybacnuwecruf
Content-Type: multipart/related; boundary="wbjhikccupkgxjr";
type="multipart/alternative"
--wbjhikccupkgxjr
Content-Type: multipart/alternative; boundary="othxyhchznufhrgq"
--othxyhchznufhrgq
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Microsoft Customer
this is the latest version of security update, the
"September 2003, Cumulative Patch" update which fixes
all known security vulnerabilities affecting
MS Internet Explorer, MS Outlook and MS Outlook Express.
Install now to maintain the security of your computer.
This update includes the functionality =
of all previously released patches.
Microsoft Product Support Services and Knowledge Base articles =
can be found on the Microsoft Technical Support web site.
http://support.microsoft.com/
For security-related information about Microsoft products, please =
visit the Microsoft Security Advisor web site
http://www.microsoft.com/security/
Thank you for using Microsoft products.
Please do not reply to this message.
It was sent from an unmonitored e-mail address and we are unable =
to respond to any replies.
----------------------------------------------
The names of the actual companies and products mentioned =
herein are the trademarks of their respective owners.
Copyright 2003 Microsoft Corporation.
--othxyhchznufhrgq
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<HTML>
<HEAD>
<style type=3D'text/css'>.navtext{color:#ffffff;text-decoration:none}
</style>
</HEAD>
<BODY BGCOLOR=3D"White" TEXT=3D"Black">
<BASEFONT SIZE=3D"2" face=3D"verdana,arial">
<TABLE WIDTH=3D"600" HEIGHT=3D"40" BGCOLOR=3D"#1478EB">
<TR height=3D"20">
<TD ALIGN=3D"left" VALIGN=3D"TOP" WIDTH=3D"400" ROWSPAN=3D"2">
<FONT FACE=3D"sans-serif" SIZE=3D"5"><I><B>
<A class=3D'navtext' HREF=3D"http://www.microsoft.com/"
TITLE=3D"Microsoft Home Site" target=3D"_top">Microsoft</A>
</B></I></FONT>
</TD>
<TD ALIGN=3D"right"