autoit

Can I make _Assert write to console instead of a message box?

邮差的信 提交于 2019-12-11 13:12:36
问题 I am writing a script in AutoIt to test a windows application, and I am using the _Assert function to verify certain actions. In the documentation I found there is a parameter to say whether or not the script should end if an assertion fails, which is great because in some cases I would like the script to continue, but unfortunately it is still halted by a message box. Can I override the _Assert function somehow to only print to the console when certain assertions fail, so the script can

How to convert text lines to variables?

て烟熏妆下的殇ゞ 提交于 2019-12-11 12:35:19
问题 Check out this list. I need each one turned into a variable and set equal to 0. Example: ;1-Methyoxy-2-Propanol would be: $OneMethoxyTwoPropanol = 0 ;and 1,2-BUTADIENE would be: $OneTwoButadiene = 0 Assigning them to a variable wouldn't be a problem, but there are 1500 of them. 回答1: If i had to do this work i'll make it this way : I'll change the case of each word : Regex to change to sentence case Make a "SearchAndReplace" : 1 -> One 2 -> Two ... {underscore} -> '' {space} -> '' ... Then in

Installing Unsigned drivers

99封情书 提交于 2019-12-11 11:54:26
问题 I am trying to automate some stuff where I am installing certain drivers. However as the drivers are unsigned I am seeing attached security dialogue. I want to automate and click "Install" or "Don't Install" on the security dialog. Till now I have tried certain options like pywinauto, WASP and AutoIt but nothing seemed to work. Below are the options I have tried so far: WASP Select-Window -title "Windows Security"| Set-WindowActive | Send-Keys "%n" Select-Window -title "Windows Security | Set

Is there an escaping character (when using double-quotes in string declarations)?

给你一囗甜甜゛ 提交于 2019-12-11 10:28:50
问题 This is the code I'm running: RunWait("ComSpec & " /c Start 'D:\Program Files (x86)\Pidgin\pidgin.exe'") I have also tried without semiquotes and with quotes but then I get syntax errors. 回答1: The problem is that the file path on your computer has spaces in it and needs double-quotations around it. Try "D:\Program Files (x86)\Pidgin\pidgin.exe" from the command prompt with the double-quotations and make sure the program starts. Once you know it works you can add it to your AutoIt code like so

Scrolling an element on a web page to take screenshots

梦想与她 提交于 2019-12-11 10:23:29
问题 I want to automate scrolling and taking screenshots of a mobile site. The page itself is not scrollable, so $oIE.document.parentwindow.scroll doesn't work. I don't know how to scroll an element on that page (which contains the content I want to take screenshots of). $oIE = _IECreate($page_likers_url) While Not (IsObj($oIE)) Sleep(1000) $oIE = _IECreate($page_likers_url) WEnd While $oIE.ReadyState <> 4 Sleep(1000) WEnd $LastHeight = $oIE.document.body.scrollHeight $Flag = True $Times = 0 While

convert clipboard to keystroke

こ雲淡風輕ζ 提交于 2019-12-11 07:01:35
问题 My code : HotKeySet("^v","ClipboardToKeystroke") While 1 WEnd Func ClipboardToKeystroke() Send(ClipGet(),1) EndFunc Unfortunately it doesn't behave like what I expect. For a single line, it works well but for multiple lines it send duplicate of enter. Eg : Original text : This is the 1st line This is the 2nd line After auto keystroke : This is the 1st line This is the 2nd line And one more thing, there is also a problem with the Ctrl key after send the keystroke, it seems the Ctrl key is hold

Create new session using _IECreate()

北城余情 提交于 2019-12-11 06:33:51
问题 I have two AutoIt scripts. Both contain Global $oIE = _IECreate($myUrl, 1) . They create two IE windows for the same URL. In IE, when selecting "new session" from "file" menu, each window gets its own session. But using two different script files at the same time, both windows login to the same account. How can I open every IE window with a new session? 回答1: Sessions relate to each unique iexplore.exe process. Start new instance of iexplore.exe per required session (untested, no error

Add 1D array to existing 2D array

ε祈祈猫儿з 提交于 2019-12-11 04:29:09
问题 I want to merge 1D arrays. How to change below AutoIt script to access elements as a newly generated 2D array? Test script is : #Include <Array.au3> Local $_arr1=["name1","addr1","phone1"] Local $_arr2=["name2","arr2","phone2"] _make2darray($_arr1,$_arr2) Func _make2darray($_arr1,$_arr2) Local $_2darray=[$_arr1,$_arr2] _ArrayDisplay($_2darray) _ArrayDisplay($_2darray[0]) _ArrayDisplay($_2darray[1]) ConsoleWrite($_2darray[0][0]) EndFunc $_2darray output is: Row | Col 0 [0] |{Array} [1] |{Array

is there a way in autoit script to find if current file was included or it is running on its own?

半世苍凉 提交于 2019-12-11 04:26:10
问题 I mean something like get_included_files(); in php or Error().stack; in javascript or $BASH_SOURCE array in bash ? I've only found in macros ( https://www.autoitscript.com/autoit3/docs/macros.htm ) @ScriptFullPath and @ScriptName . 回答1: You can implement the functionality by using a global variable. Say $includeDepth . $includeDepth should be incremented by 1 before any #include and decremented by 1 after it. If $includeDepth is 0 , then the code is not running as part of an #include . For

Send WM_SETTINGCHANGE message to refresh desktop

让人想犯罪 __ 提交于 2019-12-11 04:20:09
问题 I managed to programmatically change my desktop background via this one-liner: DllCall("user32.dll", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $CmdLine[1], "int", 0) … by drag and drop of the desired wallpaper onto the compiled script. I have another program that changes the desktop but for some reason fails to send the WM_SETTINGCHANGE message (I can see the key HKCU\Control Panel\Desktop\Wallpaper getting updated). How can I send this message to trigger a wallpaper refresh?