program ili skripta koja automatski unosi login podatke

Discussion in 'Operativni sistemi, aplikacije i programiranje' started by dmr, Jun 19, 2016.

  1. selvin

    selvin Moderator

    Evo probaj ovo, samo zamijeni ovo selvin-desktop sa svojim imenom racunara. Update sam sa do-while sad.

    Code:
    Dim wshShell
     ' Set up the shell
     Set wshShell = WScript.CreateObject( "WScript.Shell" )
     ' Run the application (extra "s are in case path has spaces)
     wshShell.Run """G:\Program Files (x86)\Origin\Origin.exe"""
    
    Do
     WScript.Sleep 1000
    Loop While Not IsProcessRunning("selvin-desktop", "Origin.exe")
    
    wshshell.AppActivate "G:\Program Files (x86)\Origin\Origin.exe"
    WshShell.SendKeys "{TAB}"
    WshShell.SendKeys "username"
    WshShell.SendKeys "{TAB}"
    WshShell.SendKeys "pass"
    WshShell.SendKeys "{ENTER}"
     
     Function IsProcessRunning( strComputer, strProcess )
        Dim Process, strObject
        IsProcessRunning = False
        strObject   = "winmgmts://" & strComputer
        For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
        If UCase( Process.name ) = UCase( strProcess ) Then
            IsProcessRunning = True
            Exit Function
        End If
        Next
    End Function
     
  2. dmr

    dmr Veteran foruma

    ne moze izbaci type mismatch gresku u liniji IsProcessRunning("dmr-PC", "Origin.exe") kada izbacim navodnike izbaci object required Origin
     
  3. selvin

    selvin Moderator

    Nisi kopirao ovo sve gore sto sam naveo. To znaci da ti fali funkcija IsProcessRunning. Odradi select all dole do kraja i kopiraj sve u neki vbs fajl.
     
  4. dmr

    dmr Veteran foruma

    nisam vidio dio koda ispod :D Medjutim nista samo starta origin i tu stoji
     
  5. selvin

    selvin Moderator

    Mozda nije origin.exe ime procesa? Ja sam probao sa notepad.exe i radi.
     
  6. dmr

    dmr Veteran foruma

    Probo sam i ja na notepad i radi, ne znam zasto zaglavi na originu. Koji ce biti drugi proces?

    EDIT u task manageru pise proces Origin.exe *32 Pa sam pokusao i taj naziv ali nece

    EDIT2: Uglavnom nece da izadje iz petlje jer sam pokuso ispod staviti 6 sekundi, misleci da ispise login podatke prije, medjutim nista opet.
     
  7. selvin

    selvin Moderator

    Evo update-ovana verzija, zezalo je jer app ne dodje odmah u focus nakon sto bude u listi procesa, to sam fix sa jos jednom petljom, s tim da sam obje stavio da se vrte na 200ms, mozemo to i smanjit. Drugi problem je sto kad se starta origin, prije nego sto se pojavi login forma, ima onaj svoj loader (dodao sam onih 3000ms, to mozda mozes smanjtii ako ti se prije loader ucita, mozda zavisi od interneta?). Ako tokom loadera pocnes zvati sendkeys, nece ukucati. I bio je jedan viska {TAB} poslan ispred username-a, barem kod mene, pa sam ga izbrisao.

    Code:
    Dim wshShell
     ' Set up the shell
     Set wshShell = WScript.CreateObject( "WScript.Shell" )
     ' Run the application (extra "s are in case path has spaces)
     wshShell.Run """C:\Program Files (x86)\Origin\Origin.exe"""
    
    Do
     WScript.Sleep 200
    Loop While Not IsProcessRunning("dmr-PC", "Origin.exe")
    
    While Not Wshshell.AppActivate("Origin")
    	WScript.Sleep 200
    Wend
    
    WScript.Sleep 3000
    WshShell.SendKeys "username"
    WshShell.SendKeys "{TAB}"
    WshShell.SendKeys "pass"
    WshShell.SendKeys "{ENTER}"
    
    Function IsProcessRunning( strComputer, strProcess )
        Dim Process, strObject
        IsProcessRunning = False
        strObject   = "winmgmts://" & strComputer
        For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
        If UCase( Process.name ) = UCase( strProcess ) Then
            IsProcessRunning = True
            Exit Function
        End If
        Next
    End Function
     
  8. dmr

    dmr Veteran foruma

    wtf? Sad prodje samo pola username-a, pass i ne prodje. A prvi tab kod mene mora biti inace mi upise samo password.

    EDIT: Evo prodje sad prvi puta, jos da probam kada hdd ode u sleep :D

    EDI2: Opet samo prodje pola usernam-a i tu stane :(
     
  9. dmr

    dmr Veteran foruma

    Evo ga sad sve radi, trebala je mala pauza izmedju username i passa, konacni kod izgleda ovako. Hvala Selvine puno!!!! :D Jos da probam kad hdd ode u sleep

    EDIT: Hdd otisao u sleep, trebalo je originu da starta 10tak sekundi, sve proslo uredno, svaka cast Selvine :D

    Code:
    Dim wshShell
     ' Set up the shell
     Set wshShell = WScript.CreateObject( "WScript.Shell" )
     ' Run the application (extra "s are in case path has spaces)
     wshShell.Run """g:\Program Files (x86)\Origin\Origin.exe"""
    
    Do
     WScript.Sleep 100
    Loop While Not IsProcessRunning("dmr-PC", "Origin.exe")
    
    While Not Wshshell.AppActivate("Origin")
       WScript.Sleep 100
    Wend
    
    WScript.Sleep 1000
    WshShell.SendKeys "{TAB}"
    WshShell.SendKeys "username"
    WScript.Sleep 100
    WshShell.SendKeys "{TAB}"
    WshShell.SendKeys "pass"
    WshShell.SendKeys "{ENTER}"
    
    Function IsProcessRunning( strComputer, strProcess )
        Dim Process, strObject
        IsProcessRunning = False
        strObject   = "winmgmts://" & strComputer
        For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
        If UCase( Process.name ) = UCase( strProcess ) Then
            IsProcessRunning = True
            Exit Function
        End If
        Next
    End Function
     
  10. selvin

    selvin Moderator

    E super, drago mi je da je rijeseno :)