Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
NightWares
Manipulating Date and Time using Lingo
cXtraTwain
Importing bitmaps without loosing white space
Firefly CD Burning Xtra
Animated Slider Puzzle by J.R.D.R.
Photo Caster
Authoring Xtras
File Save Button
DaoX
 

 

 

Behavior System Info into a field member

Added on 6/12/2000

 

Compatibilities:
behavior D7 D8 PC

Required Xtras:
Buddy API

This item has not yet been rated

Author: KumarK

System Info into a field member

---- written for Director 8 ---
---- Kumar.K kumark@icode.com ----
------ Custom Properties ------
property  theMember,WhereTo,Version_Info,systemfolders,cpu_info,disk_info,Mem_Info,Screen_Info,sound_info,font_info,cpu_desc,DiskList

-- Events --
on EnterFrame me
  if WhereTo = "On EnterFrame" then
    InsertSystemInfo
  end if
end EnterFrame

on ExitFrame me
  if WhereTo = "On EnterFrame" then
    InsertSystemInfo
  end if
end ExitFrame

on MouseUp
  if WhereTo = "On MouseUp" then
    InsertSystemInfo
  end if
end MouseUp

on MouseDown
  if WhereTo = "On MouseDown" then
    InsertSystemInfo
  end if
end MouseDown

on MouseEnter
  if WhereTo = "On MouseEnter" then
    InsertSystemInfo
  end if
end MouseEnter

on MouseLeave
  if WhereTo = "On MouseLeave" then
    InsertSystemInfo
  end if
end MouseLeave
------ Events ------

------ Get Behavior Description List ------
on getPropertyDescriptionList me
  FieldMembersList = searchfieldMember(me)
  if  FieldMembersList.count() > 0 then
    set description = [:]
    addProp description, #theMember, [#format:#String, #comment: "Insert System Info into Which Field ?", \
  #range:FieldMembersList,#default:FieldMembersList[1]]
    addProp description, #Version_Info, [#format:#Boolean, #comment: "Do You Want to Insert --> Version Info ?", \
  #range:[True,false],#default:True]
    addProp description, #systemfolders, [#format:#Boolean, #comment: "Do You Want to Insert --> SystemFolders Info ?", \
  #range:[True,false],#default:True]    
    addProp description, #cpu_info, [#format:#Boolean, #comment: "Do You Want to Insert --> Cpu Info ?", \
  #range:[True,false],#default:True]    
    addProp description, #disk_info, [#format:#Boolean, #comment: "Do You Want to Insert --> Disk Info ?", \
    #range:[True,false],#default:True]
    addProp description, #Mem_Info, [#format:#Boolean, #comment: "Do You Want to Insert --> Memory Info ?", \
    #range:[True,false],#default:True]      
    addProp description, #Screen_Info, [#format:#Boolean, #comment: "Do You Want to Insert --> Screen Info ?", \
    #range:[True,false],#default:True]      
    addProp description, #Sound_Info, [#format:#Boolean, #comment: "Do You Want to Insert --> SoundCard Info ?", \
  #range:[True,false],#default:True]  
    addProp description, #Font_Info, [#format:#Boolean, #comment: "Do You Want to Insert --> Fonts Info ?", \
    #range:[True,false],#default:True]        
    if the currentspritenum = 0 then
      addProp description, #WhereTo, [#comment: "Where To Attach ?" ,#format:#String, \
    #range:["On EnterFrame","On ExitFrame"],#default:"On EnterFrame"]
    else
      addProp description, #WhereTo, [#comment: "Where To Attach ?" ,#format:#String, \
    #range:["On MouseUp","On MouseDown","On MouseEnter","On MouseLeave"],#default:"On MouseUp"]    
    end if    
    return description
  else
    exit
  end if  
end getPropertyDescriptionList
------ Get Behavior Description List ------

-- Get Behavior description --
on getBehaviorDescription
  return "This Behavior Insrets the System info into Field Member" & RETURN & RETURN & \
  "This Behavior needs Buddy API Xtra to work, so please ensure You Have Buddy API Xtra." & RETURN & RETURN &\
  "Parameters" & RETURN & \
  "* Field Member." & RETURN & \
  "* system info needed." & RETURN & \
  "* Where to attach this Script"
end

------ Availbale for both Frame and Sprite Script ------
on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #graphic:
      return true
    #script:
      return true
  end case
end isOKToAttach
------ Availbale for both Frame and Sprite Script ------

------ Search for Field Member ------
on searchfieldMember me
  FieldMembersList = []
  maxCastLib = the number of castLibs
  repeat with theCastLib = 1 to maxCastLib
    maxMember = the number of members of castLib theCastLib
    repeat with memberNumber = 1 to maxMember
      theMember = member(memberNumber, theCastLib)
      if theMember.type = #Field then
        if theMember.name = EMPTY then
          FieldMembersList.append(theMember)
        else
          FieldMembersList.append(theMember.name)
        end if
      end if
    end repeat
  end repeat
  return FieldMembersList
end
------ Search for Field Member ------

-- Insert System Info --
on InsertSystemInfo
  member(themember).text=""
  --- setting the field to editabel
  member(theMember).editable = TRUE  
  --- Making the field scrollable
  member(theMember).boxType = #scroll
  --- Align the field
  member (theMember).alignment = "left"
  ----insertinging version info ----
  if Version_Info=true then
    member(themember).text= "----------------- Version Info -----------------"
    set os = baVersion("os")
    set ver = baVersion("windows")
    set ntver = baVersion("nt")
    set dosver = baVersion("dos")
    set vfwver = baVersion("vfw")
    set qtver = baVersion("qt")    
    set qt3ver = baVersion("qt3")  
    insertintofield theMember,"Operating System :",os
    insertintofield theMember,"Windows Version :",ver
    insertintofield theMember,"Nt Version :",ntver  
    insertintofield theMember,"Dos Version :",dosver      
    insertintofield theMember,"Video For Windows Version :",vfwver
    insertintofield theMember,"QT Version :",qtver
    insertintofield theMember,"QT3 Version :",qt3ver      
  end if  
  ---Insert System Folders Info ---
  if systemfolders=true then
    member(themember).text=member(themember).text & Return & Return & "----------------- SystemFolders Info -----------------"
    set winfold = baSysFolder( "Windows" )
    set sysfold = baSysFolder( "system" )
    set tempfold = baSysFolder( "temp" )
    set curfold = baSysFolder( "current" )    
    insertintofield theMember,"Windows Folder :",winfold    
    insertintofield theMember,"System Folder :",sysfold    
    insertintofield theMember,"Temparary Folder :",tempfold    
    insertintofield theMember,"Current Folder :",curfold        
  end if
  ---Insert CPU Info --  
  if cpu_info=true then
    member(themember).text=member(themember).text & Return & Return & "----------------- CPU Info -----------------"  
    set cpu_vendor = baCpuInfo( "vendor" )
    set cpu_type = baCpuInfo( "type" )
    set cpu_model = baCpuInfo( "model" )
    set cpu_stepping = baCpuInfo( "stepping" )
    set cpu_speed = baCpuInfo( "speed" )
    findcputype cpu_type,cpu_model
    insertintofield theMember,"CPU vendor :",cpu_vendor    
    insertintofield theMember,"CPU Type and Model:",cpu_Desc
    insertintofield theMember,"CPU Stepping ",cpu_stepping    
    insertintofield theMember,"CPU Speed:",cpu_speed & " Mzh"
  end if
  if disk_info=true then
    member(themember).text=member(themember).text & Return & Return & "----------------- Disk Info -----------------"  
    findnumofdisks
    getdiskinfo
  end if
  if mem_info=true then
    member(themember).text=member(themember).text & Return & Return & "----------------- Memory Info -----------------"  
    set ram = baMemoryInfo( "ram" )
    set freeram = baMemoryInfo( "free ram" )
    set swap = baMemoryInfo( "swap" )
    set freeswap = baMemoryInfo( "free swap" )
    insertintofield theMember,"Amount of Physical memory :",(ram/1024)/1024 & " Mb"  
    insertintofield theMember,"Amount of free Physical memory :",(freeram/1024)/1024 & " Mb"    
    insertintofield theMember,"Size of the Current Swap File :",(swap/1024)/1024 & " Mb"    
    insertintofield theMember,"Amount of the swap file not being used :",(freeswap/1024)/1024 & " Mb"        
  end if  
  if Screen_Info=true then
    member(themember).text=member(themember).text & Return & Return & "----------------- Screen Info -----------------"  
    set screen_height = baScreenInfo( "height")
    set screen_width = baScreenInfo( "width")
    set screen_depth = baScreenInfo( "depth")
    set screen_fontheight = baScreenInfo( "fontheight")    
    insertintofield theMember,"Height of the screen in pixels :",screen_height    
    insertintofield theMember,"Width of the screen in pixels :",screen_width    
    insertintofield theMember,"Color depth of the screen in bits :",screen_depth    
    insertintofield theMember,"Height of the system font in pixels :",screen_fontheight        
  end if
  if Screen_Info=true then
    member(themember).text=member(themember).text & Return & Return & "----------------- SoundCard Info -----------------"  
    set Soundcard = baSoundCard( )
    if Soundcard=1 then
      insertintofield theMember,"Is SoundCard is Installed :", "Yes"
    else
      insertintofield theMember,"Is SoundCard is Installed :", "No"      
    end if
  end if
  if font_info=true then
    member(themember).text=member(themember).text & Return & Return & "----------------- Fonts Installed on Your machine -----------------"  
    checkfontsinstalled
  end if  
end
-- Insert System Info --

--- insert into field
on insertintofield mem,first,second
  ---- spaces -----
  addspace = "            "  
  member(mem).text= member(mem).text & Return & first &  second
end
--- insert into field

-- Find Cpu Type and Mode --
on findcputype cputype,model
  if cputype = 4  and ((model = 0) or (model =1)) then
    cpu_desc="486 DX"
  end if
  if cputype = 4  and (model = 2)  then
    cpu_desc="486 SX"
  end if
  if cputype = 4  and ((model = 3) or (model =7)) then
    cpu_desc="486 DX2"
  end if
  if cputype = 4  and (model = 4) then
    cpu_desc="486 SL"
  end if
  if cputype = 4  and (model = 5) then
    cpu_desc="486 SX2"
  end if
  if cputype = 4  and (model = 8) then
    cpu_desc="486 DX4"
  end if
  if cputype = 5  and ((model = 1) or (model = 2)) then
    cpu_desc="Pentium"
  end if
  if cputype = 5  and (model = 3) then
    cpu_desc="Pentium Overdrive"
  end if
  if cputype = 5  and (model = 4) then
    cpu_desc="Pentium MMX"
  end if  
  if cputype = 6  and (model = 1) then
    cpu_desc="Pentium Pro"
  end if    
  if cputype = 6  and (model = 3) then
    cpu_desc="Pentium II (r1)"
  end if
  if cputype = 6  and (model = 5) then
    cpu_desc="Pentium II (r2)"
  end if
  if cputype = 6  and (model = 5) then
    cpu_desc="Celeron (r1)"
  end if
  if cputype = 6  and (model = 6) then
    cpu_desc="Celeron (r2)"
  end if
  if cputype = 6  and (model = 7) then
    cpu_desc="Pentium III"
  end if  
  if cputype = 5  and ((model = 5) or (model = 6)) then
    cpu_desc="AMD K5"
  end if    
  if cputype = 5  and (model = 7) then
    cpu_desc="AMD K6"
  end if
  if cputype = 5  and (model = 8) then
    cpu_desc="AMD K6-II"
  end if
  if cputype = 5  and (model = 9) then
    cpu_desc="AMD K6-III"
  end if
end

-- to find number of disks ---

on findnumofdisks
  seachlist=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","y","z"]
  DiskList=[]
  repeat with i=1 to seachlist.count
    Result = baDiskInfo( seachlist[i], "type" )
    if result <> "Invalid" then
      DiskList.append(seachlist[i])
    end if
  end repeat
end

-----

---write about disk --
on getdiskinfo
  baDisableDiskErrors( true )
  repeat with i=1 to DiskList.count
    disk_type=baDiskInfo( DiskList[i], "type" )
    disk_name=baDiskInfo( DiskList[i], "name" )
    disk_size=baDiskInfo( DiskList[i], "size" )
    disk_free=baDiskInfo( DiskList[i], "free" )    
    disk_number=baDiskInfo( DiskList[i], "number" )
    member(themember).text= member(themember).text & Return    
    member(themember).text=member(themember).text & Return &  "Details of Drive " &  DiskList[i] & ":\"
    insertintofield theMember,"Drive Type :",disk_type
    insertintofield theMember,"Drive Name :",disk_name    
    insertintofield theMember,"Drive Size :",disk_size/1024 & " MB"
    insertintofield theMember,"Free Space :",disk_free/1024 & " MB"
    insertintofield theMember,"Serial Number :",disk_number    
  end repeat
  baDisableDiskErrors( false )  
end

----check the fonts installed
on checkfontsinstalled
  set fontslist = baFontList( "all" )
  sort fontslist
  repeat with i= 1 to fontslist.count
    member(themember).text=member(themember).text & Return & fontslist[i]
  end repeat  
end
----check the fonts installed

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail