How to combine scripts with raw commands?

Is it possible to append a raw command like Select Next after a script? Maybe there is a way
to merge script parts with raw commands into one single command?

Almost all of the example scripts run commands. Have a look at them. :slight_smile:

Hmm, i can't find any example, where scripts are combined with a raw command. This is what i tried:

Function OnClick(ByRef ClickData)
Set dlg = ClickData.Func.Dlg
dlg.message = "Choose to edit tags and/or comment and insert your new content:"
dlg.title = "Edit Metadata"
dlg.buttons = "OK|Clear|Cancel"
dlg.options(0).label = "Edit Tags"
dlg.options(1).label = "Edit Comment"
dlg.max = 512
dlg.options(0).state = True
dlg.options(1).state = False
dlg.default = "+"
i = dlg.show

If dlg.options(0).state = True Then
If i = 1 Then
If Not (dlg.input = "" Or dlg.input = "+") Then
ClickData.Func.Command.RunCommand("SetAttr META ""tags:" & dlg.Input & """")
End If
End If
If i = 2 Then
ClickData.Func.Command.RunCommand("SetAttr META ""tags:")
End If
End If
If dlg.options(1).state = True Then
If i = 1 Then
If Not (dlg.input = "" Or dlg.input = "+") Then
ClickData.Func.Command.RunCommand("SetAttr META ""comment:" & dlg.Input & """")
End If
End If
If i = 2 Then
ClickData.Func.Command.RunCommand("SetAttr META ""comment:")
End If
End If
End Function
Select Next

So, obviously, the raw command isn't working in script mode, even if it's placed after the function. I am trying to alter Kundal's button to select the next item.

Your code looks malformed to me, do you check the "other"-logs Log-Window for errors, when running this?

To my understanding, if you do something like: ClickData.Func.Command.RunCommand("SetAttr META comment:")
You used a raw command already.. o)

gpsoft.com.au/help/opus11/in ... nction.htm

[quote="tbone"]To my understanding, if you do something like: ClickData.Func.Command.RunCommand("SetAttr META comment:")
You used a raw command already.. o)[/quote]

Yep!

[quote="tbone"]Your code looks malformed to me, do you check the "other"-logs Log-Window for errors, when running this?

To my understanding, if you do something like: ClickData.Func.Command.RunCommand("SetAttr META comment:")
You used a raw command already.. o)[/quote]

The green part works ok. I've added the red bit to show, what i'm trying to achieve.

You need to run the command using ClickData.Func.Command.RunCommand, the same as all the other commands are being run in your script.

Also, you want to run the command before the end of the function, not after it.

[code]Function OnClick(ByRef ClickData)
Set dlg = ClickData.Func.Dlg
dlg.message = "Choose to edit tags and/or comment and insert your new content:"
dlg.title = "Edit Metadata"
dlg.buttons = "OK|Clear|Cancel"
dlg.options(0).label = "Edit Tags"
dlg.options(1).label = "Edit Comment"
dlg.max = 512
dlg.options(0).state = True
dlg.options(1).state = False
dlg.default = "+"
i = dlg.show

If dlg.options(0).state = True Then
If i = 1 Then
If Not (dlg.input = "" Or dlg.input = "+") Then
ClickData.Func.Command.RunCommand("SetAttr META ""tags:" & dlg.Input & """")
End If
End If
If i = 2 Then
ClickData.Func.Command.RunCommand("SetAttr META ""tags:")
End If
End If
If dlg.options(1).state = True Then
If i = 1 Then
If Not (dlg.input = "" Or dlg.input = "+") Then
ClickData.Func.Command.RunCommand("SetAttr META ""comment:" & dlg.Input & """")
End If
End If
If i = 2 Then
ClickData.Func.Command.RunCommand("SetAttr META ""comment:")
End If
End If

ClickData.Func.Command.RunCommand("Select NEXT")

End Function[/code]

[quote="leo"][quote="tbone"]To my understanding, if you do something like: ClickData.Func.Command.RunCommand("SetAttr META comment:")
You used a raw command already.. o)[/quote]

Yep![/quote]

Ok, so raw commands are already in use in that code. But why doesn't "Select nect" work in that case?

Because you're writing in VBScript and "Select Next" is an Opus command, not VBScript code. Using RunCommand is how you run Opus commands from VBScript.

Because inside a script you'll have to use what the script language understands. :smiley:
What you could do to combine scripts with raw commands is to make the script a user-defined command named My_command and then call it from a button like this:

My_command Select NEXT

I was aware of that.

[quote]What you could do to combine scripts with raw commands is to make the script a user-defined command named My_command and then call it from a button like this:

My_command Select NEXT[/quote]

Hmm, then i have to go on select the next file manually, because user defined commands don't support shortcuts. But i need to start the command using a shortcut, because that's the way my helper application works. I have to use some macro, to move that small window out of the way, under the lister. Otherwise it is placed right in the middle of the image i want to check for tags, which is obviously disturbing. I once requested a change, to make Opus remember the positions of dialog boxes, so they wouldn't get in the way. :frowning:

Because you're writing in VBScript and "Select Next" is an Opus command, not VBScript code. Using RunCommand is how you run Opus commands from VBScript.[/quote]

I've tried that, too. I placed following under the code:

ClickData.Func.Command.RunCommand("Select next")

It didn't work. I wish, you would explain such programmer's things a bit more clearly.

leo already provided the correct script and explained that the line has to be the last but one (before End Function).

@Leo, thanks! I didn't realize, that it was already done in your example script. I tried to put some command before the code, but i have absolutely no clues about script languages,
so the code was ridiculously wrong, i guess. Also thanks to kundal, i will try to figure out, if i can intergrate your new version of the code (from the other posting) into my
"move window by macro" workaround. I possibly have to nag the developers to make an option, to include some "dlg window position" option, so i could get rid of that macro solution. :grin: