How do you pass arguments to a launcher for external svg app?


https://forum.reallusion.com/Topic530423.aspx
Print Topic | Close Window

By shadeline2000 - 2 Years Ago
I plan to use aflauncher.exe for affinity photo and affinity designer, but I'm not sure how I add arguments for it to launch either one?
By Peter (RL) - 2 Years Ago
Unfortunately there are no options to add arguments. You just have to add the path to your Affinity Photo or Designer .exe file in Preferences (CTRL+P). Instructions for this can be found below.

https://manual.reallusion.com/Cartoon-Animator/Content/Resources/5.0/10-Preference/Image-Section.htm
https://manual.reallusion.com/Cartoon-Animator/Content/Resources/5.0/10-Preference/Vector-Section.htm
By voom - 2 Years Ago
Affinity V2 apps have no accessible .exe, like the V1 apps did. (They are not installed as desktop apps and calling the .exe files from a different app is blocked by file access permission issues) Serif is aware of the issue, this breaks many workflows with 3rd party apps. 
That is why @shadeline2000 mentions "aflauncher.exe" which is a temporary workaround from the Affinity-Forums. 
What I found to work to get Photo and Designer V2 working with CA5 is to make an .exe out of the .bat - files Affinity is also providing. (CA5 needs an .exe file...) There are ways to create an .exe out of a .bat (Google it...)
These are the BATs: 
----------------
start /b affinitydesigner2.exe %1
exit
----------------
start /b affinityphoto2.exe %1
exit
----------------

Also, to make it work, just like in V1, the setting in Photo and Designer "save over psd" has to be ticked. 
By shadeline2000 - 2 Years Ago
Peter (RL) (1/5/2023)
Unfortunately there are no options to add arguments. You just have to add the path to your Affinity Photo or Designer .exe file in Preferences (CTRL+P). Instructions for this can be found below.

https://manual.reallusion.com/Cartoon-Animator/Content/Resources/5.0/10-Preference/Image-Section.htm
https://manual.reallusion.com/Cartoon-Animator/Content/Resources/5.0/10-Preference/Vector-Section.htm




https://forum.affinity.serif.com/index.php?/topic/167828-accessing-affinity-v2-apps-from-other-apps/

I get the error "The file cannot be accessed by the system" when I put this as my launch: C:\Users\[USERNAME]\AppData\Local\Microsoft\WindowsApps\AffinityPhoto2.exe

It was recommended I use parameters to launch each program from CTA 5... but CTA 5 doesn't have that ability???

https://forum.affinity.serif.com/index.php?/topic/178056-i-am-using-aflaunchexe-for-affinity-photo-2-does-affinity-designer-need-something-like-that-too/#comment-1025651
By wires - 2 Years Ago
MSI installers were promised for the Affinity software in December however they didn't function correctly during internal testing and their release has been pushed back until "later". Once these are available there should no longer be issues around launching them from within 3rd Party software. Serif really screwed up with their latest releases, at least for Windows users and are now trying hard to pacify the unhappy masses.
By shadeline2000 - 2 Years Ago
CTA 5 should allow params to be passed.
By animagic - 2 Years Ago
shadeline2000 (1/7/2023)
CTA 5 should allow params to be passed.

It would introduce another point of user failure with endless questions on the forum and to support...:unsure:
By shadeline2000 - 2 Years Ago
The code below is what I created so that CTA 5 would launch the aflaunch.exe by Affinity.

Delphi EXAMPLE code to allow CTA 5 to launch programs that require parameters:


program ExecuteApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  Windows,
  ShellApi,
  System.SysUtils;

var
  i: Integer;
  cl: string;
  parms: string;
  SI: TStartupInfo;         //requires Windows
  PI: TProcessInformation;  //requires Windows

begin
    {
      Create two separate exe files for each and change parms for each:

      parms := '-a Photo2';
      parms := '-a Designer2';
    }

    cl := 'aflaunch.exe';
    parms := '-a Photo2';

    cl := cl + ' ' + parms;

    for i := 1 to ParamCount do
    begin
      cl := cl + ' "' + ParamStr(i) + '"';
    end;
    Writeln(cl);
    UniqueString(cl);

  // below will launch:
    try
      try
        writeln('begin');
        FillChar(SI, sizeof(SI), 0);
        FillChar(PI, sizeof(PI), 0);
        SI.cb := sizeof(SI);

        if not CreateProcess(nil, PChar(cl), nil, nil, true, 0, nil, nil, SI, PI) then
          RaiseLastOSError;

        WaitForSingleObject(PI.hProcess, INFINITE);

        CloseHandle(PI.hProcess);
        CloseHandle(PI.hThread);

        writeln('end');
      except
        on E: Exception do
          begin
            Writeln(E.ClassName, ': ', E.Message);
            ExitCode := 1;
         end;
      end;
    finally
      Writeln('Complete');
      //Readln;   // uncomment if you want the screen to pause and require you to hit enter to exit
      ExitCode := 0;
    end;
end.

You can download Delphi Community edition and compile this code for free.   Just make sure you create a File > New > Console Applicaton

By shadeline2000 - 2 Years Ago
animagic (1/7/2023)
shadeline2000 (1/7/2023)
CTA 5 should allow params to be passed.

It would introduce another point of user failure with endless questions on the forum and to support...:unsure:


OR, they should have allowed *.bat files to be able to be launched instead of just exe files!