issue-#104 calling URLs and commands (InfoCmds capabilities)

Merged to the master branch

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Ivan Denisov » Thu Mar 24, 2016 3:11 pm

I renamed procedures and called this new variable hideExtRunWindow because it should hide not only DosBox window.
The modification of dosCmd you can make before calling Dialog.RunExternal.
Robert, you can try new option:
http://blackboxframework.org/unstable/i ... a1.486.zip

Also I changed HostDialog.Start how it was before in 1.6.
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Josef Templ » Thu Mar 24, 2016 4:46 pm

Robert, if you want to show a dos box, you can use "cmd /k myexe" in the link.
If you don't want to show it you use "myexe".
You must know up front if you want to show it or not.

You can also run a batch file that checks the return code and
does something special in case of error.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Robert » Thu Mar 24, 2016 9:14 pm

Josef Templ wrote:Robert, if you want to show a dos box, you can use "cmd /k myexe" in the link.
Yes, that is essentially what my own version does. Adding "cmd / k " in the calling Module, rather than in the Run procedure is not a big inconvenience, so this solves half the problem.

If you don't want to show it you use "myexe".
NO!. This results in the very annoying (to me) behaviour that the Dos box opens, is filled with text, then disappears without a chance of reading it.

You must know up front if you want to show it or not.
Agreed. And when I don't want to show it I don't want to show it. Showing it in an unreadable form is not the same.


(I have just run these tests again using Dialog.Run in version 455.)

Regards
Robert
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Robert » Thu Mar 24, 2016 9:18 pm

Ivan Denisov wrote:I renamed procedures and called this new variable hideExtRunWindow because it should hide not only DosBox window.
The modification of dosCmd you can make before calling Dialog.RunExternal.
Robert, you can try new option:
http://blackboxframework.org/unstable/i ... a1.486.zip

Also I changed HostDialog.Start how it was before in 1.6.

Sorry - I didn't notice this post before replying to Josef's.

I don't have time to look at it just now, and am going away for a few days.

Robert
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Zinn » Sun Mar 27, 2016 11:53 am

I propose a synchronous implementation for normal client use.
Ivan's asynchronous implementation can be put in its own module and activated via hook by server use.
- Helmut

Code: Select all
   PROCEDURE (h: ExtCallHook) OpenExternal* (IN fileName: ARRAY OF CHAR);
      VAR res: INTEGER; win_fileName: ARRAY 512 OF CHAR; np: WinApi.PtrWSTR;
   BEGIN
      res := WinApi.ShellExecuteW(0, NIL, fileName, NIL, NIL, WinApi.SW_SHOWNORMAL);
      IF res <= 32 THEN
         (* Open failed ...  *)
         IF Dialog.IsWine() THEN
            (* ... use winebrowser ... *)
            win_fileName := "winebrowser " + fileName$;
         ELSE
            (* ... use absolute filename ... *)
            res := WinApi.GetFullPathNameW(fileName, LEN(win_fileName), win_fileName, np);
         END;
         (* ... and try again *)
         res := WinApi.ShellExecuteW(0, NIL, win_fileName, NIL, NIL, WinApi.SW_SHOWNORMAL);
      END;
      IF res <= 32 THEN
         Dialog.ShowParamMsg("#System:FailedToOpen", fileName, "", "")
      ELSE
         (* Open command successful done. Log it for security reason *)
         Dialog.ShowMsg("Dialog.OpenExternal "+fileName)
      END;
   END OpenExternal;

   PROCEDURE (h: ExtCallHook) RunExternal* (IN exeName: ARRAY OF CHAR);
      VAR res: INTEGER; info: WinApi.STARTUPINFOW; process: WinApi.PROCESS_INFORMATION;
   BEGIN
      WinApi.GetStartupInfoW(info);
      info.wShowWindow := WinApi.SW_SHOWNORMAL;
      res := WinApi.CreateProcessW(NIL, exeName, NIL, NIL, WinApi.FALSE, {}, 0, NIL, info, process);
      IF ~ODD(res) THEN
         Dialog.ShowParamMsg("#System:FailedToRun", exeName, "", "")
      ELSE
         (* Run command successful done. Log it for security reason *)
         Dialog.ShowMsg("Dialog.RunExternal "+exeName)
      END;
   END RunExternal;
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Ivan Denisov » Sun Mar 27, 2016 12:53 pm

Helmut, I do not like that in this case the realization will not fit the i21Sys version (Actions) and even with server option in preferences external calls will hang up BlackBox.
I added threads to replace Actions.
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Zinn » Sun Mar 27, 2016 7:56 pm

You always speak about hang up BlackBox. I have not found one sample which hang up by using it .
- Helmut
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Ivan Denisov » Mon Mar 28, 2016 4:52 am

Zinn wrote:You always speak about hang up BlackBox. I have not found one sample which hang up by using it .


You right that we need the example!

Please compare this version:
http://blackboxframework.org/unstable/m ... a1.480.zip
and this:
http://blackboxframework.org/unstable/i ... a1.486.zip
with the new test I just prepared:
Code: Select all
StdCoder.Decode ..,, ..Ac....3Qw7uP5PRPPNR9Rbf9b8R79FTvMf1GomCrlAy2xhX,Cb2x
 hXhC6FU1xhiZiVBhihgmRiioedhgrZcZRiXFfaqmSrtuGfa4700zdGrr8rmCLLCJuyKtYcZRiX
 7.2.s,MYH.0k,5TWyql.bnayKmKKqGomC5XzET1.PuP.MHT9N9ntumaU2,CJuyKtQC98P9PP7O
 NbXmb.2.wv6k2kfX.,6.cUGpmWLuOpoKqvCbHZiYpedhA704TeKKw.bHfEWUmL.6..D.1A06.C
 cIhgsNHT9N9ntQ8qorG4704D.CbB,708T1U.k3P.T.5g,2.,.Hh.cU.ktAcoZimBhWhiohgnZc
 ZRCY.2.w22U.EBE.0.4.0EJYjyC.6.VQ.ES4.1cUZT1E.6C6.c4E.k.6.e0.,6j3.8.YO2.sQX
 e.OS28U0CyHZiYp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ND,7JZOJ9uCPM09eH.P..YcjZeZRCJtCPM0hOE0mkeHE42sC,d
 QffPp76ZOR.gV7I6..EEEX4IaCpWin4ak2uoWSJI4qIin4aUiVukd.6J.Es.oBk2C3.70..Erk
 Rq.R0ZPRRP8rN1Hkd.6F.8ruuKK0mdK4sQG3EEiGECHM0HMamRq.PM09eHEekRqk4KIbGYIxhj
 ,27ELqk48Eeyqrm4.EWyKeK4PM136F9fR7ON3PRDf9fePNvP19Nd8OHvQ,7JTvP.F0IU0CyIhg
 stEYimxhgZhZJinpZH7N58RZ9P7ONbvM,Mwd0.UiQcjpho,YcZRiX3.5011.85...CLL.U2V.I
 y2U.UIU.U76.0E..k.8ssHpmcIf9P9fQbf9bWGhigFWE.4Te.sQRdIf9P9HWE.8z,U.kJl1kFF
 .0U1CSW5ktumdsIdPSNPN7ONbvM,Mw.ELMSN12Umz.6..FU.I90U.E,5D.oZ,Zio,dntG20U2U
 ...G00k.0.0.0mFf32U5Bn,sbTX,U,U.2.8Mt,,..e,2.A.c8.2UEC.6..mEw7169rwKiEw3c0
 Cy2xhXNP91Cor..s2E..U6U..HE.6aLuQ0mHCe.az86Utj0WlbWaUKZM067....
 --- end of encoding ---


Before run the test you need to close your browser. This delay to run Browser makes BlackBox pause normal Actions execution if not use threads.

With the first version (build #480) you will get the message in the log "unusual delay", with the second (build #486) there will be no such message.
With browser the delay is only about 150 ms. However Total Commander or other apps can give more. Anyway even this 150 ms are essential if this application in server mode.

I also made the video demonstration of this test.
Attachments

[ Play Quicktime file ] delay.mp4 [ 3.55 MiB | Viewed 9148 times ]

Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Robert » Mon Mar 28, 2016 8:26 pm

Ivan Denisov wrote:I renamed procedures and called this new variable hideExtRunWindow because it should hide not only DosBox window.
The modification of dosCmd you can make before calling Dialog.RunExternal.
Robert, you can try new option:
http://blackboxframework.org/unstable/i ... a1.486.zip

Ivan

Thanks, this works well for what I want.

But I would repeat my suggestion that the variable hideExtRunWindow is automatically reset FALSE (either by Dialog.RunExternal, or, better, by an Action created when it is set TRUE. If it is left TRUE, and forgotten about, the next person to try to use RunExternal will not know why it is apparently not working. It essentially would be a mode in BlackBox, and a pretty well hidden mode.

Robert
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#104 calling URLs and commands (InfoCmds capabilit

Postby Ivan Denisov » Tue Mar 29, 2016 5:57 pm

Robert wrote:But I would repeat my suggestion that the variable hideExtRunWindow is automatically reset FALSE (either by Dialog.RunExternal, or, better, by an Action created when it is set TRUE. If it is left TRUE, and forgotten about, the next person to try to use RunExternal will not know why it is apparently not working. It essentially would be a mode in BlackBox, and a pretty well hidden mode.

Automatic reset added:
http://blackboxframework.org/unstable/i ... a1.488.zip

The summary for suggested changes:
http://redmine.blackboxframework.org/pr ... f&type=sbs
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

PreviousNext

Return to Resolved (Features)

Who is online

Users browsing this forum: No registered users and 1 guest

cron