This bit of code fails when the user enters a space to be included as part of a new file name. Or said another way, it's as if a space is an illegal character...yet renaming using the built in methods accepts space characters as expected.
The code asks for the users input ("Enter Property ID"), and renames the file using the that input ,and the exisiting file name....then selects the next file.
@set id = {dlgstring|Enter Property ID} @set id="word1word2"
Rename PATTERN * TO {$id}_*
Select NEXT
The following script can be placed in a button: [code]Rename PATTERN * TO * @script vbscript
Option Explicit
Dim strTmpInput
Function Rename_GetNewName2(strFileName, strFilePath, fIsFolder, strOldName, strNewName)
strTmpInput = InputBox ( "Enter ID", "Property ID Rename")
If strTmpInput = "" Then
Exit Function
End If
Rename_GetNewName2 = strTmpInput & " _ " & strFileName
End Function
[/code]
Is there any resource/reference material you aware of that explains how DOpus functions with VBA...for example, can I start an instance of Access?...and then pass variables/arguments between Dopus and Access so the user could choose from a list of allowable IDs...say using a ususal Combo or List control linked to an Access table?
If so, then once I konow DoOpus and Access can talk to each other, I'm fine with the coding.
I'm not aware of any specific resources explaining Opus and Access. Having said that, I'm sure you can use the Opus renaming system to manipulate data in an Access database. No idea how though.
You should be able to talk to Access from VBScript using code like this:
Dim objAccess
Set objAccess = CreateObject("Access.Application")
(I haven't tested that as I don't have Access installed.)
You can then call methods on objAccess like you can within Access itself.
(Note that VBScript has a slightly different syntax to the VBA used within Office.)
You may find it easier to start with a standalone .vbs script file which you can edit and run outside of Opus. That way it'll be much less cumbersome to experiment with talking to Access from VBScript. Once you get that working you can put it into your Opus rename script.