WinBatch® Technical Support Forum

Archived Boards => WinBatch Script Exchange => Topic started by: kdmoyers on May 02, 2013, 10:01:14 AM

Title: testing a posted code fragment
Post by: kdmoyers on May 02, 2013, 10:01:14 AM

  #definesubroutine ArrSetup(arr)
    ; Used to maintain a set of named array indexes
    ; globally across main program and functions.
    if arrinfo(arr,0)==1 ; one dimensional
      for _i = 1 to itemcount(arr[0],' ')
        _s = itemextract(_i,arr[0],' ')
        @%_s% = _i
      next _i
    elseif arrinfo(arr,0)==2 ; two dimensional
      for _i = 1 to itemcount(arr[0,0],' ')
        _s = itemextract(_i,arr[0,0],' ')
        @%_s% = _i
      next _i
    endif
    drop(_i,_s)
    return parr
    ;Usage in main program:
    ;   arrvar = ARRDIMENSION(100)
    ;   arrvar[0] = "FRED PETE SALLY"
    ;   ArrSetup(*PTRGLOBALDEFINE(arrvar))
    ;   . . .
    ;   arrvar[@SALLY] = 1234
    ;
    ;Usage in functions:
    ;   arrvar = ArrSetup(*PTRGLOBAL(arrvar))
    ;   . . .
    ;   X = arrvar[@SALLY]
    ;
  #endsubroutine

  mem = arrdimension(100)
  mem[0]="left top inifile speed"
  arrsetup(*ptrglobaldefine(mem))

  #definefunction fred(a)
    mem = arrsetup(*ptrglobal(mem))
    message(a,mem[@top])
  #endfunction

  mem[@top] = 45

  fred("sally")

exit
Title: Re: testing a posted code fragment
Post by: kdmoyers on May 02, 2013, 10:02:50 AM
Code (winbatch) Select

  #definesubroutine ArrSetup(arr)
    ; Used to maintain a set of named array indexes
    ; globally across main program and functions.
    if arrinfo(arr,0)==1 ; one dimensional
      for _i = 1 to itemcount(arr[0],' ')
        _s = itemextract(_i,arr[0],' ')
        @%_s% = _i
      next _i
    elseif arrinfo(arr,0)==2 ; two dimensional
      for _i = 1 to itemcount(arr[0,0],' ')
        _s = itemextract(_i,arr[0,0],' ')
        @%_s% = _i
      next _i
    endif
    drop(_i,_s)
    return arr
    ;Usage in main program:
    ;   arrvar = ARRDIMENSION(100)
    ;   arrvar[0] = "FRED PETE SALLY"
    ;   ArrSetup(*PTRGLOBALDEFINE(arrvar))
    ;   . . .
    ;   arrvar[@SALLY] = 1234
    ;
    ;Usage in functions:
    ;   arrvar = ArrSetup(*PTRGLOBAL(arrvar))
    ;   . . .
    ;   X = arrvar[@SALLY]
    ;
  #endsubroutine

  mem = arrdimension(100)
  mem[0]="left top inifile speed"
  arrsetup(*ptrglobaldefine(mem))

  #definefunction fred(a)
    mem = arrsetup(*ptrglobal(mem))
    message(a,mem[@top])
  #endfunction

  mem[@top] = 45

  fred("sally")

exit
Title: Re: testing a posted code fragment
Post by: td on May 03, 2013, 08:01:23 AM
Welcome! You have the 'honor' of being  the first WinBatch user to sign in to the new forum.  8)
Title: Re: testing a posted code fragment
Post by: kdmoyers on May 06, 2013, 05:31:13 AM
Proud to be here.  Lemme know if I can help!
-Kirby
Title: Re: testing a posted code fragment
Post by: myfairlady on August 22, 2013, 06:37:19 PM
Hi there, please help me.

I use win batch to upload some data to Movex. I found some issue and got reply from win batch support. They give me some script to add. I don't know where can i add those script and how to fix. Please help me win batch expert. Thanks.
I am just normal end user and use winbatch for uploading purpose. I don't know which is source file and which IDE is required. Please help me. If my question  is wrong thread, feel free to move the post. Thanks.

Best Regards,
myfairlady
Title: Re: testing a posted code fragment
Post by: Deana on August 23, 2013, 07:45:49 AM
Quote from: myfairlady on August 22, 2013, 06:37:19 PM
Hi there, please help me.

I use win batch to upload some data to Movex. I found some issue and got reply from win batch support. They give me some script to add. I don't know where can i add those script and how to fix. Please help me win batch expert. Thanks.
I am just normal end user and use winbatch for uploading purpose. I don't know which is source file and which IDE is required. Please help me. If my question  is wrong thread, feel free to move the post. Thanks.

Best Regards,
myfairlady

Notice: When posting to this forum you should post all WinBatch questions to the WINBATCH board.

WinBatch source files have the extension .WBT. The WinBatch Studio is the IDE to develop your WinBatch scripts.

If you plan on writing or modifying WinBatch scripts, it recommend that you start by reading the WIL Tutorial. This tutorial is located in the Consolidated WIL help file that is listed under WinBatch on your Start Menu. Otherwise you should contact the developer of the script to make any modifications.