# Can someone please provide

**URL:** <https://resource.dopus.com/t/can-someone-please-provide/18994>\
**Category:** Help & Support\
**Created:** [August 18, 2014, 8:11am UTC](https://resource.dopus.com/t/can-someone-please-provide/18994 "2014-08-18T08:11:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![goselito](https://resource.dopus.com/letter_avatar_proxy/v4/letter/g/c37758/32.png) [@goselito](https://resource.dopus.com/u/goselito)\
**Post date:** [August 18, 2014, 8:11am UTC](https://resource.dopus.com/t/can-someone-please-provide/18994/1 "2014-08-18T08:11:35Z")

</div>

Can someone please provide a simple example or template on how to create a new internal command in vbscript.

I have been trying for days now, bit I cannot seem to get my command to show up under the internal commands.

Here is the test script I have tried:

[code] Function OnInit(initData)  
initData.name = "Test"  
initData.desc = ""  
initData.copyright = ""  
initData.version = "1.0"  
initData.default\_enable = true

```
    dim cmd 
    cmd = data.AddCommand()
    cmd.name = "Test"
    cmd.method = "Test"
    cmd.desc = data.desc
    cmd.label = "Test"

End Function

Function Test()
   dim objCmd : Set objCmd = DOpus.NewCommand
   objCmd.RunCommand("Play ""F:\My Office Data\sounds\test.wav"" QUIET")
   Set objCmd = Nothing
End Function[/code]
```

---

<div class="post-metadata">

**Author:** ![Jon](https://resource.dopus.com/user_avatar/resource.dopus.com/jon/32/12713_2.png) [@Jon](https://resource.dopus.com/u/Jon)\
**Post date:** [August 18, 2014, 8:58am UTC](https://resource.dopus.com/t/can-someone-please-provide/18994/2 "2014-08-18T08:58:16Z")

</div>

If you turn on the log you'll see your script produces an error:

[quote] Error at line 9, position 2  
Object required: 'data' (0x800a01a8)[/quote]

You've got data.AddCommand() but the parameter name is initData. Same problem three lines down from that.

---

<div class="post-metadata">

**Author:** ![kundal](https://resource.dopus.com/user_avatar/resource.dopus.com/kundal/32/24277_2.png) [@kundal](https://resource.dopus.com/u/kundal)\
**Post date:** [August 18, 2014, 9:00am UTC](https://resource.dopus.com/t/can-someone-please-provide/18994/3 "2014-08-18T09:00:26Z")

</div>

Please read this help page to learn how to create a script Add-in: [Script Add-ins](http://www.gpsoft.com.au/help/opus11/index.html#!Documents/Scripting/Script_Addins.htm)  
Following the instructions you'll get something like this for your test script:

[code]option explicit

' Test  
'  
'  
' This is a script for Directory Opus.  
' See [http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts](http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts) for development information.  
'  
'  
'  
' Called by Directory Opus to initialize the script  
Function OnInit(initData)  
initData.name = "Test"  
initData.desc = ""  
initData.copyright = ""  
initData.version = "1.0"  
initData.default\_enable = false

```
Dim cmd

Set cmd = initData.AddCommand
cmd.name = "Test"
cmd.method = "OnTest"
cmd.desc = ""
cmd.label = "Test"
cmd.template = ""

```

End Function

' Implement the Test command  
Function OnTest(scriptCmdData)  
dim objCmd : Set objCmd = DOpus.NewCommand  
objCmd.RunCommand("Play "F:\My Office Data\sounds\test.wav"" QUIET"" QUIET")  
Set objCmd = Nothing  
End Function[/code]

---

<div class="post-metadata">

**Author:** ![goselito](https://resource.dopus.com/letter_avatar_proxy/v4/letter/g/c37758/32.png) [@goselito](https://resource.dopus.com/u/goselito)\
**Post date:** [August 18, 2014, 9:04am UTC](https://resource.dopus.com/t/can-someone-please-provide/18994/4 "2014-08-18T09:04:44Z")

</div>

Thanks kundal 😃

---

<div class="post-metadata">

**Author:** ![myarmor](https://resource.dopus.com/user_avatar/resource.dopus.com/myarmor/32/35118_2.png) [@myarmor](https://resource.dopus.com/u/myarmor)\
**Post date:** [August 18, 2014, 10:11am UTC](https://resource.dopus.com/t/can-someone-please-provide/18994/5 "2014-08-18T10:11:05Z")

</div>

[quote="jon"]If you turn on the log you'll see your script produces an error:  
[/quote]  
Just wondering. How do you do that on a fresh install nowadays? I remember having to look through all the  
menus and whatnot without success, then creating items for it myself.

Considering how "important" scripting has become in DO lately it might be preferable if there were  
easily accessible menuitems for cli scripting, scripting page, and the scripting log from the get go.

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [August 18, 2014, 10:12am UTC](https://resource.dopus.com/t/can-someone-please-provide/18994/6 "2014-08-18T10:12:29Z")

</div>

Help \> Logs \> Other Logs.

Or anything else which opens the Utility Panel, then switch which panel is being shown from the drop down at the top of it.

None of this stuff is particularly hidden in the UI or the manual, especially for the type of people technical enough to write scripts. None of it is that useful to people who only want to use scripts and not write them. So it seems OK as it is to me.

---

<div class="post-metadata">

**Author:** ![myarmor](https://resource.dopus.com/user_avatar/resource.dopus.com/myarmor/32/35118_2.png) [@myarmor](https://resource.dopus.com/u/myarmor)\
**Post date:** [August 18, 2014, 10:16am UTC](https://resource.dopus.com/t/can-someone-please-provide/18994/7 "2014-08-18T10:16:40Z")

</div>

[quote="leo"]Help \> Logs \> Other Logs.

Or anything else which opens the Utility Panel, then switch which panel is being shown from the drop down at the top of it.[/quote]  
Ah, there it was. It isn't exactly the most logical place to look for it.  
Considering the lack of a View menu, I would've thought it logically belonged under tools.  
My suggestion stands though.
