SPONSORS:






User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Junior Member
    Join Date
    Mar 2000
    Location
    Waltham, MA, USA
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting the computername in silk

    Is there any system function in silk that will get me the computername ? Or I would have to write a dll and make a dll call to do it.

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the computername in silk

    GetMachineName() should do it. You will need a valid handle to the relevant machine, normally obtainable through the function GetMachine().

  3. #3
    Junior Member
    Join Date
    Mar 2000
    Location
    Waltham, MA, USA
    Posts
    27
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the computername in silk

    Thanks vincebowdren
    But I need the machine/hostname, What GetMachineName() gives you is the name of the agent that is set in the network settings of the agent. So if you have agentname as default which is (local), you get back (local) or if you have Network set to none you get nothing back.

  4. #4
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the computername in silk

    In that case I don't think I know of anything I'm afraid.

  5. #5
    Guest

    Re: Getting the computername in silk

    Assuming that you are using a Win9x o/s, the following code snippet should work for you.

    ------------------
    Tony Mrozinski
    Sr. Software Test Automation Engineer
    Home Networking Operations
    Intel Corporation

  6. #6
    Senior Member
    Join Date
    Aug 1999
    Location
    MA
    Posts
    129
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the computername in silk

    I do a call to this location in the registry:
    {HKEY_LOCAL_MACHINE,"System\CurrentControlSet\Cont rol\ComputerName\ComputerName","ComputerName",""}

    I use this for a registry record:
    Say I populated a REGISTRYSTRINGINFO record called data

    And have a wrapper function, that encapsulates this call:
    Steven Tyler
    Manager - Performance Engineering

    Kronos Incorporated
    tel: +1 978 947 4219

  7. #7
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the computername in silk

    You can still do the GetMachineName () only if you name your agent the same name as the machine. In Runtime options, type Machine1 or tha machine name instead of (local), and enable TCP/IP in Network Settings, also turn on TCP/IP in the network settings of the Agent.

    Otherwise you can follow the other's functions, or even I had used a DLL call

    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

  8. #8
    Junior Member
    Join Date
    Mar 2001
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the computername in silk

    Another approach I used this to connect to a database schema depending on what PC SilkAgent was running on-

    string ConnectString = DatabaseSchema ()

    [-] string DatabaseSchema ()
    [ ] string sConnect
    [ ] integer iCompName = HKEY_LOCAL_MACHINE
    [ ] string sPath = "System\CurrentControlSet\Control\ComputerName\Com puterName"
    [ ] string sItem = "ComputerName"
    [ ]
    [ ] string sValue = SYS_GetRegistryValue (iCompName, sPath, sItem)
    [ ]
    [-] switch (sValue)
    [-] // case "<Computer>"
    sConnect = "DSN = ..."

    return sConnect


    Eugene

  9. #9
    Junior Member
    Join Date
    Feb 2001
    Location
    ottawa
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the computername in silk

    not to sure what you are getting at, I hope I understood your question...
    I do the same as what tony and styler have done. I too just use the sys_getregistryvalue. I run my automation on all win OS's as possible...nt/2000/win9x, at the beginning of each testcase I get all relevant info of the environemnt it is running on. I have had no problems getting the machine name. and if it was located in a different key on a different OS then I could always use the conditional statement to switch to that key for that OS because I also have a call to get what OS I am running on.

    j

  10. #10
    Junior Member
    Join Date
    May 2002
    Location
    France
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the computername in silk

    you may also use the system dll:

    dll "kernel32.dll"
    BOOL GetComputerName (out LPCSTR lpszName, in DWORD lpcchBuffer) alias "GetComputerNameA"

    [-] string GetRealComputerName()
    [ ] string sName = Space (256)
    [ ] DWORD Size = Len (sName)
    [ ] GetComputerName(sName, [out] Size)
    [ ] return sName

 

 
Page 1 of 2 12 LastLast

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:34 AM.

Copyright BetaSoft Inc.