open articy URL in the same window

Thu 2. Nov 2017, 07:49

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
andrey_st
 
Posts: 9
Joined: Fri 27. Oct 2017, 14:36

Re: open articy URL in the same window

Thu 2. Nov 2017, 09:08

Now i want to do something like this

Articy.Editor.Controls.HierarchicalObjectSelector
UpdateSelection
ChangeFocussedItem
andrey_st
 
Posts: 9
Joined: Fri 27. Oct 2017, 14:36

Re: open articy URL in the same window

Thu 2. Nov 2017, 11:04

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()
});
}
}
}
}
andrey_st
 
Posts: 9
Joined: Fri 27. Oct 2017, 14:36

Re: open articy URL in the same window

Tue 14. Nov 2017, 11:17

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
    first (default)
    current

tab
    new (default)
    current

forcesheet (force the view to show the property sheet)
    true
    false (default)
User avatar
[Articy] Peter Sabath
Articy Staff
Articy Staff
 
Posts: 89
Joined: Wed 23. Nov 2011, 13:58
Location: Bochum

Re: open articy URL in the same window

Tue 14. Nov 2017, 11:51

Ok.
May be you know how to run articy from c#, something like this Process.Start(aUrl) does not work ?
andrey_st
 
Posts: 9
Joined: Fri 27. Oct 2017, 14:36

Re: open articy URL in the same window

Tue 14. Nov 2017, 12:54

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;
}
User avatar
[Articy] Peter Sabath
Articy Staff
Articy Staff
 
Posts: 89
Joined: Wed 23. Nov 2011, 13:58
Location: Bochum

Return to articy:draft Macro Devkit

Who is online

Users browsing this forum: No registered users and 9 guests

Who We Are
Contact Us
Social Links