Book a Demo

Author Topic: Problem scripting Color Selector  (Read 5161 times)

HaroldRobbins

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Problem scripting Color Selector
« on: November 09, 2016, 03:13:58 am »
Folks,
I'm writing a VB DiagramScript to programmatically add lines to a diagram.  I would hate to hard-code the color of the diagramlink, so I'd thought to use a color dialog.

Since it wasn't included in the VBScript-Dialog library, I created my own routine:
Code: [Select]
function GetColor()
' Create new CommonDialog object
dim colorDialog
set colorDialog = CreateObject("MSComDlg.CommonDialog") '<== Fails here

colorDialog.ShowColor
GetColor = colorDialog.Color
end function

It's failing on the CreateObject line with "ActiveX component can't create object: 'MSComDlg.CommonDialog'".
Any idea what I'm doing wrong?

Thanks in advance,
Buddy Robbins

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Problem scripting Color Selector
« Reply #1 on: November 09, 2016, 08:07:38 am »
The reason why the VBScript-Dialog library exists at all is because some users have reported issues creating the standard dialogs with activex controls from scripting. I believe it's a permissions issue of some kind. Maybe that's what you're seeing here.

HaroldRobbins

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Problem scripting Color Selector
« Reply #2 on: November 09, 2016, 09:07:07 am »
I found the issue.  It seems that, since it's complaining about creating ActiveX, it's talking about the OCX wrappered version (comdlg32.ocx), which isn't deployed with windows 7.  I registered it on my computer & I'm rocking now.