open articy URL in the same window
Posted: Thu 2. Nov 2017, 07:49
by andrey_st
Hi
I have a link
articy://localhost/view/0f0605fd-d5a2-4 ... 1347342250. When i run it in Explorer it opens new Articy window? but i need the same
Re: open articy URL in the same window
Posted: Thu 2. Nov 2017, 09:08
by andrey_st
Now i want to do something like this
Articy.Editor.Controls.HierarchicalObjectSelector
UpdateSelection
ChangeFocussedItem
Re: open articy URL in the same window
Posted: Thu 2. Nov 2017, 11:04
by andrey_st
Best support! ever!
public static void ExecuteUrl(string aUrl)
{
List<Process> list = NetUtils.FindProcesses("ArticyDraft");
if (list != null && list.Count > 0)
{
foreach (Process current in list)
{
byte[] bytes = Encoding.UTF8.GetBytes(aUrl);
try
{
Dispatcher.sLogger.Info("Sending to window: {0}", new object[]
{
current.MainWindowHandle
});
IntPtr intPtr = User32.SendDataMessage(current.MainWindowHandle, 1, bytes);
Dispatcher.sLogger.Info("result: {0}", new object[]
{
intPtr.ToInt32()
});
int num = intPtr.ToInt32();
if (num == 1)
{
break;
}
}
catch (Exception ex)
{
Dispatcher.sLogger.Warning("Exception:\r\n{0}", new object[]
{
ex.ToString()
});
}
}
}
}
Re: open articy URL in the same window
Posted: Tue 14. Nov 2017, 11:17
by [Articy] Peter Sabath
The easiest way to do that is to use additional parameters to the object Url you open as shown below. The defaults are chosen to be backward compatible to the old behavior from articy:draft 1 & 2.
For your use case it would be far better to use:
- Code: Select all
articy://<objectUrl>?windows=current&pane=current&tab=current
The parameters and supported values are:
window
protocol (default)
main
new
current
pane
tab
forcesheet (force the view to show the property sheet)
Re: open articy URL in the same window
Posted: Tue 14. Nov 2017, 11:51
by andrey_st
Ok.
May be you know how to run articy from c#, something like this Process.Start(aUrl) does not work ?
Re: open articy URL in the same window
Posted: Tue 14. Nov 2017, 12:54
by [Articy] Peter Sabath
Using the "Process.Start(Url)" call should work if the protocol handler is properly registered in the registry.
But you also may use a direct dispatch from within articy:draft using this call
- Code: Select all
public static bool ExecUrl( string aUrl)
{
var data = Encoding.UTF8.GetBytes( aUrl );
var result = Articy.Utils.Win32.User32.SendDataMessage( Process.GetCurrentProcess().MainWindowHandle, 1, data );
return result == 1;
}