Jump to content

MMC certificate password paste problem


Recommended Posts

post-16463-1159908032_thumb.jpg

I am working on a AutoIT3 script that installs certificates using the MMC in W XP PRO SP2.

The usercert.p12 file needs a unique password to become active.

Password is generated for every certificate and is not constant. It changes everytime.

My problem is that from the MMC certificate install window I can not paste the password from clipboard.

I have tried CTRL V in all combinations I could find from the online AutoIT3 documentation.

(CTRL V works then pressed manually on the keyboard)

Right mouse click and then paste is not working, seems disabled by design by Microsoft.

Any ideas please?

PS Is there a reghack to enable right mouse click? DS

Link to comment
Share on other sites

Tack Helge :lmao:

Copied your code...nothing happens...nothing get sent to the enter password inputfield.

Verified that clipb contains data.

Will read firther ControlSetText function tomorrow, but first some sleep!

Hei Fredrik.

You might want to check out ControlSetText, which might work. Something like this :

$sTitle = "Guiden Importera certifikat"
$sPassword = ClipGet()

If WinExists($sTitle) Then ControlSetText($sTitle, "", "Edit1", $sPassword)
Link to comment
Share on other sites

I am working on a AutoIT3 script that installs certificates using the MMC in W XP PRO SP2.

Hi Fredrik,

Last week I finished a script which starts the "Certifcate Import Wizard" and imports a certificate. Here is a part of it:

Opt("WinDetectHiddenText", 1)   ; Nescesarry because wizard contains hidden controls
Opt("WinTitleMatchMode", 2) ; Nescesarry for MUI

Const $SleepTime = 200

; Check if import already done
$done = RegRead("HKEY_CURRENT_USER\Software\AKey", "ImportCertificateDone")
If $done <> 1 Then
    $strCertificate = "Your Certfile"
    $strPassword = "YourPassword"
        
    ; Start the Certificate Import Wizard   
    Run("c:\windows\system32\rundll32.exe cryptext.dll,CryptExtAddPFX " & $strCertificaat, "", @SW_HIDE)

    ; Wait until window "Wizard Certificaat importeren" or "Certificate Import Wizard" exists
    WinWait("Certific")

    ; Fill in the Wizard
    ControlFocus("Certific", "", 12324)
    ControlClick("Certific", "", 12324) ; Click Next
    Sleep($SleepTime)
    ControlClick("Certific", "", 12324) ; Click Next
    Sleep($SleepTime)
    ControlSend("Certific", "", 1003, $strPassword) ; Fill in password
    Sleep($SleepTime)
    ControlClick("Certific", "", 12324) ; Click Next
    Sleep($SleepTime)
    ControlClick("Certific", "", 12324) ; Click Next
    Sleep($SleepTime)
    ControlClick("Certific", "", 12325) ; Click Finish
    Sleep($SleepTime)
    ControlClick("Certific", "", 2)     ; Click OK

    RegWrite("HKEY_CURRENT_USER\Software\AKey", "ImportCertificateDone", "REG_DWORD", 1)
EndIf

Hope this helps.

Best regards,

J'tje

Edited by j'tje
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...