03-01-2019 08:25 AM
Hi
At the beginning of my script, i select a channel in the data portal (structure view). At the end of the script, the channel should be selected again an it should be visible in the data portal.
When i run my script in debug mode, it works. But if I run it in "normal mode", I always end up at the top of the data portal with no channel selected.
Has anyone an idea how i can change this behavior?
Regards Werner
Solved! Go to Solution.
03-04-2019 10:20 AM - edited 03-04-2019 10:22 AM
Hi Siipo,
Have you tried using the "record" scripting tool and compare with what you have done?
Have a nice day,
M-Junior
03-07-2019 12:44 AM
Hi Siipo,
This code works on my DIAdem 2017:
dim oChn, oGroup set oGroup = Data.Root.ChannelGroups(1) set oChn = oGroup.Channels(2) call Portal.Structure.Selection.RemoveAll if not Portal.Structure.IsExpanded(oGroup) then Portal.Structure.Expand(oGroup) end if call Portal.Structure.Selection.Add(oChn)
Greetings
Walter
03-07-2019 01:24 AM
Hi,
thanks for your code. I tried it and if i put just your code in a nem sheet, it works, but if i copy your code in to my script, i end with the target group open, but on the top of teh data portal and no channel selected. if i run it in debug mode, it works fine.
Code:
Option Explicit
autoabort = true
dim oChn, oGroup
T2 = "[1]" ' Kanalname
T1 = "free offset" ' Ogffset typ
R1 = 3 ' offset-Wert
T2 = Portal.Structure.Selection(1).GetReference(eRefTypeIndexName) ' [Gruppenindex]/Kanalname
If SudDlgShow("Dlg1",AutoActPath &"Offset_Dialog.SUD") = "IDOk" Then
Else
Call MsgBoxDisp("DIAdem hat das Script abgebrochen.","MB_NOBUTTON","MsgTypeNote",,2)
err.Raise -1
err.Clear
End If
R4 = InStr(T2, "/")
R5 = Len(T2)
T3 = Mid(T2, (R4+1), R5)
R4 = InStr(T2, "[")
R5 = InStr(T2, "]")
'call MSGBOXdisp(""&R4&"//"&R5&"")
T4 = Mid(T2, (R4+1), (R5-R4-1))
R3 = Val(T4)
R2 = Data.Root.ChannelGroups(R3).Channels(T3).Properties("groupindex").Value
Call ChnOffset(""&T2&"",""&T2&"",R1,""&T1&"")
Call Portal.Structure.Selection.RemoveAll
set oGroup = Data.Root.ChannelGroups(R3)
set oChn = oGroup.Channels(R2)
if not Portal.Structure.IsExpanded(oGroup) then
Portal.Structure.Expand(oGroup)
end if
call Portal.Structure.Selection.Add(oChn)
03-07-2019 02:14 AM
Hi siipo,
You're right. I've forgotten the (special) Portal refresh before my code.
call UIAutoRefreshSet(true) call UIAutoRefreshSet(false) set oGroup = Data.Root.ChannelGroups() set oChn = oGroup.Channels() if not Portal.Structure.IsExpanded(oGroup) then Portal.Structure.Expand(oGroup) end if call Portal.Structure.Selection.Add(oChn)
By the way, you use the standard variables R1, R2, R3 ... as index. The R stands for real, but an index expects integer values. It would be better to use L1, L2, L3 ... for an index.
Greetings
Walter
03-07-2019 02:29 AM
Now it works
thanks