• San Luis Obispo,
  • California,
  • United States

Top Contributors

Script Repository?

Granted they likely would not be tested by EE, is there a location on EE wherein contributors can provide scripts for the general population?

I frequently write automation solutions and, at times, it is painful to get from business requirement to meeting those business requirements in an elegant, consumable format.

I am aware there are other script repositories on the Internet, but few have the draw and traction of EE.

Did I miss it somewhere on the site?  If so, can someone provide me with the navigation steps to get there?

Expert Comment

Rob Jurd2016-08-18 02:21 PMID: 1930659
Your personal knowledgebase is going to be the closest: https://www.experts-exchange.com/myKnowledgebase.jsp

You can find this by clicking your avatar (top right), workspace, "my personal knowledgebase"
Rank: Sage

Expert Comment

Dustin Saunders2016-08-18 02:41 PMID: 1930674
Agreed.  Unless you wanted to start a repository for your own script creations (then I'd suggest going to github).

The main reason is, since this is a Q&A site- the answers are probably pretty specific.  I agree a git repository would be a great addition for EE though, as Experts could write and add code for points to use with articles, etc.

Could also lead to some great modules/etc. as experts could collaborate on projects.
Rank: Sage

Author Comment

Darrell Porter2016-08-18 04:56 PMID: 1930699
At present, I am writing hundreds, if not thousands, of lines of code a day (when we're into the thousands, I am usually re-using modules I have previously used - Cut-and-Paste programming is alive and well here) and I, for one, would appreciate having such a repository wherein not only can I publish code to the EE contributors, but as they use said code, they can up- or down-vote it as it meets their needs (or doesn't) as well as them having the ability to leave comments about the code.

Expert Comment

Mr. Wolfe2016-08-18 05:45 PMID: 1930705
Another good idea and you may want to present your idea in the feedback area. https://www.experts-exchange.com/Expert_Testing/1063/Share-your-feedback-or-report-a-bug-on-Experts-Exchange.html

Explain what you want to do, how you already use My Personal Knowledgebase and what additions would make it more useful to you and a link to this discussion.

Not every suggestion gets acted on of course, but they do take on board everything that gets presented.
Rank: Sage

Expert Comment

Dustin Saunders2016-08-18 09:34 PMID: 1930747

Sounds like you should be making your own cmdlets rather than pasting in code on each function!!  What happens when you update a function, but you have 100 scripts that use it?

It's going to be worth your time to do so if you're seriously producing that much code (writing thousands of lines per day means you're probably doing a large amount of that script re-use).  Check out https://msdn.microsoft.com/en-us/library/dd878294(v=vs.85).aspx for info, and use EE as a resource to help you get started if there are coding questions.
Rank: Sage

Author Comment

Darrell Porter2016-08-19 10:56 AMID: 1930879
@Dustin Saunders

For Powershell, I frequently do write cmdlets.
For VBScript, I use this type of construct to load functions from their separate files:

Option Explicit
Dim objFSO
Dim strTargetScript 
Dim varScriptText
Dim strFileName
Set objFSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
strFileName = "C:\ScriptRepository\func_SomeFunction.vbsi"
strFileName = Chr(34) & strFileName & Str(34)
Set strTargetScript = objFSO.OpenTextFile(strFileName)
If Err.Number <> 0 Then
     MsgBox "An error, " & Err.Number & " occurred while opening file " & strFileName & ".  The detailed message is " & Err.Description & "."
End If
varScriptText = strTargetScript.ReadAll
Execute varScriptText

Open in new window

The only issue is if I change a function to require different, more, or fewer parameters.  But that is true of cmdlets as well.
I use the ".VBSI" extension to indicate the file is a Visual Basic Script Inclusion file and not a stand-alone script.