Jump to content

GUI via CodeWizard Not Working


Recommended Posts

The code that is shown below, generated by CodeWizard, only works when it is in the preview window. It does NOT work once it is copied in to the destination file.

#Region --- CodeWizard generated code Start ---
;InputBox features: Title=Yes, Prompt=Yes, Default Text=No
If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
$sInputBoxAnswer = InputBox("Lotus Notes Login","Please enter your password." & @CRLF & @CRLF & "Note: Once you enter your password, all other logins will be automatic until you create a new password.",""," ","-1","-1","-1","-1")
Select
Case @Error = 0 ;OK - The string returned is valid

Case @Error = 1 ;The Cancel button was pushed

Case @Error = 3 ;The InputBox failed to open

EndSelect
#EndRegion --- CodeWizard generated code End ---

My plan is to merge it with this code:

Run ("C:\lotus\Notes\notes.exe" )
If Not WinActive("Lotus Notes","") Then WinActivate("Lotus Notes","")
WinWaitActive("Lotus Notes","")
Send("MYPASSWORD{ENTER}")

So once I get the password saved from the initial gui, it will be saved and called upon later. But one step at a time...Lets start off with the gui, shall we?

Thanks.

PS. I am new to this :bye:

Link to comment
Share on other sites

Technically, it isn't creating a GUI per se, it's creating a script to pop up an InputBox.

Something like this might work.

Global $sInputBoxAnswer = InputBox("Lotus Notes Login", "Please enter your password." & @CRLF & @CRLF & "Note: Once you enter your password, all other logins will be automatic until you create a new password.")
Select
    Case @error = 0 ;OK - The string returned is valid
        Run("C:\lotus\Notes\notes.exe")
        If Not WinActive("Lotus Notes", "") Then WinActivate("Lotus Notes", "")
        WinWaitActive("Lotus Notes", "")
        Send($sInputBoxAnswer & "{ENTER}")
    Case @error = 1 ;The Cancel button was pushed

    Case @error = 3 ;The InputBox failed to open

EndSelect

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Technically, it isn't creating a GUI per se, it's creating a script to pop up an InputBox.

Something like this might work.

Global $sInputBoxAnswer = InputBox("Lotus Notes Login", "Please enter your password." & @CRLF & @CRLF & "Note: Once you enter your password, all other logins will be automatic until you create a new password.")
Select
    Case @error = 0 ;OK - The string returned is valid
        Run("C:\lotus\Notes\notes.exe")
        If Not WinActive("Lotus Notes", "") Then WinActivate("Lotus Notes", "")
        WinWaitActive("Lotus Notes", "")
        Send($sInputBoxAnswer & "{ENTER}")
    Case @error = 1 ;The Cancel button was pushed

    Case @error = 3 ;The InputBox failed to open

EndSelect

That worked out well, thank you for your help.

My next goal is to make that popup box appear only one time. So the first time your run the "*.exe" it will ask you for your password, then log you in. Then the next time you run the "*.exe" it should not have to ask you for the password because it saved it from the last time you exectuted the program.

Is this possible without having to write to another file?

Edited by timdecker
Link to comment
Share on other sites

Other than writing something in the registry, there's no other option than having an entry in an external file.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Other than writing something in the registry, there's no other option than having an entry in an external file.

That's what I was afraid of... I was trying to keep this project to 1 file, so people didn't have to have a folder for it. Oh well, it was a good learning experience.

Thanks for your help BrewManNH.

Link to comment
Share on other sites

  • Moderators

Why not do a reg entry as BrewManNH suggested, it is a standard practice. Something like this added to your code should work for you:

#include <Date.au3>

If RegRead("HKCU\Software\MyAutoItApp", "Registered") <> "1" Then
  RegWrite("HKCU\Software\MyAutoItApp", "Registered", "REG_SZ", "1")
  RegWrite("HKCU\Software\MyAutoItApp", "Registered Date", "REG_SZ", _NowDate())
Else
  ;launch application
EndIf

You could include the date entry as I do if you want them to re-authenticate every 30, 60, 90, whatever days.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Why not do a reg entry as BrewManNH suggested, it is a standard practice. Something like this added to your code should work for you:

#include <Date.au3>

If RegRead("HKCU\Software\MyAutoItApp", "Registered") <> "1" Then
RegWrite("HKCU\Software\MyAutoItApp", "Registered", "REG_SZ", "1")
RegWrite("HKCU\Software\MyAutoItApp", "Registered Date", "REG_SZ", _NowDate())
Else
;launch application
EndIf

You could include the date entry as I do if you want them to re-authenticate every 30, 60, 90, whatever days.

What the hell....I'll give it a try :thumbsup: . Why not try and learn anyways right? I'll post back around 1-2PM ctd with current status and plenty of questions. Thanks for the guidance JLogan3o13 & BrewManNH!

I have meetings until lunch, so I'll give it a whack aftwards.

Thanks again!

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...