Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

We Value Your Feedback!
Could you please spare a few minutes to share your thoughts on Cloud Connected vs On-Premise Services. Your feedback can help us shape the future of services.
Learn more about the survey or Click here to Launch the survey
Schneider Electric Services Innovation Team!

How to call a Vbscript program either by ST

EcoStruxure Geo SCADA Expert Forum

Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • Remote Operations
  • EcoStruxure Geo SCADA Expert Forum
  • How to call a Vbscript program either by ST
Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
sbeadle
Kirk sbeadle Kirk
308
AndrewScott
Admiral AndrewScott
96
BevanWeiss
Spock BevanWeiss
91
AdamWoodlandToo
Lt. Commander AdamWoodlandToo
37
View All
Related Products
product field
Schneider Electric
EcoStruxure™ Geo SCADA Expert

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to EcoStruxure Geo SCADA Expert Forum
Solved
hemanthv
Ensign hemanthv
Ensign

Posted: ‎2020-05-15 05:22 AM . Last Modified: ‎2023-05-03 12:14 AM

0 Likes
5
4890
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-05-15 05:22 AM . Last Modified: ‎2023-05-03 12:14 AM

How to call a Vbscript program either by ST

Hi,

i have the following scripting program. I would like to call it depending on specific condition like day end or hour end. so that excel macro is executed which query clearscada for data and print it to a folder.

 

Only problem i have is how to execute using a scheduler or a ST program. is there is mechanism to execute it?


Public Sub ExceltoPDF()

Dim objExcel

Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "'C:\Hawk Backups\batch.xlsm'!Module1.Macro1"
objExcel.DisplayAlerts=False
objExcel.Application.Quit
Set objExcel = Nothing

End Sub

 

 

thanks

regards,

 

Labels
  • Labels:
  • Scripting
Reply

Link copied. Please paste this link to share this article on your social media post.

  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
AndrewScott
Admiral AndrewScott
Admiral

Posted: ‎2020-05-15 07:27 AM . Last Modified: ‎2020-05-15 07:28 AM

0 Likes
4
4880
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-05-15 07:27 AM . Last Modified: ‎2020-05-15 07:28 AM

You should be able to do this using a system command, see Core Reference > Core Configuration > Configuring System Commands section of the help. You'll need to save the VBScript into a ".vbs" file that can be run by the system command using the Windows Scripting Host (e.g. cscript.exe <filename>).

 

You can use a System Command database object along with a Schedule database object. Alternatively, you can use a logic program with a SYSTEM function.

 

The system command will run on the current main server and therefore both the spreadsheet and script will need to be copied onto all servers (if you have a redundant system). Each server must be setup to allow system commands to be run, see System Administration > Server Administration > System Calls Settings section on the help (e.g. specify the Windows user account to be used).

 

You can also do this without using ClearSCADA at all, by using the Windows Task Scheduler to run the script on a schedule.


Andrew Scott, R&D Principal Technologist, AVEVA

See Answer In Context

Reply

Link copied. Please paste this link to share this article on your social media post.

Replies 5
AndrewScott
Admiral AndrewScott
Admiral

Posted: ‎2020-05-15 07:27 AM . Last Modified: ‎2020-05-15 07:28 AM

0 Likes
4
4881
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-05-15 07:27 AM . Last Modified: ‎2020-05-15 07:28 AM

You should be able to do this using a system command, see Core Reference > Core Configuration > Configuring System Commands section of the help. You'll need to save the VBScript into a ".vbs" file that can be run by the system command using the Windows Scripting Host (e.g. cscript.exe <filename>).

 

You can use a System Command database object along with a Schedule database object. Alternatively, you can use a logic program with a SYSTEM function.

 

The system command will run on the current main server and therefore both the spreadsheet and script will need to be copied onto all servers (if you have a redundant system). Each server must be setup to allow system commands to be run, see System Administration > Server Administration > System Calls Settings section on the help (e.g. specify the Windows user account to be used).

 

You can also do this without using ClearSCADA at all, by using the Windows Task Scheduler to run the script on a schedule.


Andrew Scott, R&D Principal Technologist, AVEVA
Reply

Link copied. Please paste this link to share this article on your social media post.

hemanthv
Ensign hemanthv
Ensign

Posted: ‎2020-05-17 09:58 PM

In response to AndrewScott
0 Likes
0
4858
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-05-17 09:58 PM

Hi Andrew,

 

I have tried the following

 

PROGRAM SynchReportDirectories

VAR
Synch, Synch2: DINT;
END_VAR;

Synch:= SYSTEM('"C:\Windows\System32\cmd.exe" "C:\Hawk Backups\EXCEL_EXPORT\excelcommand.bat"');

 


END_PROGRAM

 

But in system status windows - it is timing out. also tried cscript.exe and passing the file - it showed success but did not execute the file.

 

i have attached snapshot of system status,

 

 

Attachments
Reply

Link copied. Please paste this link to share this article on your social media post.

hemanthv
Ensign hemanthv
Ensign

Posted: ‎2020-05-17 10:26 PM

In response to AndrewScott
0 Likes
2
4857
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-05-17 10:26 PM

Hi Andrew,

 

 

ExcelCommand.bat is

 

@echo Off
cscript.exe "C:\Hawk Backups\bch.vbs" > c:\Hawk Backups\log.txt
@echo on

 

bch.vbs file contains

 

 

Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "'C:\Hawk Backups\batch.xlsm'!Module1.Macro1"
objExcel.DisplayAlerts=False
objExcel.Application.Quit
Set objExcel = Nothing

 

 

 

Reply

Link copied. Please paste this link to share this article on your social media post.

sbeadle
Kirk sbeadle Kirk
Kirk

Posted: ‎2020-05-18 01:26 AM

In response to hemanthv
0 Likes
0
4853
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-05-18 01:26 AM

Hi Hemanth,

I would check whether there are any security issues, particularly around the execution of vbs scripts.

Perhaps replace your script as a test with a simple 'echo "test" > somefilesomewhere.txt and check that Geo SCADA runs it. 

Steve

Reply

Link copied. Please paste this link to share this article on your social media post.

AndrewScott
Admiral AndrewScott
Admiral

Posted: ‎2020-05-18 03:50 AM

In response to hemanthv
0 Likes
0
4851
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-05-18 03:50 AM

It looks like Microsoft Excel is not designed to be compatible with server-side automation. Bear in mind that the ClearSCADA server is running as a Windows service and therefore Excel will also be running under the Windows service but using user impersonation for the specified Windows user.

https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office 

 

However, a Google search shows some people have been able to get Excel working from a Windows service. The following instructions allowed me to launch Excel without it hanging on my PC:

https://bharathkumaran.wordpress.com/2011/10/25/running-excel-from-a-windows-service/ 


Andrew Scott, R&D Principal Technologist, AVEVA
Reply

Link copied. Please paste this link to share this article on your social media post.

Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of