Follow us on...
Follow us on G+ Follow us on Twitter Follow us on Facebook Watch us on YouTube
Register
Results 1 to 4 of 4
  1. #1
    Status
    Offline
    antoz's Avatar
    Baru Gabung
    Join Date
    Nov 2007
    Posts
    5
    Reviews
    Read 0 Reviews
    Downloads
    0
    Uploads
    0
    Feedback Score
    0

    keanehan scripting 3.13

    Halo semua..

    Saya lagi pusing dgn scripting di 3.13 nih.. sepertinya versi 3.x emang rada2 aneh..

    Contoh sbb:

    Script jalan di 2.9.46:
    Code:
    [2946@Mikrotik] > :set hostcomp "comp1,comp1,comp2,comp3"
    [2946@Mikrotik] > :put $hostcomp                         
    comp1,comp1,comp2,comp3
    [2946@Mikrotik] > :foreach i in $hostcomp do {:put $i}   
    comp1
    comp1
    comp2
    comp3
    [2946@Mikrotik]
    Sedangkan bila di 3.13:
    Code:
    [313@Mikrotik] > :set hostcomp "comp1,comp1,comp2,comp3"
    [313@Mikrotik] > :put $hostcomp
    comp1,comp1,comp2,comp3
    [313@Mikrotik] > :foreach i in $hostcomp do {:put $i} 
    comp1,comp1,comp2,comp3
    [313@Mikrotik] > :put $"hostcomp"                      
    comp1,comp1,comp2,comp3
    [313@Mikrotik]
    Dalam 3.13 di atas, variabel $i langsung diisi dengan keseluruhan variabel array dari $hostcomp.. padahal inginnya, cuman 1 variabel untuk tiap loop..

    Mungkin para suhu bisa berbagi pengalaman dalam menghadapi hal tsb?

    Thanks...

  2. #2
    Status
    Offline
    Akangage's Avatar
    Administrator
    Join Date
    Aug 2007
    Location
    Daerah Khusus Ibukota Jakarta, Indonesia
    Posts
    4,195
    Reviews
    Read 0 Reviews
    Downloads
    210
    Uploads
    87
    Feedback Score
    0
    Kalo di versi 3 emang gitu kerjanya (kayanya) soalnya beberapa script yang terdahulu juga dah ga bisa dipakai lagi

  3. #3
    Status
    Offline
    antoz's Avatar
    Baru Gabung
    Join Date
    Nov 2007
    Posts
    5
    Reviews
    Read 0 Reviews
    Downloads
    0
    Uploads
    0
    Feedback Score
    0

    akhirnya...

    Setelah konsultasi ke forum.mikrotik.com, akhirnya ketemu..
    untuk V.3, waktu input data, kudu pake :toarray

    Code:
    [313@Mikrotik] > :set hostcomp [:toarray comp1,comp1,comp2,comp3]
    [313@Mikrotik] > :foreach i in $hostcomp do {:put $i}           
    comp1
    comp1
    comp2
    comp3

  4. The Following User Says Thank You to antoz For This Useful Post:


  5. #4
    Status
    Offline
    donipermono1982's Avatar
    Moderator
    Join Date
    Feb 2008
    Location
    Jakarta Selatan
    Posts
    2,809
    Reviews
    Read 0 Reviews
    Downloads
    0
    Uploads
    0
    Feedback Score
    0
    mantaaaapClick here to enlarge

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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