Alpha Video Training
Results 1 to 9 of 9

Thread: write text into a script or UDF with xbasic

  1. #1
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    4,158

    Default write text into a script or UDF with xbasic

    Is there a method that allows writing to a script of UDF code? There is UDF_load() and script_load() that allows acquisition of the script text. Is there a method to write text into a script using xbasic?
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: write text into a script or UDF with xbasic

    I've seen the code to do that. I'll go look for it.

  3. #3
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: write text into a script or UDF with xbasic

    Udf_define()

  4. #4
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,785

    Default Re: write text into a script or UDF with xbasic

    Mike,

    You have not mentioned why you need this so I will mention Compile_template() as another possibility.
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  5. #5
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default Re: write text into a script or UDF with xbasic

    Quote Originally Posted by Mike Wilson View Post
    Is there a method that allows writing to a script of UDF code? There is UDF_load() and script_load() that allows acquisition of the script text. Is there a method to write text into a script using xbasic?
    The following are the functions to use:

    C UDF_SAVE(C udf_name,C udf_code[,C Password[,L annotate]])
    C SCRIPT_SAVE(C script_name,C script_code[,C Password])
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture



  6. #6
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Michigan
    Posts
    4,158

    Default Re: write text into a script or UDF with xbasic

    Thank you, Ira. Those work great. They are not in the Docs that I could find, so I didn't.

    Tim, what I am wanting to do is store some lines of data in a script or UDF with the added benefit of it being behind a password. Something that the developer (me) or the code I have written can access. I'm thinking about storing an application registration number there.

    Gabe, I saw that but couldn't figure out how it worked. Not enough documentation for me.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  7. #7
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: write text into a script or UDF with xbasic

    Hi All,

    I can Load the "scripts or Udf" in my Code_editor but not know how to save it to original scripts or udf.
    The SCRIPT_SAVE(C script_name,C script_code[,C Password]) is opened the explorer and saving it to Text file.

    Code:
    'xCode = "testing codes and how to get it?"
    xCode = script_load("a_attach_1")
    'xCode = UDF_Load("a_Create_LineSeqNo")
    
    Result = ui_dlg_box("Script",<<%dlg%
    {region}
    {stickto=left}
    {region}
    Code lists at here;
    [.40,10vSelectList^#ChoiceList];
    {endregion}|{sp}|
    {stretch=width,height}
    {region}
    Type in some Xbasic code, then click OK to execute the code.;
    {line=1,0};
    [%L%.120,50xcode];
    
    {endregion};
    {endregion};{comment=end big region}
    
    {stickto=bottom}
    {stretch=}
    
    
    {region}
    <*15&OK> <15&Cancel>;
    {endregion}
    
    %dlg%)
    
    if result = "&OK" then
    
        evaluate_template(xcode)
    	'How to save it to a5 code?
    	'C a5_save_script(C script_code ,L favorites_prompt )
    	'Re: write text into a script or UDF with xbasic
    	'C SCRIPT_SAVE(C script_name,C script_code[,C Password])
    	'C UDF_SAVE(C udf_name,C udf_code[,C Password[,L annotate]])
    	SCRIPT_SAVE("a_attach_1")	
    end if

  8. #8
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: write text into a script or UDF with xbasic

    As you note in your commented out line, the syntax is 'C SCRIPT_SAVE(C script_name,C script_code[,C Password]).

    Your line SCRIPT_SAVE("a_attach_1") supplies the name of the script to save, it does not supply any script code. It appears you want

    SCRIPT_SAVE("a_attach_1",xcode)
    There can be only one.

  9. #9
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: write text into a script or UDF with xbasic

    Stan,

    Thank you for the point and worked great. I can have a my_custom_editor now.

Similar Threads

  1. How to fire javascript after xbasic udf?
    By eritovs in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 10-29-2010, 06:23 AM
  2. Javascript -> Xbasic UDF
    By eritovs in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 06-02-2010, 03:38 AM
  3. How to refer to checkbox text in script/Xbasic?
    By Howard G. Cornett in forum Alpha Five Version 5
    Replies: 2
    Last Post: 03-30-2003, 01:28 PM
  4. Is it psoosible to write a script 2 print a script
    By Graham Wickens in forum Alpha Five Version 4
    Replies: 2
    Last Post: 11-03-2002, 12:27 PM
  5. Can we Write a script with xbasic?
    By Willard in forum Alpha Five Version 4
    Replies: 8
    Last Post: 06-05-2000, 08:26 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
  •