please help
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: please help

  1. #1
    Join Date
    Apr 2017
    Posts
    1

    please help

    hello brothers,
    I have this VBScript program:
    Code:
    Set WSHShell = Wscript.CreateObject("WScript.Shell")       
    Set FSO = Wscript.CreateObject("Scripting.FileSystemObject") 
    Set EnvVar = wshShell.Environment("Process")
    tBestand= EnvVar("USERPROFILE") & "\Desktop\Items Numbers.txt"
    Set Bestand = fso.createtextfile(tBestand,2)
    For x = 1048639472 To 1048640474
    Bestand.WriteLine("Item Number is=" & (x))
    Next
    Bestand.close
    WScript.quit
    The Output is: (about 1002 lines).
    Item Number is=1048639472
    .
    .
    .
    Item Number is=1048640474
    My question is I don't want the output in sequence, I want the output like this function in php language (I found it online):
    Code:
    function check($id){
    $id = trim($id);
    if(!is_numeric($id)) return false;
    if(strlen($id) !== 10) return false;
    $type = substr ( $id, 0, 1 );
    if($type != 2 && $type != 1 ) return false;
    for( $i = 0 ; $i<10 ; $i++ ) {
    //echo "  $id <b>"."</b> -";
    if ( $i % 2 == 0){
    $ZFOdd = str_pad ( ( substr($id, $i, 1) * 2 ), 2, "0", STR_PAD_LEFT );
    $sum += substr ( $ZFOdd, 0, 1 ) + substr ( $ZFOdd, 1, 1 );
    }else{
    $sum += substr ( $id, $i, 1 );
    }
    }
    //echo $sum;
    return $sum%10 ? false : $type;
    is it possible to convert this code php language to vbscript, because i want to add it to my above vbscript program.
    thanks in advance.

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,247

    Re: please help

    It may be better if you try to tell us what you want to do rather than showing PHP code.

    I do not write in PHP so can't be sure what that code does.
    Always use [code][/code] tags when posting code.

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,874

    Re: please help

    [Moved to client script forum]
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.5.0)

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)