Recently Browsing 0 members
No registered users viewing this page.
As I am still finding my feet with AutoIT, I thought that I would do a quick test.
I therefore created some HTML code to create a small yellow non-functioning test button on a web page.
#include <Misc.au3> #include <Msgboxconstants.au3> LOCAL $sPos LOCAL $sColor LOCAL $sYellow = "#FFFF00" While 1 $sPos = MouseGetPos() $sColor = Hex(PixelGetColor($sPos, $sPos)) $sColor = "#" & StringMid($sColor,3) ToolTip($sColor) If (_IsPressed("01") = True) And ($sColor = $sYellow) Then MsgBox (262144,"Found it","X=" & $sPos & " Y=" & $sPos) EndIf Wend The code correctly detects when I click on the button.
However, it also highlights on anything else yellow (e.g. a yellow background) that I click on, not just the button.
I did change the link from "empty" to "www.google.com" and then checked if the current browser URL changed also, thereby indicating that I clicked on a yellow link rather than just a yellow background. That worked fine.
However, as it is about improving my knowledge of AutoIT rather than for a specific project, can anyone think of another way which I could do it?
Detecting a URL change is fine, but I then end up on a new page i.e. www.google.com.
I would like to see if I can do it without changing the size.
is it possible to export only the area "$idOutput" with the TEXT as a PNG?
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Example() Func Example() Local $hGUI = GUICreate("Test", 700, 700, -1, -1) Local $input1 = GUICtrlCreateInput("", 10, 10, 150, 20) Local $idButtonStart = GUICtrlCreateButton("Start", 200, 10, 50, 30) Local $idButtonClear = GUICtrlCreateButton("Clear", 260, 10, 50, 30) Local $idButtonExport = GUICtrlCreateButton("Export", 320, 10, 50, 30) Local $idOutput = GUICtrlCreateLabel("TEXT", 10, 50, 500, 500, BitOR($BS_PUSHLIKE, $SS_CENTER)) GUICtrlSetFont($idOutput, 45, 800, "", "Impact") GUISetState(@SW_SHOW, $hGUI) ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButtonStart $ContentInput1 = GUICtrlRead($input1) GUICtrlSetData($idOutput, $ContentInput1) Case $idButtonClear GUICtrlSetData($input1, "") GUICtrlSetData($idOutput, "") Case $idButtonExport EndSwitch WEnd GUIDelete($hGUI) Exit EndFunc ;==>Example
[SOLVED] Can I run an Autoit script that requires focus and mouse clicks in the background and do work?By nooneclose
Good morning, I have been thinking about trying to make my Autoit script run in the background. I found out today that it is impossible due to the UIA and mouseclick functions that I use. However, while reading other posts about running Autoit scripts in the background I saw a reply mentioning how a script like mine might be able to run on a VM while still giving me the ability to work on my Host OS. Can someone confirm this?
Here is a link to the thread where I saw VM mentioned.
the person who mentioned it was @ViciousXUSMC
Needed a way to store global temporary & permanent information and came up with this.
This is inspired by NodeJS's store and store2 packages, as well as W3 specs' localStorage and sessionStorage, offering multiple ways of usage.
This is not related to any browser's storage, nor will allow you to access or modify browsers storage - although this is possible and not a hard task, this is not what this UDF is intended to do.
This UDF offers functions for temporary storage (that gets cleaned up once the application is shutdown) that is kept on memory using ScriptingDictionary, as well as for permanent storage, that is saved on the harddisk as an encrypted file.
sessionStorage (temporary storage)
It's useful to keep application state and temporary settings accessible by any part of your script (although it could also be done with a global variable, I still prefer this method).
You have multiple ways, at your choice, to:
; add or modify a key sessionStorage("foo", "bar") store("foo", "bar") sessionStorage_set("foo", "bar") sessionStorage_setItem("foo", "bar") ; read a key (returns false if key does not exist) $read = sessionStorage("foo") $read = store("foo") $read = sessionStorage_get("foo") $read = sessionStorage_getItem("foo") ; delete a key sessionStorage_remove("foo") ; delete all keys sessionStorage_clear() sessionStorage_clearAll() localStorage (permanent storage)
It's useful to store user-defined settings.
; initialize ; this is optional, but allows you to control ; how things are going to be saved localStorage_startup([file where you want the settings to be saved], [crypt password]) ; by default, if not supplied, if supplied the "Default" keyword (or if you dont initialize), ; the file will be a random-named file (based on @ScriptFullPath) at user's %APPDATA% ; and the password will also be based on @ScriptFullPath ; you can set only the crypt password if you want: ; localStorage_startup(Default, "mypassword") ; the usage is the same as sessionStorage ; add or modify a key localStorage("foo", "bar") store2("foo", "bar") ; notice the '2' localStorage_set("foo", "bar") localStorage_setItem("foo", "bar") ; read a key (returns false if key does not exist) $read = localStorage("foo") $read = store2("foo") $read = localStorage_get("foo") $read = localStorage_getItem("foo") ; delete a key localStorage_remove("foo") ; delete all keys localStorage_clear() localStorage_clearAll() Download
Hello all ~
I am running an autoit script on Windows 10 inside VMware Workstation 12 Pro version 12.5.2. Technically I am remoting into ESXi which has a Domain Controller (DC), WebServer, FilServer, Windows 10, etc. Using the GUI (i.e. running explorer.exe) I am able to open several different folders successfully. The desktop, documents, USB external all open without issue. The network share opening gives me issues. Whenever I attempt to open \\filserver\users\user\sharedfolder I get the documents folder instead. I understand that the documents folder is the default for explorer. I have also attempted to use the letter drive mapped to the network share (Z:) and receive the same result. When I run this script on Windows 10 alone without the VM or the ESXi I am able to open the network share without problems. I have tried to use the net use command to designate a letter M: to the network share folder prior to running the script. This did not work for me.
One additional avenue I think might work is to use the systreeview321 and _GUICtrlTreeView_FindItem to step through the tree looking for the network share. Once found, double click on it and see if that opens the shared network folder. I can click inside the VM with my mouse on the network share and it opens just fine. Not sure if running up against GUI issues, or permission issues, or what?
Thanks in advance,
This script is a subset of a much larger program, but it illustrates what I am dealing with.