VB Script

37K

Solutions

20K

Contributors

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi,

I have this json request that I want to deserialize to an vb object. The json looks like this:
{
    "PerReg": [
        {
            "AnstNr": "1",
            "EfNamn": "Ljunggren",
            "FoNamn": "Siv",
            "Adress1": "Föreningsgatan 33",
            "Adress2": "",
            "PostNr": "447 34",
            "PostOrt": "VÅRGÅRDA",
            "LandAdr": "",
            "EpostPriv": "",
            "EpostArb": "",
            "Telefon": "0322-21298",
            "Mobil": "",
            "PersNr": "197901049283",
            "Signatur": "SL",
            "Befattning": "VD",
            "AnstDatum": "2001-09-01",
            "Slutat": false,
            "AvgDatum": "1899-12-30",
            "AnstTom": "1899-12-30",
            "Locked": false,
            "KalSchemaAuto": false,
            "UseOBRegel": false,
            "LockOBRegel": false,
            "OBRegelID": "",
            "UseArbSchema": true,
            "ArbSchema": "1",
            "Avdelning": "10",
            "KalUseAttest": true,
            "PerTyp": "LED",
            "AnstForm": "TV",
            "LoneForm": "MÅN",
            "LSSBerPerStart": "1899-12-30",
            "LSSBerPerInt": "",
            "LSSAnnanArbGiv": false,
            "LSSArbGivNamn": "",
            "LSSArbGivOrgnr": "",
            "UseSysGrad": true,
            "SysGrad": 100,
            "VeckArbTid": 40,
            "HelVeckTid": 40,
            "VeckArbDgr": 5,
            "DagArbTid": 8,
        

Open in new window

0
CompTIA Cloud+
LVL 12
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

I could use some help with my script. I put *** where I need help making a code that would auto enter the most recent sundays date. Could you help?

[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine
subSub1_

sub subSub1_()
   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[tab]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "158"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[field+]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "5"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
   
   autECLSession.autECLPS.WaitForAttrib 10,56,"00","3c",3,10000

   autECLSession.autECLPS.WaitForCursor 10,57,10000

   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   ***Input the most recent sunday's date.
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[field+]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[field+]"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "580171"
end sub
1
Hi ,

i have working script..
i want to put additional checks in the script to check for files and proceed further.
it should check for files after it checks for source folder.
if all three files available then proceed further to run remaining lines of checking backupfolder.
if even one file is missing or all missing it should write log the missing files and exit

Files names to check-
cat.xml
rat.xml
bat.xml

$logdate=Get-Date -Format ddMMMyyyy_HHmmss
$Logfile = "E:\Logs\FileProcessing_$logdate.txt"

function LogWrite ([string]$logstring)
{  
   Add-content $Logfile -value $logstring
}

#Zip Files
$sourcefolder="E:\INT\PUT"
$backupFolder="E:\INT\Archive"

#check if source exists
if(!(Test-Path $sourcefolder)){
    $msj="The source folder ""$($sourcefolder)"" doesn't exists. Exiting..."
    LogWrite "$( Get-Date -Format "yyyy-MM-dd HH:mm:ss" ) ERROR:`t$msj"
    LogWrite -ForegroundColor Red $msj
    exit -1
}

#check the target folder or create it
if(!(Test-Path $backupFolder)){
    $msj="The target folder ""$($backupFolder)"" was created"
    LogWrite "$( Get-Date -Format "yyyy-MM-dd HH:mm:ss" ) EXECUTE:`t$msj"
    LogWrite -ForegroundColor Magenta $msj
    New-Item -ItemType Directory -Path $backupFolder | Out-Null
}
foreach($file in (Get-ChildItem -File $sourcefolder -Filter "*.xml" -Recurse)){
    $date = Get-date -Format "ddMMyyyy_HHmmss"
    $destinationFile = "$($FILE.Directory.FullName)\$($file.Name).zip"
    $MoveFile = …
0
I would like to know a simple script, either using .bat, vbs or powershell, to send an email to several email recipients, with 1 specific attachment.
Using a gmail email account.
I would like to be prompted for what to input for the Subject, the Body of the email, and I would like to be prompted the name of the file to attach.
A pop up where I can type the Subject, the Body, and the name of the file would be good.
For simplicity's sake the attachment will reside at:  C:\Attachment..

**Very importantly I would like to add BCC recipients, multiple**
I have a script that works however I cannot seem to add BCC recipients.

Thanks in advance for your assistance.
0
Good Afternoon,

I am looking for a script that can do a comparison between two types of files and output the differences to a new file.

The two files are a list of names, I am looking to see what names are missing from the file called 'Names2.txt' compared to the full list of names from the file called 'Names.csv'


0
Hi,

Please I need a script (powershell or VBs) to Assign 'Self' Permissions to allow user to modify self "home folder" in Active directory

I have a list of 150 users;

Example attached.ask.png
Thx
0
Does anyone know of resources either in books or on the web, or does anyone have experience of using SCSI Pass Through / Direct using (ideally VB6).
I am interested in how to set up the IOCTL_SCSI_PASS_THROUGH / DIRECT without using .net I have tried some sample .net code and it is clunky and very slow.
0
I have a vbs script that sends me a text message.  Running the vbs file from it's location appears to work (I get the text message).

I created a task to run this script in the event of a successful backup.

Running the task on demand shows it ran successfully but I don't receive a text message.

This is running on Server 2012.
0
HI,
Unique Sequence values comparing A:A (Unique) Multiples in (F:F) with Date variation in (C:C)

I was working on a simple logic, however while on Date() it do not provide the desired output.
As per the sample attached
The primary data needs to be compared based on earliest date concept.
 

Lets say, APPLE_1_55 & GRAPES_1_55 are unique duplicates based on condition "1_55". The countif() formula will give me the sequence in Col H which is highlighted in Yellow.
I need a solution where the unique sequence are generated based on date () in Column C, considering the date value as current to earliest.

The current date with the first sequence will be zero
The second sequence will be one, even if the date are exactly same.
Example (APPLE_1_55 & GRAPES_1_55 are with 4/2/2017)

to simplify Adding to the question, when SEQUENCE ON B occurs 2 and above, than SEQ ON C needs to be populated from latest date to the old date method.

PRIMARY DATA      UNIQUE_PRO_PUR      SEQ ON C      SEQUENCE ON B
APPLE 1_1               04/11/2017                                  0                              1
ORANGE 1_55      04/02/2017                                 2                               2
GRAPES 1_57      04/11/2017                                 0                               1
ORANGE 1_55      04/03/2018                                 1                                2
Unique_Sequence-on-Date-value.xlsx
0
Hi, I've been trying to get some code to save form data (including subform) to an excel spread sheet to use as a backup. I received a helpful bit of code below which works well with a query but I'm now stuck trying to get it to append an Excel spreadsheet. The code overwrites the spread sheet each time and I need a backup of all records. The ideal solution would be to fire the code when a button is clicked and append each time a new record is added.

It was suggested to use the 'TransferSpreadsheet' method then use the recordset 'CopyFromRecordset' method to paste the data into the data into Excel. After searching, I have not found a way to include the above methods in the below code to give the required results. Can anyone else help?

    Dim strFilename
    Me.Dirty = False    'this will save the current record
    strFilename = "Booking Sheet.xlsx"
    DoCmd.OutputTo acOutputQuery, "qry_FormName_ExportToExcel", acFormatXLSX, strFilename, True

Thanks!
0
JavaScript Best Practices
LVL 12
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

I do not have a problem. I need to know where to look to learn the different types of files in script.
0
Hello.
I have an HTA file that displays an image at user logon. Currently the image has 430x430 pixels. I configured within the HTA for the image to appear within a square of 500x500 pixels. In my network there are fullhd monitors, others with 1366x768 (notebooks), another 1400x900 pixels.
The question is: how to get the window always centered on the screen, regardless of the resolution of the monitor?

The portion of code with exibition configurations:

<SCRIPT LANGUAGE="VBScript">

  Sub Window_OnLoad
   Window.resizeTo 500,500
   sHorizontal = 500
   sVertical = 500
   Set objWMIService = GetObject _
     ("winmgmts:\\.\root\cimv2")
   Set colItems = objWMIService.ExecQuery _
     ("Select * From Win32_DesktopMonitor",,48)
   '# Size Window
   For Each objItem In colItems
     sWidth = objItem.ScreenWidth
     sHeight = objItem.ScreenHeight
     If sWidth > intHorizontal _
       then intHorizontal = sWidth
     If sHeight > intVertical _
       then intVertical = sHeight
   Next
   '# Center window
   intLeft = (intHorizontal - sHorizontal) /2
   intTop = (intVertical - sVertical) /2
   Window.moveTo intLeft, intTop
   '# Default window content
   window.location.href="#Top"
   v = sVertical - sHorizontal
   For h = 0 to sHorizontal-1
     v = v + 1
     Window.resizeTo h,v
   Next
   iTimerID = window.setInterval("ShowSplash", 10000)
  End Sub

  Sub ShowSplash
   Splash.Style.Display = "None"
   Self.Close()
  End Sub

</SCRIPT>

Open in new window

0
I have an hta that populates a list on the page from an sql query:

Sub Window_OnLoad
  Set oDD = document.GetElementById("ddSQL")
  Set oDb = CreateObject("ADODB.Connection")
  oDb.Open "Provider=SQLOLEDB;Data Source = pordevdb;Trusted_Connection=Yes;Initial Catalog = portiadb;User ID = bglenn; Password = briandev;"
  sQL     = "Select Distinct portfolio from pmf where pmf_table_02 = 16 order by portfolio"
  Set oRS = oDb.Execute(sQL)
 
  Do Until oRS.EOF
      Set oOpt = oDD.document.createElement("option")
      oOpt.Text  = oRS.Fields("portfolio").Value
      oOpt.Value = oOpt.Text
      oDD.Options.Add oOpt
      oRS.MoveNext
  Loop
end sub


my issue is retrieving the value from the list that is selected by the user when they click a button on the form called "TestSub"
0
I'm trying to embed an Outlook Popup warning that warns the Sender when they hit the send button, if 2 or more recipients (To, CC or BC) of the email contain 2 different domains. For example: To contains (johnsmith@yahoo.com); CC contains (billthompson@gmail.com). Another example: To contains (Johnsmith@yahoo.com;billthompson@gmail.com)

See code that I have so far, it just is not working:
---------------------------------------------------------------
The message code to use for the popup is:
        prompt = "This email contains receipients to multiple domains:" & vbNewLine & strMsg & "Are you sure you want to send?"
        If MsgBox(prompt, vbYesNo + vbExclamation + vbMsgBoxSetForeground, "Warning! About to send to messages to multiple domains") = vbNo Then
            Cancel = True
        End If
0
I need to be able to read rfid tags using a HID Omnikey 5022 reader using vb.net
0
Hello Experts,

I’m trying to filter a drop down list based on another dropdown list using SQL/vbscript/hta. I have it working sort of thanks to Experts Exchange where I can populate the dropdowns from the database.

Now, I need to do two things:

1. Filter the dropdown lists
2. Send the values to a text file

The query in the code below shows the data like this:

ARA_PERSON_ID               ARA_TYPE_DESC                     INVOICE_TERM_DESC
0000000                                Student - Credit                       2004 Fall Reporting Term
0000000                                Student - Credit                       2004 Spring Reporting Term
0000000                                Student - Credit                       2005 Intersession Reporting
0000000                                Student - Credit                       2009 Fall Reporting
0000000                                Student - Credit                       2012 Fall Reporting
0000000                                Student - Credit                       2013 Fall Reporting
0000000                                Student - Credit                       2013 Spring Reporting
0000000                                Student - Credit                       2016 Spring Reporting
0000000                                Student - Credit Free               2003 Fall Reporting Term
0000000                                Student - Credit Free               2004 Spring Reporting Term
0000000                                Student - Credit Free               2006 Fall Reporting Term


 But I need it to show like this:
0
Can anyone help me solve below problem:

I have over 2000 png images saved in different files on my computer. I want to write a VBScript function that does something like go to a particular folder and iteratively copy-paste all the png files in that folder to a PDF file or word document .

1. The header before pasting the png files in the word document should be same as the folder name.
2.  The .png files should be inserted in order of when they got created. That is the first created .png file will be first inserted and the last will be last inserted in the word or PDF file.
3. Upon successful copy of all the .png files in this folder,  the folder should be deleted.

Any assistance if this is possible will be appreciated
0
Hi Guys,

Our requirement is like need info(details inside) of text file from following location in all machines(almost 500)
C:\temp\layers\status.text
 
Text file is like this :
 
VERIFY LAYERS
LatLonGO: 2018-07-25T13:32:48 INFO: version of layer VIC_LANDBASE is 1
LatLonGO: 2018-07-25T13:32:48 INFO: version of layer ELECTRICITY_LAYER is 356793
LatLonGO: 2018-07-25T13:32:48 INFO: version of layer BACKGROUND_LAYER_ELEC is 2
We need a report based on the content of the file, something like this:
 
 
 
Can you help on this.
1
Looking for a script to bulk disable UAC and reboot remote servers so we can run remote installs. Looking at powershell as one scripting method since available on servers. Can look at also ding WMI.  Just any solution would be great better than doing it manual for each one. The good news we are admins on all the servers.
0
Introduction to R
LVL 12
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

I've tried to Google this, but I guess I'm just not using the right terminology as I can't come up with an answer.

I'm looking for a way (command line, powershell, vbs script, group policy) that will make one of the icons in the notification area always show. (I'm talking about the area to the left of the time/date, where the power, network and volume typically always show).

I'm running Windows 10 Enterprise in an AD environment.

Just to make sure I'm explaining what I'm trying to do in an automated fashion correctly, here is what I do to do it manually:

RIght click on taskbar
Click Tasbar settings
Under "Notification area" click "Select which icons appear on the taskbar
In the resulting list, find the thing I want to show up all the time, and move the slider to "On"
Close out of settings

Thanks!
0
Hi,

I would need to create an excel vba to list down both encrypted & unencrypted files & folders
and the results will be output into excel file where the unencrytped files & folders will be highlighted in the cells/rows in the results file.

Please advise how can I do this?

Thank you so much.
0
Hi, Experts, I'm trying to get an item within the array where I use the first word of the item as its reference. I found a code from asp tutorial that may lead to solve the problem but I'm still not able to solve it. Hoping you (Experts) help me solving this problem. This is my array; fruits = Array("100 Banana","200 Apple","300 Orange") I want to get the orange using 300 as its refrence. I have the code below but I don't know how to make it right. Thank you!

<%
DIM findThis
findThis = "300"
fruits = Array("100 Banana","200 Apple","300 Orange")

If in_array(findThis, fruits, false) Then 
  Response.Write Orange & " is in the array"
Else 
  'Response.Write findThis & " is not in the array"
End If

%>

<%
Function in_array(element, arr, performTrim)
  Dim i
  in_array = False
  For i=0 To Ubound(arr)
    If performTrim Then '//there are some scenarios where you want to trim
      If Trim(arr(i)) = Trim(element) Then
        in_array = True
        Exit Function      
      End If
    Else '//and other scenarios where you don't
      If arr(i) = element Then
        in_array = True
        Exit Function      
     End If
    End If     
  Next
End Function
%>

Open in new window

0
Need a Visual Studio VB script to modify SAPI (5.4) to recognize words such as 'gimmie' in place of 'give me', or 'myname' in place of 'my name'.
I know SAPI provides for this capability; however I am a tcl\tk programmer.

Please advise.
0
Hello, the company has a custom MS Word Macro. I copied the macro from one computer. I saved it to another computer specifically to %Appdata%/Microsoft/word/startup. When I try to run the macro, I got message "run-time error '91':  object variable or with block variable not set. I appreciate your reply :)

I notice I can't open the VBS editor as well from MS Word.

If ever this successfully run, how can I add this custom macro into button at MS Word.
0
Hi Experts,

I want reformat a large word document (1000 pages) so that, wherever in the document the blue text ( as shown in the attachment) is discovered it converts it to a table


The text color should remain as the original, in the document before reformatting.
The font should be as the table
The items next to the blue text differs and should be the second column of the table. The table will be 2 columns and 7 rows.

I have tried to do this, using a macro, which logically i can see is possible but  I am failing...  I would really appreciate your help - Thank you in advance
exmaple.docx
0

VB Script

37K

Solutions

20K

Contributors

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.