JohnOne Posted February 25, 2015 Posted February 25, 2015 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.
amar3181 Posted February 25, 2015 Author Posted February 25, 2015 Any we we can automate this part in Autoit itself by pressing tab.. enter.... I observed Alt+y accepts directly... Any way we can pass that as parameter?
amar3181 Posted February 25, 2015 Author Posted February 25, 2015 If we hide GUI (SW_HIDE) I see the Send command for Tab or enter does not work as expected.Any idea on how to hardcode the default selection and proceed to next screen as request in my code in previous posts
JohnOne Posted February 25, 2015 Posted February 25, 2015 Without something to work with as said in previous posts it's pointless, time wasting. I can go as far as suggest ControlSend() AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
TheSaint Posted February 25, 2015 Posted February 25, 2015 (edited) 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 February 25, 2015 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)
amar3181 Posted February 25, 2015 Author Posted February 25, 2015 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.
amar3181 Posted February 25, 2015 Author Posted February 25, 2015 Devil Tab things works for me now. But again Since I Have to hide my GUI during install can't go for that option. Back to the same issue.
TheSaint Posted February 25, 2015 Posted February 25, 2015 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)
amar3181 Posted February 25, 2015 Author Posted February 25, 2015 expandcollapse popup#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
TheSaint Posted February 25, 2015 Posted February 25, 2015 (edited) 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 February 25, 2015 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)
amar3181 Posted February 25, 2015 Author Posted February 25, 2015 Wait for a click on "Next" button part is the issues.I just want next to be selected automatically. How can we code this?
TheSaint Posted February 25, 2015 Posted February 25, 2015 (edited) 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 February 25, 2015 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)
zalomalo Posted February 25, 2015 Posted February 25, 2015 You can Send several things / events in every line, also check if put some Sleep(10) when the feeling is recomendable. My english shucks, i know it.
amar3181 Posted February 26, 2015 Author Posted February 26, 2015 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?
orbs Posted February 26, 2015 Posted February 26, 2015 (edited) 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 February 26, 2015 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
amar3181 Posted February 26, 2015 Author Posted February 26, 2015 That crossed my mind too.. But since I am new I am not sure I would be able to remove all GUI and pass parameters directly. My issue would have been resolved lot earlier .
orbs Posted February 26, 2015 Posted February 26, 2015 try it. you wasted enough time trying to click your way through your own GUI. post the pieces of code you have difficulty understanding - hell, post your entire code. how bad can it be? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
amar3181 Posted February 26, 2015 Author Posted February 26, 2015 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.
orbs Posted February 26, 2015 Posted February 26, 2015 (edited) 1) anything else your GUI sets except the language? 2) please post your language.ini file. EDIT: and state what is the desired selection from that list of languages. Edited February 26, 2015 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
Solution orbs Posted February 26, 2015 Solution Posted February 26, 2015 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. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now