Menu

#47 hwg_ShellExecute() doesn(t work anymore under Linux

v1.0_(example)
closed
nobody
1
2020-11-30
2020-07-14
No

Hi,
In my programs, I allow to use the default browser or another browser using a variable (cBrowser)

When this variable isn't set (cBrowser=""), I use hwg_ShellExecute() which uses the default browser, when I want to use another browser than the default, I set this variable.

Since a few time (I don't know exactly when), hwg_ShellExecute() doesn't work anymore, and I must set cBrowser to make it work

Here is my test

if cBrowser == ""
hwg_ShellExecute(chr(34)+curl+chr(34))
else
run(cBrowser+" "+curl+" > /dev/null 2>&1 &")
endif

Can somebody repair this function ?

Discussion

  • Wilfried Brunken

    Hello Aupeix,
    i use the function "hwg_RunApp()" successfully on Windows and LINUX for starting GUI programs asynchronious. It seems to be, that hwg_shellexecute() is outdated (analyse it, if i have time).
    I appended a sample of my app "CLLOG".
    I hope, this helps.
    Please give feedback, if you have success or not.

    With regards, 73 es 55 de
    Wilfried, DF7BE.

    • ====================================
      FUNCTION LOG_BUCH
    • Logbuch
    • Start des Logbuchprogramms "logw"
    • ====================================
    • LOCAL nId
      LOCAL ckommando
      IF LINUX
      ckommando := oDir + "logw"
      ELSE
      ckommando := oDir + "logw.exe"
      ENDIF
      IF .NOT. FILE(oDir + "logbuch.dbf")
      IF bLangEnglish
      hwg_MsgStop("Data base >logbuch.dbf< not found !","Program start Log")
      ELSE
      hwg_MsgStop("Datenbank >logbuch.dbf< nicht gefunden !","Programmstart Logbuch")
      ENDIF
      RETURN 0
      ENDIF
      IF FILE(ckommando)
      hwg_RunApp(ckommando)
      ELSE
      SYS_FEHLST(ckommando)
      ENDIF
      RETURN 0
     
  • Aupeix Alain

    Aupeix Alain - 2020-07-15

    Hi, Wilfried,

    Thanks for your answer.

    After some tests, I find that hwg_ShellExecute() works correctly, except for to types of links with google :

    https://www.google.com/maps/place/@45.5858333333,0.758888888889,21060m?hl=fr

    http://maps.google.com/maps?ll=45.5858333333,0.758888888889&spn=0.1,0.1&t=k&q=45.5858333333,0.758888888889&hl=fr

    I don't understant why it fails.

    I didn't know hwg_RunApp( cCommand [, nFlag] [, lAsync] ) ).
    What are the purpose of the two last params ?
    I suppose the last allows to wait or not the end of cCommand execution, but I don't understand the purpose of the second param ...

    Thanks
    A+

     
  • Wilfried Brunken

    Hello Aupeix,
    because i am very busy, could you do me a favour:
    Can you post as an attachment ("Add attachment") a simple sample program with a mini menu ?
    (I think the sample of browser usage is a very good template for the community).
    Please add the the copyright header of another HWGUI sample program, so that i can
    commit it under "samples/gtk_samples" after bugfixing.
    I have a suspicion what your problem causes. I'll test it under UBUNTU16/AMD64
    with the Firefox browser.

    In the next few days i will complete the documentation of the function "hwg_RunApp( )".

    With regards, MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Aupeix Alain

    Aupeix Alain - 2020-07-16

    Hi Wilfried,

    The problem is related to my code, now it works.
    I first tried, before posting this bug, to add chr(34) around curl, because I saw that there were spaces at this end of the variable cgoogle
    I then use strtran to remove spaces (it was better to use trim())
    Now, with this code, removing chr(34), it works
    ~~~
    cgoogle:="http://maps.google.com/maps?ll~~$1$,$2$&spn~~0.1,0.1&t~~$3$&q~~$1$,$2$&hl~~fr"
    curl= strtran(strtran(strtran(strtran(cgoogle,"$1$",clat),"$2$",clon),"$3$",ccarte),"~~","=")
    curl=strtran(curl," ","")
    if withsource
    qout(curl+chr(10))
    endif
    if cBrowser == ""
    hwg_ShellExecute(curl)
    else
    Close_db()
    run(cBrowser+" "+curl+" > /dev/null 2>&1 &")
    Open_db()
    endif~~~

    Sorry for this erratic bug report :(
    You can obviously close it

    A+

     
  • Wilfried Brunken

    Hello Alain,
    don't matter.
    Thank you for your feedback.

    To Alexander Ḱresin: Please close this ticket.

    With reagards
    73 es 55 de
    DF7BE, Wilfried

     
  • Maurizio la Cecilia

    • status: open --> closed
     

Log in to post a comment.