Jump to content

Removing all GUI functions


Go to solution Solved by orbs,

Recommended Posts

UAC is a windows security measure, and indicates that what you are attempting requires administrative rights.

There are two options I know of.

1. The user must allow by interacting with UAC

2. Turn off UAC in script, the user must also allow this via interaction

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to post
Share on other sites
  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

This will not really Help you achieve what you want, but it will help simplify.

Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")

can be better achieved by

Send("{TAB 4}")

Testing for Window existence, with timeouts and making active, also helps a lot.

Use of a simple MsgBox to check on things or report errors is required when troubleshooting.

You can also write values to a test INI file, to avoid focus issues of a MsgBox.

P.S. I have forgotten whether you are aware of or have used the Window Info program (tool)?

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to post
Share on other sites

John here is the piece of code as requested for better understanding

 

---------------------------------------

#Region ### START Koda GUI section ### Form=q:1_clientsmorphomorphosecureinstall_lang.kxf
$install_lang = GUICreate("MorphoSecurePC", 615, 438, -1, -1)
GUISetBkColor(0xFFFFFF)
$Logo01 = GUICtrlCreatePic($PathSrc&"Imglogo01.jpg", 56, 32, 500, 196)
$lang_install = GUICtrlCreateCombo("", 128, 280, 361, 30, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetFont(-1, 12, 800, 0, "Arial Black")
GUICtrlSetColor(-1, 0x646464)
$Next_lang = GUICtrlCreateButton("Next >>", 496, 392, 107, 33)
$version = GUICtrlCreateLabel("v "&IniRead($PathSrc&"config.ini", "Global", "version", "0"), 576, 8, 37, 17)
GUISetState(@SW_SHOW, $install_lang)
#EndRegion ### END Koda GUI section ###
 
 
; Get all languages onto language.ini
$LanguageList = ""
;MsgBox(0, "", $PathSrc&"language.ini")
Local $VarLangList = IniReadSectionNames($PathSrc&"language.ini")
If @error Then
Logger("INI Language : ERROR : Cannot find the language.ini file.")
ErrorAndExit("Language File")
Else
For $i = 1 To $VarLangList[0]
$LanguageList = $LanguageList & $VarLangList[$i] & "|"
Next
$LanguageList = StringLeft($LanguageList, StringLen($LanguageList)-1)
EndIf
GUICtrlSetData($lang_install, $LanguageList, "English")
 
 
; Wait for a click on "Next" button
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Next_lang
GUISetState(@SW_HIDE, $install_lang)
;OsType()
Global $My_Language = GUICtrlRead($lang_install)
ExitLoop
EndSwitch
WEnd
 
------------------------
 
GUI is created
Options are loaded from ini
Waiting for selection to be made and press next.
Link to post
Share on other sites

Life would be so much easier for all of us, if you use the AutoIt forum code tags. See here.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to post
Share on other sites

#Region ### START Koda GUI section ### Form=q:\1_clients\morpho\morphosecure\install_lang.kxf
$install_lang = GUICreate("MorphoSecurePC", 615, 438, -1, -1)
GUISetBkColor(0xFFFFFF)
$Logo01 = GUICtrlCreatePic($PathSrc&"Img\logo01.jpg", 56, 32, 500, 196)
$lang_install = GUICtrlCreateCombo("", 128, 280, 361, 30, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetFont(-1, 12, 800, 0, "Arial Black")
GUICtrlSetColor(-1, 0x646464)
$Next_lang = GUICtrlCreateButton("Next >>", 496, 392, 107, 33)
$version = GUICtrlCreateLabel("v "&IniRead($PathSrc&"config.ini", "Global", "version", "0"), 576, 8, 37, 17)
GUISetState(@SW_SHOW, $install_lang)
#EndRegion ### END Koda GUI section ###
 
 
; Get all languages onto language.ini
$LanguageList = ""
;MsgBox(0, "", $PathSrc&"language.ini")
Local $VarLangList = IniReadSectionNames($PathSrc&"language.ini")
If @error Then
Logger("INI Language : ERROR : Cannot find the language.ini file.")
ErrorAndExit("Language File")
Else
For $i = 1 To $VarLangList[0]
$LanguageList = $LanguageList & $VarLangList[$i] & "|"
Next
$LanguageList = StringLeft($LanguageList, StringLen($LanguageList)-1)
EndIf
GUICtrlSetData($lang_install, $LanguageList, "English")
 
 
; Wait for a click on "Next" button
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Next_lang
GUISetState(@SW_HIDE, $install_lang)
;OsType()
Global $My_Language = GUICtrlRead($lang_install)
ExitLoop
EndSwitch
WEnd

Link to post
Share on other sites

Indents using five spaces, helps too.

I cannot see too much wrong with the code.

One thing though, is the repeated declaration of Global in your Case statement. You should only declare it once, and the recommended location, is at the top/start of your script. You can assign a value to it any time.

It would also help, if you gave another explanation, just under the code, of what it is precisely that you want to do (saves us having to scroll up and down and between pages). Never hurts to reassess and rewrite in any case. Doing it using steps is best.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to post
Share on other sites

Basically you just need to modify the second lot of code, and ignore the first and third portions.

Your For...Next loop, instead of populating the Combo could be used to get each language, which then uses (works with) the other code you have not shown, using a call to a function of such.

If you do that, then you can throw away the GUI code altogether.

i.e.

For $i = 1 To $VarLangList[0]
     $Language = $VarLangList[$i]
     ProcessLanguageFunction()
Next

Func ProcessLanguageFunction()
     ; processing code goes here working with the $Language value
EndFunc
Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to post
Share on other sites

Well the defaults are already shown so even dropdown has more values it's not a concern.

For below code where we need to wait for an event which is the mouse click on next. I need to automatically have next selected in say a couple of seconds.

; Wait for a click on "Next" button
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Next_lang
GUISetState(@SW_HIDE, $install_lang)
;OsType()
Global $My_Language = GUICtrlRead($lang_install)
ExitLoop
EndSwitch
WEnd

I just need to remove this and add delay along with automatic selection of next. How Can I achieve this?

Link to post
Share on other sites

how about take a completely different approach to this:

1) see which variables store the results of the user selection at the GUI.

2) see how these variables are handled later.

3) delete everything GUI, and feed the values you want directly to the variables (1) or directly to the piece of code that handles them (2).

Edited by orbs
Link to post
Share on other sites

Exe or ini it references not included but the code is complete.

Objective - Just get rid of GUI and automate the next selection at each interface with default values already selected. No other changes required. Just hide GUI and automate the click of next at each selection.

Link to post
Share on other sites
  • Solution

go to everywhere this line appears:

$nMsg = GUIGetMsg()

and change it to this:

$nMsg=$Next

except in line 90 (or so), where it should be this:

$nMsg=$Next_lang

meaning: instead of waiting for the user to click, you force the selection you want.

 

if this works, you can later disable the showing of the GUI. look for this:

GUISetState(@SW_SHOW,

and wherever you find it, comment it out.

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...