Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript problem upgrading from WIn7 to Win10 (Enterprise)

Status
Not open for further replies.

GooberBoy3017

Programmer
Apr 15, 2019
2
0
0
US
Hi all, first post for an old scientist with minor knowledge of computer programming; I may not use the correct terminology but have tried to explain procedures and my problem as best I can.

Our research institute is in the process of upgrading from Win7 to Win10 Enterprise. We use a digital data logging software (Labchart V7 by Adintruments) for which we have developed custom MACROS, based upon VBscript. The manufacturer cannot provide further support as we are using the MACROS well beyond what was intended for the program. Essentially, the VBscript MACROS call a document (HTML page from IE) to enable the user to either: (1) enter data which then writes back to a spreadsheet within the Labchart program (I call this a "one layer" MACRO, or (2) prompts the user for a selection, which then calls another VBscript MACRO for the user to enter data and write back to Labchart (I call this a "secondary or tiered" MACRO. This strategy was chosen to minimize the number of "buttons" on the GUI. An example would be "Blood Test" MACRO. When this is selected by user, a HTML page opens with a list of buttons to select for each of the types of blood tests.

The problem is with the "tiered" MACROS. They work in Win7 with a standard user logged in- it was necessary for our IS folks to modify IE security settings related to ActiveX and scriptlets to get things to work. On Windows 10, despite having the same IE security settings, I can only get the "tiered": MACROS to work is the Labchart program is run as administrator; "one layer" MACROS work fine for standard user. Our IS folks are hesitant to provide admin access to the various users in our team just to be able to make the program function in Win10.

Some additional information which may be useful. Upon starting the Labchart program, we run an initialize MACRO which sets up a folder in the users\public for the various HTML files which the lab chart program calls when running a MACRO. I have tried another local folder on computer and opened up access for that folder but no luck; thought it may have to do with Win10 read/write access to folder.

An example of a tiered MACRO is below. In Win10, when a button is selected, the secondary HTML page does not appear (nothing happens). I have checked that the docs are located in the directory; again, this works for Win7.Based upon my testing (and limited knowledge) I wonder if there is a Win10 or IE security setting which I cannot change to make MACROS function for standard user.

I am hoping that someone in the community could provide any guidance (ie. ideas for further tests) to define my problem. I can provide further files if needed for troubleshooting.

Thanks in advance!

GooberBoy.



Sub Test_Menu () 'Macro used to create a menu to access scripts for all blood tests

'First Line hands Error catching over to the user (Lines such as Err.Number <> 0 means there was an internal error.) If a script isn't behaving as it is
'supposed to, comment out the first line and let it run. It should tell you which line is causing an error if it can find one.
On Error Resume Next

'An internet object is created and is assigned to navigate to the local html file that serves as a template for the Test menu
Set objExplorer = CreateObject("InternetExplorer.Application")
filePath = Doc.Path + "ScriptFiles\HTML\test Menu.htm"
objExplorer.Navigate "file:///" + filePath

'If objExplorer can not find the local html file, it is likely that the script file has not been created and so an error message is shown
if Err.Number <> 0 Then
call msgbox("Could not find Script files! Please be sure that the Script Files Folder is located " & chr(10) & " in the same folder and that this file has already been saved as a Data File")
objExplorer.Quit
Exit Sub
End if

'Formats the IE page for viewing on the computer
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 500
objExplorer.Left = 700
objExplorer.Top = 250
objExplorer.Visible = 1

'The following two lines help to ensure the IE page pops up (This two lines may not be necessary, but I have included them just in case
Set objShell = CreateObject("Wscript.Shell")
objShell.AppActivate objExplorer.Name


'While the IE page is up, the script checks every 0.25 seconds to see if either the OK button or cancel button is clicked
Do While (objExplorer.Document.Body.All.OKClicked.Value = "")
Call WaitFor(0,0,.25)
'Clicking the X-button creates an error, so this code ensures that the macro is exited when the x button is clicked
if Err.Number <> 0 then
ObjExplorer.Quit
exit sub
End if
Loop

'Whichever button was clicked is grabbed from the HTML file and stored to the response variable before then objExplorer object is removed
response = objExplorer.Document.Body.All.OKClicked.Value
objExplorer.Quit
if Err.Number <> 0 then exit sub

'Depending upon the response, the proper macro is called
Select Case response
Case "ACT"
Call Doc.Macros.ACT ()
Case "CG8"
Call Doc.Macros.CG8 ()
Case "CG4"
Call Doc.Macros.CG4 ()
Case "CHEM8"
Call Doc.Macros.Chem8 ()
Case "HEMOX"
Call Doc.Macros.HEMOX ()
Case "Glucose"
Call Doc.Macros.GLU ()
Case "PCV"
Call Doc.Macros.PCV ()
Case "OSMO"
Call Doc.Macros.Osmolarity ()
Case "Ultrasound"
Call Doc.Macros.Ultrasound()
Case "Cancelled"
Exit sub
Case Else
Exit Sub
End Select

End Sub



 
>when a button is selected,

Might be useful to see the code that is called when on of the Menu buttons is selected.

Also, comment out On Error Resume Next, as this may well be masking what is really going on when you say 'nothing happens'

(On Error Resume Next should really only be used v carefully and sparingly)
 
Hi strongm and thanks for offering your expertise.

Test settings: Win10 (Enterprise), Standard User, "On Error Resume Next" removed as you recommended

Result : The macro, "Test Menu" contains errors: Line 21
Line 21 objExplorer.StatusBar = 0

The program (Labchart) is still able to call up the primary HTML file (test menu) despite error. However when a button is selected from the test menu, the secondary HTML window does not come up (I presume because the MACRO has stopped running due to error)

I have attached one of the HTML files that is called when selecting a button. In this case CG8 which is located at left top of test menu list.

Just to clarify. In Win7, MACROS work for a standard user. I can only get MACROS to work in WIN10 when program (labchart)is run as administrator)
 
 https://files.engineering.com/getfile.aspx?folder=764e72fe-d568-44ac-84ca-35e8691e2f74&file=CG8.htm
Have you checked the properties of all the HTM files involved. DO any of them look like:

sec_fe9ojj.png


If so, tick the Unblock box
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top