Alpha Video Training
Results 1 to 16 of 16

Thread: SYS_OPEN not supported

  1. #1
    Member
    Real Name
    Jim Roberts
    Join Date
    Aug 2013
    Location
    Itasca, IL
    Posts
    130

    Default SYS_OPEN not supported

    Hi All,
    I'm trying to use sys_open to open an excel file but it errors out with a "Not Supported" message. Is there some library or something that needs to be registered? I also tried it on just a text file with the same results.

    Thanks,
    Jim

  2. #2
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,351

    Default Re: SYS_OPEN not supported

    Hi Jim,

    This is one of those times where showing your code can help a lot.

  3. #3
    Member
    Real Name
    Jim Roberts
    Join Date
    Aug 2013
    Location
    Itasca, IL
    Posts
    130

    Default Re: SYS_OPEN not supported

    For testing, I just brought it down to the basics, just to make sure something else in my code was messing with it.
    This is what I hooked up to a button for testing:

    function TestExcelOpen as c (e as p)
    dim DocFile as c = "C:\Temp\TimeSheet.xlsx"
    sys_open(DocFile)
    end function

    I also tried it with skipping the variable:

    function TestExcelOpen as c (e as p)
    sys_open("C:\Temp\TimeSheet.xlsx")
    end function


    and to answer what would be my first question, Yes I'm sure the file is in that location and is not corrupt.

    This is the error message I get.
    sys_open_error.jpg

  4. #4
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,351

    Default Re: SYS_OPEN not supported

    You do need a default program assigned to open .xlsx files.
    If that isn't the issue, I would check permissions.

  5. #5
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,597

    Default Re: SYS_OPEN not supported

    Sys_Open is for desktop apps only. See spec at bottom of documentation page.

    https://documentation.alphasoftware....20Function.xml
    -Steve


  6. #6
    Member
    Real Name
    Jim Roberts
    Join Date
    Aug 2013
    Location
    Itasca, IL
    Posts
    130

    Default Re: SYS_OPEN not supported

    Well that explains it. Thanks Steve.

  7. #7
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    344

    Default Re: SYS_OPEN not supported

    I did something like this awhile back and ended up not using sys_open.
    From what I understand, the OS "user" profile (the app server) that is trying to open Excel needs to be able to open a Windows interactive session.

    So, I had to think out of the box.

    I ended up using the Helper::ShellProcess Class
    https://documentation.alphasoftware....cess/index.xml

    My Xbasic code was:

    Code:
    function openExcel as c (e as p)
    
    dim commandToLaunch as C = "SCHTASKS /RUN /TN \"openExcelBat\""
    sp = Helper::ShellProcess::Create(commandToLaunch)
    
    end function
    On the app server machine (I'm using the IIS version), you might have to do some of these things:
    - Create a new user on the server (I called mine IISCommandLaunch) and put it in a group that can run scheduled tasks
    - In the IIS Manager, add a Custom account for the Application Pool Identity for the application and set it to the new user (there may be other ways to do this that would be safer)
    - create a .bat file that has the command to open Excel
    - create a Windows Scheduled Task (but no actual schedule or trigger for the task) that will run the .bat
    SCHTASKS /RUN /TN "taskOpenExcel" will immediately run the task (TN = task name)

    There is almost always a way...

  8. #8
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,351

    Default Re: SYS_OPEN not supported

    I'm crazy enough to pay attention to the question rather than where it's posted.
    Turns out I should not have done that this time.
    Now that I know it's a web-type project, I thought mime settings are meant
    to determine how to open files on a client computer.

  9. #9
    "Certified" Alphaholic kkfin's Avatar
    Real Name
    Kenneth
    Join Date
    Dec 2006
    Location
    EU
    Posts
    1,535

    Default Re: SYS_OPEN not supported

    Quote Originally Posted by madtowng View Post
    I'm crazy enough to pay attention to the question rather than where it's posted.
    Turns out I should not have done that this time.
    Now that I know it's a web-type project, I thought mime settings are meant
    to determine how to open files on a client computer
    .
    I think nothing posted in this thread will work in client computer in context of web application running in server.

  10. #10
    Volunteer Moderator drgarytraub's Avatar
    Real Name
    Dr. Gary Traub
    Join Date
    May 2000
    Location
    Boca Raton, FL
    Posts
    2,772

    Default Re: SYS_OPEN not supported

    If your excel file is called "book1.xlsx" and you publish it to your webroot, then this will open the excel file:

    http://asus:8080/Myapp/book1.xlsx
    Gary S. Traub, Ph.D.


  11. #11
    "Certified" Alphaholic kkfin's Avatar
    Real Name
    Kenneth
    Join Date
    Dec 2006
    Location
    EU
    Posts
    1,535

    Default Re: SYS_OPEN not supported

    Quote Originally Posted by drgarytraub View Post
    If your excel file is called "book1.xlsx" and you publish it to your webroot, then this will open the excel file:

    http://asus:8080/Myapp/book1.xlsx
    Actually this will not happen in web application.

    Browser just asks do you want to download file.

  12. #12
    Volunteer Moderator drgarytraub's Avatar
    Real Name
    Dr. Gary Traub
    Join Date
    May 2000
    Location
    Boca Raton, FL
    Posts
    2,772

    Default Re: SYS_OPEN not supported

    I have not done this a lot but it does work for me. Perhaps there is a browser setting that will either download or download and open?

    But downloading the file allows user to open it any way, and this is better than not being able to open the xls file at all, no?

    Here's a screen shot:

    alpha.jpg
    Last edited by drgarytraub; 05-15-2019 at 10:01 AM.
    Gary S. Traub, Ph.D.


  13. #13
    "Certified" Alphaholic kkfin's Avatar
    Real Name
    Kenneth
    Join Date
    Dec 2006
    Location
    EU
    Posts
    1,535

    Default Re: SYS_OPEN not supported

    Web would be very bad broken if you click something and then some file opens in your computer.

    Browser must always ask permission.

  14. #14
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015
    Posts
    425

    Default Re: SYS_OPEN not supported

    Quote Originally Posted by drgarytraub View Post
    I have not done this a lot but it does work for me. Perhaps there is a browser setting that will either download or download and open?

    But downloading the file allows user to open it any way, and this is better than not being able to open the xls file at all, no?

    Here's a screen shot:

    alpha.jpg
    Browsers will let you configure the behavior when a file type is clicked. For example, in FireFox, you can configure the action for a file when it's downloaded/clicked: https://support.mozilla.org/en-US/kb...when-open-file. Actions include downloading the file, prompting, or always opening the file in a specific application. This behavior, however, is configured by the end-user and isn't something you can override in your web application.
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

  15. #15
    Volunteer Moderator drgarytraub's Avatar
    Real Name
    Dr. Gary Traub
    Join Date
    May 2000
    Location
    Boca Raton, FL
    Posts
    2,772

    Default Re: SYS_OPEN not supported

    Makes sense. OK, thanks!
    Gary S. Traub, Ph.D.


  16. #16
    Member
    Real Name
    Jim Roberts
    Join Date
    Aug 2013
    Location
    Itasca, IL
    Posts
    130

    Default Re: SYS_OPEN not supported

    Oh well, I thought I might be able to make things a little quicker for the users by auto-opening, but it's not that much more work to just open the downloaded file. Thanks for all the assistance everyone.

Similar Threads

  1. After Sys_open()
    By johnkoh in forum Alpha Five Version 9 - Desktop Applications
    Replies: 0
    Last Post: 05-10-2013, 08:38 AM
  2. Sys_open
    By Mark Pearson in forum Alpha Five Version 9 - Desktop Applications
    Replies: 18
    Last Post: 10-15-2009, 03:33 PM
  3. Sys_open Is There a Way?
    By crimmelcp in forum Alpha Five Version 10 - Desktop Applications
    Replies: 2
    Last Post: 10-05-2009, 10:16 AM
  4. sys_open
    By andymeer@yahoo.co.uk in forum Alpha Five Version 8
    Replies: 1
    Last Post: 02-25-2008, 05:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •