Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all 12506 articles
Browse latest View live

How can I see HTMLayout controls using AutoIT Window Info?

$
0
0
Hello Guys,


I am new in AutoIT scripting. I find it very cool, efficient and time saving. I am a QA Engineer trying to automate most of the routine tasks I run on a daily basis. The company I work with is using HTMLayout for building the GUI for their software, thus my problem. I was only able to automate tasks based on mouse coords like:

MouseClick("left", 120, 127)


I would very much like to know if it possible to somehow see the controls on HTMLayout GUIs, the text and the hidden text using AutoIT Window Info and use them in my scripts. e.g. click a button instead of clicking on the mouse coords of that button.

At the moment, if I drag and drop the finder tool over my form I only get the title and the class name. No controls, no text.

>>>> Window <<<<
Title: Dashboard
Class: securitydashboard
Position: 580, 265
Size: 760, 510
Style: 0x960A000C
ExStyle: 0x00050000
Handle: 0x00000000000806FC
>>>> Control <<<<
Class:
Instance:
ClassnameNN:
Name:
Advanced (Class):
ID:
Text:
Position:
Size:
ControlClick Coords:
Style:
ExStyle:
Handle:
>>>> Mouse <<<<
Position: 1303, 280
Cursor ID: 0
Color: 0xFEFEFE
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<
>>>> Hidden Text <<<<


Thank you for your help! It is much appreciated.

Andrei

Calculating Nearest Sunday

$
0
0
Hello all,

How to calculate the nearest Sunday?
  • 2012/12/30 (Previous Sunday)
  • 2013/01/03(Today)
  • 2013/01/06(Coming Sunday)
Here considering today's date(2013/01/03) the nearest Sunday is coming Sunday(2013/01/06)

How to achieve this using AutoIt? any function close to this?

Thanks

Script required to run the standalone tool

$
0
0
Hello Every one,

I have the stand alone tool called "MH.exe".

Batch script for eg: but is not work for automatic press ok or enter button

CD%\MH.exe
MH.exe >enter
del "%CD%\MH.exe"
del /s /ah "%CD%\MH.41.exe"


My query is,

1. I need the script to call the MH.exe tool to run
2. once MH.exe have run it will pop up
3. while it popup, needs to Press ok button automaticaly to proceed
4.finally delete the MH.exe tool from the location

Thanks

work with cmd

$
0
0
Excuse if I write not there and with mistakes I don't know the English I write through the translator.
Prompt where it is possible to download cmd library
from doesn't work #include with <cmd.au3>. Thanks in advance</cmd.au3>

Need some guidance with a program crashing

$
0
0
This is going to be like finding a needle in a haystack but you have to start somewhere. I have written a program that runs in the background 24/7 whenever the computer is on. No GUI involved. It is in an infinite loop monitoring for the existance for certain Windows.

   On rare, rare occassion it crashes with the "Autoit has encountered a problem and needs to close". I think it use to be called a GPF. It doesn't happen often enough that there is any rhyme or reason to it. I cannot recreat the crash. Jupiter aligns with Mars sort of thing.

   I guess I am looking for general guidlines, do' and dont's, suggestions on things I need to look at. Don't know where to start. Any suggestions?

Catching Errors

$
0
0
Is there a way to catch errors in AutoIt? SImilar to java's "Try-Catch" methods?
My program keeps on throwing errors and I need them to just go away, my program works fine, other than these errors.

Here's my code:
[ autoit ]         
#NoTrayIcon #include #include #include #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #Obfuscator_Parameters=/cs /cf #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;Opt("TrayMenuMode",1) ;$menu = TrayCreateItem("DriveLocker") ;$menu2 = TrayCreateItem("") ;$menuLock = TrayCreateItem("Lock Drive") ;TraySetState() HotKeySet("{F9}", "_LockDrive") HotKeySet("{PAUSE}", "_Switch") $running = True While 1 While ($running) $letter = DriveGetDrive("REMOVABLE") If IsArray($letter) Then For $i = 1 to $letter[0] _Check($letter[$i]) Next EndIf $time = TimerInit() While TimerDiff($time) < 10000 If IsArray($letter) Then For $i = 1 to $letter[0] _Check($letter[$i]) Next EndIf Sleep(100) WEnd WEnd Sleep(10*1000) WEnd Func _Switch() If ($running) Then $running = False Else $running = True EndIf EndFunc Func _Check($strDriveLetter) If ($running) Then If FileExists($strDriveLetter & "\AutoIt3\Locker\IAmLocked") Then _Unlock($strDriveLetter) ElseIf FileExists($strDriveLetter & "\lock.txt") Then _Unlock($strDriveLetter) EndIf EndIf EndFunc Func _Unlock($strDriveLetter) If ($running) Then $strPassword = InputBox("Security Check", "Enter your password.", "", "*", "", "", @DesktopWidth/2, @DesktopHeight/2,8, "passwordBox") ToolTip("Enter Password NOW.") _MouseTrap(@DesktopWidth, @DesktopHeight-100) If ($strPassword = "PASSWORD") Then _MouseTrap() ToolTip("") FileDelete($strDriveLetter & "\AutoIt3\Locker\IAmLocked") FileDelete($strDriveLetter & "\lock.txt") _ReAnimate($strDriveLetter) ElseIf ($strPassword = "PASSWORDFAILSAFE") Then _MouseTrap() ToolTip("") FileDelete($strDriveLetter & "\AutoIt3\Locker\IAmLocked") FileDelete($strDriveLetter & "\lock.txt") _ReAnimate($strDriveLetter) Else EjectVolume($strDriveLetter) ToolTip("") _MouseTrap() EndIf EndIf EndFunc Func _ReAnimate($strDriveLetter) ;Run(StringUpper($letter[$i]) & "\") ;Run(StringUpper($letter[$i]) & "\new.txt.lnk") ;Run(StringUpper($letter[$i]) & "\you.lnk") ;WinClose("AutoPlay") ;ProcessClose("mcagent.exe") EndFunc Func _LockDrive() $letter = DriveGetDrive("REMOVABLE") If IsArray($letter) Then For $i = 1 To $letter[0] If MsgBox(36,"Lock This Drive?","Do you wish to lock the " & StringUpper($letter[$i]) & " drive?") = 6 Then FileWrite($letter[$i] & "\AutoIt3\Locker\IAmLocked","Locked") _FileCreate($letter[$i] & "\lock.txt") ;EjectVolume($letter[$i]) EndIf Next EndIf EndFunc

help with quotes

$
0
0
i am inserting values from a text file into a sqlite database.

first i create the array then cycle through each array record and insert it into a sql table.

[ autoit ]      
For $y = 0 To UBound($avOut) - 1      $aTemp[0] = "'" & $avOut[$y][0] & "'"         $aTemp[1] = "'" & $avOut[$y][1] & "'"         $aTemp[3] = "'" & $avOut[$y][3] & "'"         $sTemp = $aTemp[0] & "," & $aTemp[1] & "," & $aTemp[3]         _SQLite_Exec(-1, "INSERT INTO aAssetInfo (Tag,Status,Type) VALUES (" & $sTemp & ");") Next

the problem i am running into is when a data field has a single quote, then that record is not inserted.  how should i specify the quotes here
[ autoit ]      
"'" & $avOut[$y][0] & "'"
to get around that?

thanks in advance!

GuiCtrlSetStyle()


Problem with MouseClick

$
0
0
I'm trying to run a very simple and straight forward script. I know 100% MouseClick is the problem. But, I'm unsure what exactly might be causing the issue. I'm trying to click inside of a fullscreen DirectX game. I know all of the code prior works because i've tried to use other methods (clicking at the center of the screen, at the bottom left, even dragging the click just to see if it would continuously click), and these worked except for the actual clicking. The odd thing is, It IS working. Lets say i'm holding my left click down, when the PixelSearch sees the right color, It will stop my continuous click but will not click on its own. This is a script that worked around 3 months ago with no problems on this very PC. I haven't changed anything with my mouse, and the only recent notable change is my second monitor. The major change was the update to Win7 SP1, but i'm not sure if that's what is causing the problem.

#RequireAdmin
while 1 = 1
If IsArray(PixelSearch(475, 425, 540, 440, 15878672, 10)) Then
Sleep(15)
MouseClick("left")
EndIf
WEnd

I need to manipulate some text.

$
0
0
I need to know if there is a way to manipulate some text that I copied from a webpage. I thought maybe there was a way with Excel, but I figured I'd learn something with Autoit in the process.

http://cheats.codetwink.com/ps2/view/4521/2/

Basically if you copy the description and code from that webpage and paste it into notepad it becomes something like:

blah blah blah xxxxxxxx xxxxxxxx
yyyyyyyy yyyyyyyy

But I need it to be formatted such as below:

blah blah blah
xxxxxxxx xxxxxxxx
yyyyyyyy yyyyyyyy

Or sometimes it may be like this:

blah blah blah xxxxxxxx xxxxxxxx
yyyyyyyy yyyyyyyy
zzzzzzzz zzzzzzzz

But ultimately it still needs to be like this:

blah blah blah
xxxxxxxx xxxxxxxx
yyyyyyyy yyyyyyyy
zzzzzzzz zzzzzzzz


Essentially, if you notice, all that needs to be done is to do a line break before the X's and everything else will appear to be good to go.

If you have a different method that may be easier, that doesn't require pasting to notepad or anything, then feel free to do it your way instead of mine.

Raw Byte Access to Removable Drive

$
0
0
I'm trying to read raw bytes from a removable drive using the WinAPI functions (_WinAPI_CreateFile, _WinAPI_SetFilePointer, _WinAPI_ReadFile).
Here is the MSDN reference for CreateFile and ReadFile.

My removable drive is mounted at Z:. (But for testing you can probably used a fixed drive like C:. It gives me the same results.)

After some trial and error, I was able to get the CreateFile function to return a (seemingly) valid handle. It seems to work correctly if I enter the drive like this: "\\.\Z:", provided that the share mode includes read/write. (If I don't set the share mode like that, then the returned handle is zero for some reason.) Entering "\\.\PhysicalDrive2" also seems to work, and is also a little more lenient on the share mode.

The problem is that when I pass it to the ReadFile function, it reports zero bytes read and the data seems to be just zeros.
Any ideas?

[ autoit ]         
#RequireAdmin #AutoIt3Wrapper_UseX64=n #include <WinAPI.au3> $sFileName = "\\.\C:"; $iCreation = 2; OPEN_EXISTING $iAccess = 2; GENERIC_READ $iShare = 2+4; FILE_SHARE_READ + FILE_SHARE_WRITE $hFile = _WinAPI_CreateFile($sFileName, $iCreation, $iAccess, $iShare) If @error Or $hFile = Ptr(0) Then $str = "Could not open file "&$sfilename&@CRLF $str &= "Error: "&@error&@CRLF $str &= "Handle: "&$hFile MsgBox(0,"Error: _WinAPI_CreateFile",$str) Exit EndIf MsgBox(0,"Success: _WinAPI_CreateFile ","Handle: "&$hFile) _WinAPI_SetFilePointer($hFile,0); Beginning of file If @error Then MsgBox(0,"Error: _WinAPI_SetFilePointer",StringFormat("Could not move pointer. (Error %d)\n",@error)) EndIf Global $nBytesReceived $tBuffer = DllStructCreate("byte[512]") _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer,1), 512, $nBytesReceived) If @error Then MsgBox(0,"Error: _WinAPI_ReadFile",StringFormat("Could not read file. (Error %d)\n",@error)) EndIf If $nBytesReceived<512 Then MsgBox(0,"Error: _WinAPI_ReadFile",StringFormat("Only %d bytes read.\n",$nBytesReceived)) Else MsgBox(0,"Success: _WinAPI_ReadFile",StringFormat("Read %d bytes.\n",$nBytesReceived)) EndIf _WinAPI_CloseHandle($hFile) $sText = Hex(DllStructGetData($tBuffer,1,1),2);Just the first byte MsgBox(0,"Result",$sText)

Wierd MouseMove problem

$
0
0
Hi.

I'm trying to do small app for my online playing on the net and I want to move the mouse.

If I do this in a normal window, I don't have any problems, but if I do it in fullscreen it dosen't work.

Is it because it is MacromediaFlashplayer?

Can anyone help me why it dose not work?

Sleep(10000)
MouseMove(10, 100)
MouseMove(700, 700, 0)

Attached Thumbnails

  • Mousemove.jpg

_IsPressed situation

$
0
0
Hi, this searches only for CTRL but ALT, also activates it, if i change the number to 12 (ALT) it works, and CTRL doesn't activate it!
So this means there is a problem, when i use ispressed 11. Can anyone verify this?

[ autoit ]      
;ALT = 12 ;CTRL = 11 #include $dll = DllOpen("user32.dll") Do Sleep(50) If _IsPressed("11", $dll) Then TrayTip('Info', 'Key Pressed', 1) Sleep(1000) TrayTip('','',1) EndIf Until $dll = 123 DllClose($dll)

Script always returns a 0 value

$
0
0
Hello fellow members,

Today I finally took the time to get into memory reading using AutoIT, but for some reason I keep getting a 0 value as result.

Since I thought I probably did something wrong I decided to watch a tutorial and did exactly what the guy in the video did, but I kept getting the 0 value.

I'm actually starting to believe that it's OS related, since I use windows 8.

This is the script I tried:

[ autoit ]      
#include <NomadMemory.au3> ;because you need this for _memread functions $Address = 0x00690380 Dim $Offset[2] = [0, 0x0] while 1 $Process = _MemoryOpen(ProcessExists('Tutorial-i386.exe')) If Not @error Then $Value = _MemoryPointerRead($Address, $Process, $Offset) If Not @error Then ToolTip($Value[1],0,0) _MemoryClose($Process) EndIf Sleep(100) WEnd

If anyone experienced the same issue and found a fix for this I would really appreciate if you could share it :D

Thanks in advance,

Vee

restarting script

$
0
0
hello everyone , it's my first post because i use the program from 1 hour and want to learn more

so i need to do a simple bot like some click steps . i do it but i need it to replay after time like 5 min this is my code

MouseClick("left",750,715,1)
Sleep(2000)
MouseClick("left",525,550,1)
Sleep(2000)
MouseClick("left",525,590,1)
Sleep(2000)
MouseClick("left",499,570,1)
Sleep(2000)
MouseClick("left",700,375,1)
Sleep(2000)
MouseClick("left",550,400,1)
Sleep(2000)
MouseClick("left",700,400,1)
Sleep(2000)
MouseClick("left",350,400,1)
Sleep(2000)
MouseClick("left",750,710,1)
Sleep(2000)
MouseClick("left",700,325,1)
Sleep(2000)



Making my program Appear in middle of the screen

$
0
0
hi every one sorry for this stupid question I've just finished my first autoit program which is working properly
the only problem is that whenever i run my program it appear near to top right corner, first i thought that it will happen only on my computer, but when i tried it on other computers it appeared on the same location as mine how can i make it appear in middle of the screen

PS: Sorry for my bad english

WinWait function

$
0
0
Can some one tell me what is the default timeout value for  WinWait function

How do you detect a docking station

$
0
0
I am starting to play with laptops and one very critical piece of information I need to determine is whether or not the laptop is docked in a docking station or not. Didn't find much on the form with respect to it. Can anyone give me some input?

Windows installation serial

$
0
0
Hello all


Does any one knows hot to insert windows instalation serial number after windows setp with autoit?

Something similar to Pix.Search but for Picture...

$
0
0
Hello,
the question s simple:

Is here any command or any way to scan screen region for more than just one pixel?
Because in many situations the same colored pixel may be used more than once at that particular region and the whole "search" tend to be wrong.
I would need something like a "group of differently colored pixels" seach...
Well, can anybody help me out?
Thanks ~
Viewing all 12506 articles
Browse latest View live