Same VBScripts working on Windows Server 2012R2 but not 2016

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
felix1212
Posts: 9
Joined: Wed Sep 13, 2017 10:30 am

Same VBScripts working on Windows Server 2012R2 but not 2016

Post by felix1212 » Thu Jul 11, 2019 7:27 am

I wrote a VB script to launch Chrome to run a .iim file. It works fine on Windows Server 2012R2 but not in 2016. Both servers have same version of Chrome and iMacros extension.
When this runs on Windows Server 2016, the Chrome browser pops up but no iMacros are running. On 2012, iMacros will run, and will close the browser after it finishes. Does anyone have clue what can possibly go wrong on 2016?

Below are scripts:

iMacros: 12.0.501.1208
Chrome: 73.0.3683.86
OS: Windows Server 2016 DC

Code: Select all

' For new application, please modify the following:
iimPath = "D:\iMacros\ConsultRandQ\ConsultRandQ_Chrome.iim"
vbsPath = "D:\iMacros\ConsultRandQ\ConsultRandQ_Chrome.vbs"
eventLogSource = "iMacros_ConsultRandQ"	'No space and symbols
appName = "Consult R&Q"	'Allow space and symbols
appNamePath = "ConsultRandQ"


' Script starts
Set WshShell = WScript.CreateObject("WScript.Shell")

Function FileExists(FilePath)
  Set fso = CreateObject("Scripting.FileSystemObject")
  If fso.FileExists(FilePath) Then
    FileExists=CBool(1)
  Else
    FileExists=CBool(0)
  End If
End Function

' check file exists
If FileExists(iimPath) AND FileExists(vbsPath) THEN

	'initialize Scripting Interface
	Set iim1 = CreateObject ("IMacros")
	i = iim1.iimOpen("-cr", true, 300) 

	'play macro
	i = iim1.iimPlay(iimPath)

	'check success
	If i < 0 Then 'success = 1
		strCommand = "eventcreate /T Error /ID 1000 /L Application /SO " & eventLogSource & " /D """ & appName & " iMacros Script failed: " & iim1.iimGetLastError() & """"
		WshShell.Run strcommand
	End If
	
	' exit iMacros
	i = iim1.iimClose()

ELSE

	'WshShell.LogEvent 1, "Consult R&Q iMacros Script failed: Requested files not found"
	strCommand = "eventcreate /T Error /ID 1000 /L Application /SO " & eventLogSource & " /D """ & appName & " iMacros Script failed: Requested files not found"" "
	WshShell.Run strcommand
	Wscript.Quit

End If
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Same VBScripts working on Windows Server 2012R2 but not 2016

Post by chivracq » Thu Jul 11, 2019 2:29 pm

felix1212 wrote:
Thu Jul 11, 2019 7:27 am
I wrote a VB script to launch Chrome to run a .iim file. It works fine on Windows Server 2012R2 but not in 2016. Both servers have same version of Chrome and iMacros extension.
When this runs on Windows Server 2016, the Chrome browser pops up but no iMacros are running. On 2012, iMacros will run, and will close the browser after it finishes. Does anyone have clue what can possibly go wrong on 2016?

Below are scripts:

Code: Select all

iMacros: 12.0.501.1208
Chrome: 73.0.3683.86
OS: Windows Server 2016 DC

Code: Select all

' For new application, please modify the following:
iimPath = "D:\iMacros\ConsultRandQ\ConsultRandQ_Chrome.iim"
vbsPath = "D:\iMacros\ConsultRandQ\ConsultRandQ_Chrome.vbs"
eventLogSource = "iMacros_ConsultRandQ"	'No space and symbols
appName = "Consult R&Q"	'Allow space and symbols
appNamePath = "ConsultRandQ"


' Script starts
Set WshShell = WScript.CreateObject("WScript.Shell")

Function FileExists(FilePath)
  Set fso = CreateObject("Scripting.FileSystemObject")
  If fso.FileExists(FilePath) Then
    FileExists=CBool(1)
  Else
    FileExists=CBool(0)
  End If
End Function

' check file exists
If FileExists(iimPath) AND FileExists(vbsPath) THEN

	'initialize Scripting Interface
	Set iim1 = CreateObject ("IMacros")
	i = iim1.iimOpen("-cr", true, 300) 

	'play macro
	i = iim1.iimPlay(iimPath)

	'check success
	If i < 0 Then 'success = 1
		strCommand = "eventcreate /T Error /ID 1000 /L Application /SO " & eventLogSource & " /D """ & appName & " iMacros Script failed: " & iim1.iimGetLastError() & """"
		WshShell.Run strcommand
	End If
	
	' exit iMacros
	i = iim1.iimClose()

ELSE

	'WshShell.LogEvent 1, "Consult R&Q iMacros Script failed: Requested files not found"
	strCommand = "eventcreate /T Error /ID 1000 /L Application /SO " & eventLogSource & " /D """ & appName & " iMacros Script failed: Requested files not found"" "
	WshShell.Run strcommand
	Wscript.Quit

End If
My 2cts:
- iMacros for CR Version not mentioned in your FCI => v10.0.5 for CR.
- Maybe the FIO-Module for Local File-Access is missing on the WS2016 Server...?
- Can you run the '.iim' Script "manually"...?
- Check the Permissions on the 'D:\iMacros\ConsultRandQ\' Folder...
- Try escaping (=doubling) the Backslashes in the Path(s) and/or replacing them with Forward Slashes...
- You have a Setting in CR about "Allow Access to (Local) URL's" or stg like that needs to be once manually checked/activated...

+ Wait for TechSup to respond... :wink:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Tom, Tech Support
Posts: 3526
Joined: Mon May 31, 2010 4:59 pm

Re: Same VBScripts working on Windows Server 2012R2 but not 2016

Post by Tom, Tech Support » Sat Jul 13, 2019 11:08 am

chivracq wrote:
Thu Jul 11, 2019 2:29 pm
+ Wait for TechSup to respond... :wink:
Hi felix,

Normally I would suggest that you open a support case since your company is a licensed customer with an active service agreement, meaning your issue will get higher priority than a post here in the forums.

However, requesting general help or help for machine-specific issues such as the following is typically not covered by technical support and requires a professional services engagement by submitting a request using the link below:
  • I need help making this macro work, can we schedule a session to work on it together?
  • The website changed and now my macro(s) no longer work(s), can you help fix it?
  • The macro/script doesn't work on this machine, but it works on another machine (or, it previously worked on this machine but stopped working recently), can you help troubleshoot?
http://imacros.net/support/professional-services

Of course, you are still welcome to post here in order to solicit help from the community, but do not expect TS to engage on such issues here.
Regards,

Tom, iMacros Support
Post Reply