sexta-feira, 2 de setembro de 2011

HTML acessando sheet name do Excel por VBScript

Abaixo segue o código HTML
Para testar crie um arquivo excel (.xls) no drive “C:\” chamado “TESTE2.XLS” e neste arquivo crie 6 planilhas. Este exemplo vai exibir uma caixa de mensagem contendo o nome e caminho do arquivo e todas as 6 planilhas existentes. A identificação das planilhas está fixa (hard-code) porém pode-se criar uma forma dinâmica para verificar todas as planilhas existentes no arquivo. Se alguém souber de outra forma como fazer seja em qualquer linguagem, por favor, comentem.

<HTML>
<HEAD>
<TITLE>Busca nome da sheet</TITLE>
</HEAD>
<BODY>

<FORM NAME="Form1">
   <INPUT TYPE="Button" NAME="Button1" VALUE="Click">
   <SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">
        Dim objExcel, strExcelPath, objSheet1, objSheet2, objSheet3, objSheet4, objSheet5, objSheet6

        ' Aqui eu verifico se existe a aplicação Excel instalada
        ' Isso eu não consegui testar
        On Error Resume Next
        Set objExcel = CreateObject("Excel.Application")
        If (Err.Number <> 0) Then
            On Error GoTo 0
            Wscript.Echo "Não existe Excel instalado."
            Wscript.Quit
        End If
        On Error GoTo 0

        strExcelPath = "c:\teste2.xls"
        ' Aqui eu seleciono as sheets
        objExcel.WorkBooks.Open strExcelPath
        Set objSheet1 = objExcel.ActiveWorkbook.Worksheets(1)  
        Set objSheet2 = objExcel.ActiveWorkbook.Worksheets(2)  
        Set objSheet3 = objExcel.ActiveWorkbook.Worksheets(3)          
        Set objSheet4 = objExcel.ActiveWorkbook.Worksheets(4)          
        Set objSheet5 = objExcel.ActiveWorkbook.Worksheets(5)          
        Set objSheet6 = objExcel.ActiveWorkbook.Worksheets(6)          
        MsgBox "O nome do arquivo é:" & strExcelPath & vbcrlf &_
               "O nome da sheet1 é: " & objsheet1.name & vbcrlf  &_
               "O nome da sheet2 é: " & objsheet2.name  & vbcrlf &_
               "O nome da sheet3 é: " & objsheet3.name  & vbcrlf &_
               "O nome da sheet4 é: " & objsheet4.name  & vbcrlf &_
               "O nome da sheet5 é: " & objsheet5.name  & vbcrlf &_
               "O nome da sheet6 é: " & objsheet6.name
        ' Aqui eu fecho a planilha Excel
        ' Se não fizer isso a planilha ficará presa, sugiro que isso seja tratado se ocorrer algum erro depois da abertura do Excel.
        objExcel.ActiveWorkbook.Close
        ' Aqui eu fecho a aplicação Excel
        objExcel.Application.Quit
   </SCRIPT>
</FORM>
</BODY>
</HTML>

Limpando a máquina

Limpe tudo o que estiver no temp, sem medo de ser feliz. Alguns arquivos não poderão ser apagados, isso não será problema.

start + run  e digite %temp%

Vá em start + run e digite cmd, depois digite ipconfig <enter> e depois digite flush dns

quarta-feira, 31 de agosto de 2011

Listar usuários conectados 2

_global usuarios_conectados <<
_proc(_optional write?)
    ## This proc lists out the users (username@machine_name)
    ## connected to smallworld at that instance.
    ##
    ## The argument write? is defaulted to _true. If given false, it doesn't
    ## write at the magik prompt.
    ##
    ## Anycase it returns a simple_vector of user names.
    write? << write?.default(_true)
    mv << message_handler.view
    fl << mv.files.an_element()
    _local log_fl << fl.current_logical_file
    us << log_fl.users
    us << us.map(_proc (id)
               _import log_fl

               >> log_fl.user_details(id)
             _endproc)
    _if write?
    _then

        gr << equality_hash_table.new()
        guser << equality_hash_table.new()
        _for u _over us.fast_elements()
        _loop
            pos_arroba << u.index_of_seq("@")

            user << u.subseq(1,pos_arroba-1)
            machine << u.subseq(pos_arroba+1,u.size-pos_arroba)

            _if gr[machine.as_symbol()]_is _unset
            _then
                gr[machine.as_symbol()] << 1
            _else
                gr[machine.as_symbol()] +<< 1
            _endif

            _if guser[user.as_symbol()]_is _unset
            _then
                guser[user.as_symbol()] << 1
            _else
                guser[user.as_symbol()] +<< 1
            _endif

            write(u," -> ",user," - ",machine)
        _endloop

        _for i,k _over gr.keys_and_elements()
        _loop
            write(i," count: ",k)
        _endloop

        _for i,k _over guser.keys_and_elements()
        _loop
            write(i," count: ",k)
        _endloop
    _endif
    >> us
_endproc
$

Listar usuários conectados

_global usuarios_conectados <<

_proc(_optional write?)
      ## This proc lists out the users (username@machine_name)
      ## connected to smallworld at that instance.
      ##
      ## The argument write? is defaulted to _true. If given false, it doesn't
      ## write at the magik prompt.
      ##

      ## Anycase it returns a simple_vector of user names.

      write? << write?.default(_true)
      mv << message_handler.view
      fl << mv.files.an_element()
      _local log_fl << fl.current_logical_file
      us << log_fl.users
      us << us.map(_proc (id)
                     _import log_fl
                     >> log_fl.user_details(id)
                 _endproc)
      _if write?
      _then
            _for u _over us.fast_elements()
            _loop
                  write(u)
            _endloop
      _endif
     
>> us
_endproc
$

segunda-feira, 29 de agosto de 2011

Forums & Blogs

Forums

GESmallworld.org BLOG

This forum is part of the gesmallworld.org wiki. Please feel free to add your own blogs here.

Yahoo: SW-GIS

The sw-gis list provides a forum for developers and system administrators working with Smallworld GIS. This list addresses technical issues concerning Smallworld GIS, such as Magik programming, CASE tool, interfacing to other systems, but also system and database administration.

Yahoo: SW-GIS-ANNOUNCE

This list is for general announcements related to Smallworld GIS or other Smallworld related products or applications. Acceptable announcements include:

  • New Smallworld-related products or new releases of existing products
  • Smallworld related job openings
  • New Smallworld partner companies or new offices of existing Smallworld partner companies

For some reason, this group is listed as an adult content. Whoever is the moderator of the group should fix that.

Yahoo: SW-GIS-USERS

This list provides a forum for users of Smallworld GIS and other Smallworld related applications to share information and knowledge about the use and configuration of those products and applications.

This appears to be inactive, as the only postings this year are SPAM.

Social Networks

Twitter

Follow Smallworld information on Twitter using the search hash tag of #swgis. And for when you are at conferences use #swuc.

Blogs

Alfred Sawatzky

Alfred has a large blog site that discusses many aspects of Smallworld.

Other areas of interest…

A posting from http://tech.groups.yahoo.com/group/sw-gis
Re: Small World Tutorials

There are a limited number of web resources, but some of these websites do have good information.

This wiki article gives a good overview.
http://en.wikipedia.org/wiki/Magik_(programming_language)

There are a few basic tricks on Bill Wright's old (2005) blog. It's dead, but the code is still valid.
http://www.billwrightenterprises.com/professional/Magik/magik_blogger.html

Charlie Savage has posted the old Smallworld Technical Papers on his blog. Tech paper number 5 is on Magik Programming.
http://cfis.savagexi.com/pages/technical_papers

Alfred Sawatzky has an active blog on Magik programming, but it is for more advanced programmers. Lots of good information, but it can overwhelm a beginner.
http://sworldwatch.blogspot.com/

If you are hands on, you can rip apart some source code from SourceForge and see the inner workings of some excellent open source projects. There are lots of great things to download from here.
http://sourceforge.net/projects/magikcmpnts/

Christian Taton's blog is geared toward beginning Magik programmers. It doesn't have a lot of content yet, but it is alive and it should be good for learning Magik from the beginning.
http://magiktricks.thetatons.com/

Tim Minto has some source code projects available to dissect on his site.
http://www3.telus.net/tminto/downloads.html

There are some good tools for Magik programmers found on the Magik IDE - MDT Magik Development Tools website.
http://www.mdt-project.net/

There aren't many Magik programming resources out there, but hopefully some of these will help you. You will also find this Yahoo group to be great at answering specific questions. Read the archives before posting because it annoys everybody to answer the same question multiple times, and ask specific questions with detail and you will often get a timely and effective response.

Good luck learning Magik and welcome to the community.

-Christain Taton

Fonte: http://sw-gis.wikidot.com/forums-blogs

Related Posts Plugin for WordPress, Blogger...