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

ImageSearch.au3 Questions

$
0
0

First of all hi! I been reading this forum for a while and I haven't found the need to register until now. I am completely stuck! I have been reading this thread:
 

http://www.autoitscript.com/forum/topic/148005-imagesearch-usage-explanation/

 

I downloaded those files and dumped them in the following dir

 

C:\Windows  <--- DLL

D:\Program Files (x86)\AutoIt3\Include <--- ImageSearch.au3

 

 

Image: find.png <--- icon on my desktop

My code:

#include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage()     Local $search = _ImageSearch('find.bmp', 0, $x, $y, 0)     If $search = 1 Then         MouseMove($x, $y, 10)     EndIf EndFunc while 1     sleep(200) WEnd

The test.au3 and find.bmp are in the same directory. 

 

Now after running the script I get this error from every function in ImageSearch.au3 

error: missing separator character before keyword.

I'm currently running the latest version of auto-it. Windows 7 Ultimate x64bit. I'm sorry if this has been answered millions of times in the forums. I been using the SEARCH feature success :(


Login form not working propperly.

$
0
0

Okay so im trying to license my script, by doing a login check on my site.

And i had no clue how to do this until i found some old code by another user.

But his thread was closed as "auto logins" aren't allowed.

And this seem to work on some places but not on forums.

 

 

But as im not gonna use this as an "auto" login but as a "client" i guess it's okay?

 

This is the orginal thread i created, where i was asking about how to licese a script.

http://www.autoitscript.com/forum/topic/164295-wondering-licensing/?p=1198234

AutoIt         
#NoTrayIcon #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ComboConstants.au3> #include <Misc.au3> #include <WindowsConstants.au3> #include <NomadMemory.au3> #include <WinApi.au3> #include <SecurityConstants.au3> #include <Security.au3> #include <WinAPIEx.au3> #include <Console.au3> #include <GDIPlus.au3> #include <Crypt.au3> #include <File.au3> #include <IE.au3> #include <InetConstants.au3> #include <EditConstants.au3> #RequireAdmin $Url = 'MY WEBSITE GOES HERE' $Form1 = GUICreate("Login Client Connect Test", 326, 258, 192, 124) GUISetState(@SW_SHOW) $usernamebox = GUICtrlCreateInput("Username", 85, 130, 200, 18) $passwordbox = GUICtrlCreateInput("Pasword", 85, 155, 200, 18, $ES_PASSWORD) $loginbutton = GUICtrlCreateButton("Login", 130, 180, 100, 20) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case $loginbutton             $User = GUICtrlRead($usernamebox)             $Pwd = GUICtrlRead($passwordbox) $test = _IEAutoLogin($Url, $User, $Pwd)     EndSwitch WEnd Func _IEAutoLogin($sUrl, $sUsername, $sPwd)  ;funkey 09.09.09  $oIE = _IECreate($sUrl)  _IEErrorNotify(False)  _IEErrorHandlerRegister()  $oForms = _IEFormGetCollection($oIE)  If @error Then   Return SetError(1, _IEErrorHandlerDeRegister(), $oIE) ;'no forms --> no login'  Else   $Index = 0   For $oForm In $oForms    $oFormElements = _IEFormElementGetCollection($oForm)    If IsObj($oFormElements) Then     $IndexElement = 0     For $oElement In $oFormElements      If $oElement.Type = 'password' Then       $oPwd = _IEFormElementGetObjByName($oForm, $oElement.Name)       _IEFormElementSetValue($oPwd, $sPwd)       For $i = $IndexElement - 1 To 0 Step -1        $oUser = _IEFormElementGetCollection($oForm, $i)        If $oUser.Type = 'text' Then         _IEFormElementSetValue($oUser, $sUsername)         ExitLoop        EndIf       Next       If $oForm.action <> "0" And Not StringInStr($oForm.action, '.php') Then        _IEFormSubmit($oForm, 0)        _IELoadWait($oIE)       Else  ;click        For $i = $IndexElement + 1 To $IndexElement + 10         $oButton = _IEFormElementGetCollection($oForm, $i)         If $oButton.Type = 'submit' Then          _IEAction($oButton, "click")          ExitLoop         EndIf        Next       EndIf       Return SetExtended(_IEErrorHandlerDeRegister(), $oIE)      EndIf      $IndexElement += 1     Next    EndIf    $Index += 1   Next  EndIf  Return SetError(2, _IEErrorHandlerDeRegister(), $oIE) EndFunc

Struggling with this function

$
0
0

Ive been trying to get this to work for a while and i cant get it to function properly

Ive editied it down as the what to do within each case of the function works its the selection process thats flawed

The CleanupRars bit function fine and ive tried taking off archivefile as well

Ive tried select and if and etc etc round and round till im dizzy

Ive tried with the ContinueCase and without but it doesn't give a consistent result or gives part when it should give rar

 

I wish i could preselect the type before the case then it would be easier i guess as the $aRarFile = _FileListToArr etc etc dont seem to trigger

 

Maybe it needs a comparison between the $aArchiveFile and each Case?

 

So a little help if i may please

AutoIt         
Func _UnRar() ; Unpack all files     $aCleanUpRars = _FileListToArrayRec(@ScriptDir, "*.rar;*.7z;*.001;*.zip;* samp*;*.samp*;*-samp*;*_samp*;*.bmp;*.jpg;*.png|*im(*).exe;*.au3;*packer Log.txt", 1, 0) ; Find the files and exclude ;~  _ArrayDisplay($aCleanUpRars, "Cleanup Files Available")     $aArchiveFile = _FileListToArrayRec(@ScriptDir, "*.rar;*.7z;*.001;*.zip", 1, 0) ; Search for archive files     _ArrayDisplay($aArchiveFile, "Archive Files available")     If IsArray($aArchiveFile) Then ;~      If IsArray($aArchiveFile) Then             Switch IsArray($aArchiveFile)                 Case IsArray($aArchiveFile)                     $aRarFile = _FileListToArrayRec(@ScriptDir, "*.part1.rar;*.part01.rar;*.part001.rar;*.001", 1, 0)                     _ArrayDisplay($aRarFile, ".Part/.001 Files")                     ConsoleWrite('part' & @CRLF) ;~                  ContinueCase                 Case IsArray($aArchiveFile)                     $aRarFile = _FileListToArrayRec(@ScriptDir, "*.rar;*.r00|*.part*", 1, 0)                     _ArrayDisplay($aRarFile, ".Rar/.r00 Files")                     ConsoleWrite('rar' & @CRLF) ;~                  ContinueCase                 Case IsArray($aArchiveFile)                     $aRarFile = _FileListToArrayRec(@ScriptDir, "*.7z;*.zip", 1, 0)                     _ArrayDisplay($aRarFile, ".zip/.7z Files")                     ConsoleWrite('7z' & @CRLF) ;~                  ContinueCase             EndSwitch     Else         TrayTip("Missing Archive Files", " No Archive To Extract " & @CRLF & @CRLF & _                 " (   Unpack Code = NoF  )", 8, 16)         FileWriteLine($hErrorLog, "Missing Archive Files - No Archive To Extract | Unpack Code = NoF")         Sleep(3000)         Exit     EndIf EndFunc   ;==>_UnRar

Splash Image problem

$
0
0

how to load an splash image from executable's resource. Could someone show an example?

 

Translated by google chrome

How to use one-click Restore WIN8.GHO using AUTOIT script?

$
0
0

How to use one-click Restore WIN8.GHO using AUTOIT script?

making multiple clicks with different hotkeys.

$
0
0

 Hi,

 

I am trying to make autoit press different keys with different hotkeys.

With this scripts that i made with my limited knowledge it stops the previous key from being send. I want them both being pressed.

Thanks in advance to point out my mistakes :)

AutoIt         
Global $UnPaused1 Global $UnPaused2 HotKeySet("{F1}", "TogglePause1") HotKeySet("{F2}", "TogglePause2") HotKeySet( "{PGDN}", "Terminate" ) While 1     Sleep(100)     ToolTip("Script is Paused",0,0) WEnd Func TogglePause1()     $UnPaused1 = NOT $UnPaused1     While $UnPaused1 ;~         ToolTip("Sending...",0,0)         Send("3")         Sleep (150)     WEnd EndFunc Func TogglePause2()     $UnPaused2 = NOT $UnPaused2     While $UnPaused2 ;~         ToolTip("Sending...",0,0)         Send("4")         Sleep (100)     WEnd EndFunc Func Terminate()     Exit 0 EndFunc

BUG? : $BS_DEFPUSHBUTTON + GUICtrlSetBkColor

$
0
0

REPRO:

AutoIt         
#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> _TEST() Func _TEST()     ; GUI START     Local $hWND = GUICreate("TEST GUI", 624, 461, 252, 103)     Local $idInput = GUICtrlCreateInput("", 160, 24, 201, 25)     Local $idButton_TEST1 = GUICtrlCreateButton("TEST1", 384, 24, 91, 25, $BS_DEFPUSHBUTTON)     Local $idButton_TEST2 = GUICtrlCreateButton("TEST2", 480, 25, 100, 25)     GUICtrlSetBkColor(-1, 0x00FFFF)     GUISetState()     ; GUI END     Local $aMsg, $nMsg, $sTemp     While 1         $aMsg = GUIGetMsg(1)         If UBound($aMsg) And $aMsg[1] = $hWND Then             $nMsg = $aMsg[0]             If $nMsg Then                 Switch $nMsg                     Case $GUI_EVENT_CLOSE                         ExitLoop                     Case $idInput                     Case $idButton_TEST1                         $sTemp = GUICtrlRead($idInput)                         MsgBox(0, 'TEST1 Button Pushed', $sTemp)                         GUICtrlSetState($idInput, $GUI_FOCUS)                     Case $idButton_TEST2                         MsgBox(0, 'TEST2 Button Pushed', $sTemp)                         GUICtrlSetState($idInput, $GUI_FOCUS)                 EndSwitch             EndIf         EndIf     WEnd     GUIDelete($hWND) EndFunc   ;==>_TEST2Documents

HOWTO: 

  1. type some text in $idInput
  2. now click $idButton_TEST1 - is ok
  3. change text in $idInput
  4. press ENTER in $idInput - $idButton_TEST1 is used/fired
  5. now click $idButton_TEST2 - is ok
  6. change text in $idInput
  7. press ENTER in $idInput - $idButton_TEST2 is used/fired

Question:

Why in step #7    $idButton_TEST2 is used/fired

 

Remarks:

This is not happend when you comment this line:

GUICtrlSetBkColor(-1, 0x00FFFF)

EDIT:

$idButton_TEST1 is loses $BS_DEFPUSHBUTTON property when $idButton_TEST2 is clicked.

Yet another StringRegExp question

$
0
0

Hi there!

 

I have two strings in two possible formats as seen below that I need to process and get a date.

 

I understand that it could be done with two patterns, but ideally I want to process it within single StringRegExp. As of now it returns following array of matches:

["August", "02", "2014"] for $s1, which is not exactly what I want

and

["2014", "08", "27"] for $s2, which is exactly what I want

 

I need to redo the pattern so it will return array of matches in following format ["YYYY", "MM", "DD"] for both strings.

#include <Array.au3> $s1 = "Deadline Saturday, August 02, 2014 6:17 AM" $s2 = "Deadline:    [2014-08-27 16:00:00 [Central European Time]]" $pattern = "(?i)Deadline.*?(?:,\s|\[)(.*?)(?:\s|-)(.*?)(?:,\s|-)(.*?)\s" _ArrayDisplay (StringRegExp ($s1, $pattern, 1)) _ArrayDisplay (StringRegExp ($s2, $pattern, 1))

Thank in advance for help!

 

 

P.S.: converting name of the month into a double-digit code is a problem for another time, shouldn't be too hard.


AutoIT-unable to select printer in Print ListView control

$
0
0

Dear All,

I am new to AutoIT tool and need your help. I am trying to automate an application testing using AutoIT. One of the step in testing is to print the report. Once the print window pops up to select printer to print, I am not able to read the print listview control using autoit. It does not read the text from print listview. Can you please help me on how can I select one particular printer in print window using AutoIT.

Thanks a lot!

UDPBind problem

$
0
0

Hello guys,

 

please excuse my noobness.

 

I`m trying to communicate with arduino using UDP and i have no problem sending data, but if i try to use UDPBind and UDPRecv to receive data i`m getting error 10049 from UDPBind. 

If anybody could help me out that would be great.

 

Thanks

AutoIt         
Global $udp Global $sent Global $recv Global $new UDPStartup() $udp = UDPOpen("10.3.1.94", 8888) If @error Then ConsoleWrite("udp open error: " & @error & @CRLF) $sent = UDPSend($udp, "off") If @error Then ConsoleWrite("udp send error: " & @error & @CRLF) ConsoleWrite($sent & " bytes sent" & @CRLF) UDPCloseSocket($udp) $new = UDPBind("10.3.1.94", 8888) If @error Then ConsoleWrite("udp bind error: " & @error & @CRLF) $recv = UDPRecv($new, 1000) UDPCloseSocket($new) UDPShutdown()

Stuck on syntax _ArrayDelete

$
0
0
#include <Excel.au3> #include <Array.au3> $ExcelFile=_ExcelBookOpen(@scriptdir&"\EXCEL EXAMPLE.xls",1) _ExcelSheetActivate($ExcelFile,"Export_6") $Milestones=_ExcelReadSheetToArray($ExcelFile,2,2,0,0) _ArrayDelete($Milestones,0) ; get rid of that pesky excel blank row For $z=0 to UBound($Milestones) -3     If StringInStr($Milestones[$z][6],"OTHER") = 0 Then         _ArrayDelete($Milestones,$z)     EndIf Next

I know there is a simple answer for this, but I'm coming up blank. What I wanted this to do is search the column in the array and if column 6 contaied OTHER delete the row. What I've figured out is that because the row is getting deleted, the whole index shifts up, so when it should delete row 2, if it has already deleted a row, it will actually delete the original row 3 and not row 2. Anyone know how to fix this?

_FTP_ProgressUpload help me please.

$
0
0
$FTPOpen = _FTP_Open($FTPName)     ConsoleWrite("Status + "&$FTPOpen&@CRLF)     ConsoleWrite("Wait Connection to " & $FTPServer & "..."&@LF) $FTPConnect = _FTP_Connect($FTPOpen, $FTPServer, $User, $Pass, $iPassive, $iPort)     ConsoleWrite($FTPOpen & " + " & $FTPServer & " + " & $User & " + " & $Pass & @LF) $FTPUpload = _FTP_DirPutContents($FTPConnect, $InstallFolder, $FTPlocation, 1, 0)     ConsoleWrite($FTPConnect & " + From " & $InstallFolder & " + To " & $FTPlocation & @LF) Example() _FTP_Close($FTPOpen)

I would like to add a progress bar in my FTP upload.

Sorry, I had read the help but I could not make it work, could someone help me please?

AU3record will not record text into a browser

$
0
0

I am new to SciTE and AU3record, I am not a developer, but could use this great tool for software testing if I can get it up and running.  I believe I have it loaded correctly and some tasks work as advertised.  I can use AU3record to move the mouse across the screen, open word, Excel and notepad and additionally can type text and numbers into all of them, I can't however type anything into the search bar of Internet Explorer.  I can type into the URL block at the top but not into the search bar.  Our companys software has integrated KVM for virtualization and I am not able to input text in those windows either.  I have been reading the forums and have not come across anything on this topic, please point me in the right direction or let me know what I am doing wrong.  Thanks.

Interfacing AutoIt to IFTTT

$
0
0

Just curious.

 

Anybody have a Wemo switch or two at home?  I enjoy mine and use them to control some lamps and the kids tv.  

The Wemo program sucks but being how it interfaces with IFTTT that is what really makes them powerful.

 

Still even with IFTTT I do not have a super fast/easy way to turn on/off a switch without opening the app or using one of my IFTTT triggers like a text message.

 

I am looking for a way to make a GUI or a script that can turn on/off my switches with AutoIT so I can do it easy from my computer desktop with a few clicks.

 

Just not sure the best/easiest way to interface Wemo stuff to AutoIT.

 

Directly it would most probably need to be network command related (seen these switches "used" from Backtrack by sending commands to the wireless network) so the much easier way is probably by interfacing to an IFTTT trigger.  What is the best/easiest one I have no idea so came here to ask.

 

Bonus points if there is some way to see current switch status of off/on and show that in GUI.

 

 

For now my first starting place will be create an e-mail trigger and try the SMTP UDF we have to send a mail.  I have not gotten that UDF working  yet but maybe its the firewall I am behind right now so I'll try again later at home.

Failing at Variables

$
0
0

I know this is going to make advanced users cringe, so I apologize in advance. Can anyone show me how to fix this code?

Func Java () $JavaSecurity = FileCopy ("\\fileserver01\disks\java\deployment.properties", @UserProfileDir & "\appdata\locallow\sun\java\deployment", $FC_OVERWRITE) If @ERROR Then $Verify = MsgBox (0, "Verify", "Verify your Java and then run the script again!") If $Verify = 1 Then Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE -new http://www.java.com/verify","") If $Verify = 1 Then FileDelete (@UserProfileDir & "\appdata\locallow\sun\java\deployment") ShellExecuteWait (@UserProfileDir & "\appdata\locallow\sun\java\deployment") EndFunc

I am just copying a modified deployment file to client machines to deal with a security issue. If the deployment folder doesn't exist yet (no java instance has ever ran on client profile) then I want a message box to pop up to tell them to verify and when they click OK it opens the verify page @ java so they can run an instance and create the deployment file before doing a copy. However, it keeps telling me $verify isn't declared. If I try and set it as a Local variable first, it still gives me an error. I have tried using the IF AND IF THEN functions for when msgbox is clicked and can't seem to work out how to get those 2 lines into one.

 

Everything else in the code works. The messagebox pops up if the folder doesn't exist, and the webpage will pop up as well as long as i use F5 with the script open. However, running not in edit mode or as a compiled it will give me the declaration error.

 

I am SURE this is somewhere in the help file or forums, but I don't think I'm searching for the right things.

 

Also, can someone tell me why I can't use this line even if $verify is declared.

$verify = MsgBox (0, "Verify", "Verify your Java and then run the script again!") If @error=1 Then $Verify

I know you can't just use $verify by itself, but how would you write that in a different way?

 

YES I know these are simple questions I really have looked for the answers promise.

 

Edit: I also see $MB_Systemmodal used a lot in the help file for msgbox function. Is there a link to a list where I can see all of the available microsoft boxes already pre-coded in autoit?


How to delete a printer based on it's IP address?

$
0
0

I am creating an Autoit application to install network printers. However, I need a way to check for or delete a printer if it is already installed. I am using Prnmngr.vbs to check for names:

RunWait (@ComSpec & ' /c Cscript "' & $Prnmngr & '" -d -p "' & $printerName & '"', "", @SW_HIDE)

However, the name of any particular printer can vary from computer to computer. Is there a way I can search by IP address and thus get the name as installed on the computer?

Delete items from Array - two examples

$
0
0

I'm looking at two different approaches thought to be used in deleting "blanks" or "zeros" from an array.

 

The second method works (and its just for blanks) while the first method for blanks AND zeros a result that is NOT good.

 

You have to uncomment/comment each method, but could someone please point out why one is not working - what needs to be tweaked and corrected?  

 

Thanks.

Hobbyist

AutoIt         
#include <Constants.au3> #include <Array.au3> Global $aLogBUD2[6][3] = [["","",""],["col 0", "col1", "col2"], ["abc", "efg", "123"],["","",""], ["", "", ""], ["hij", "", "xyz"]] _ArrayDisplay($aLogBUD2, "initial array") ; METHOD ONE FOR DELETE 0 OR BLANKS ***************** Local $iCount = 0, $sTemp For $i = 0 To UBound( $aLogBUD2, 1)  - 1     $iDelete = 0     For $j = 0 To UBound( $aLogBUD2, 2) - 1         $aLogBUD2[ $iCount][$j] =  $aLogBUD2[$i][$j]         If  $aLogBUD2[$i][$j] == 0 OR $aLogBUD2[$i][$j] = ""   Then $iDelete = 1     Next     If NOT $iDelete  Then  $iCount += 1 Next ;END METHOD ONE ;METHOD TWO FOR DELETE BLANKS ;~ For $i = UBound($aLogBUD2) - 1 To 0 Step -1 ;~     ; Create a blank variable ;~     $sTemp = "" ;~     For $j = 0 To UBound($aLogBUD2, 2) - 1 ;~         ; Add each of the elements in the row ;~         $sTemp &= $aLogBUD2[$i][$j] ;~         ; If it contains something then ignore this row ;~         If $sTemp <> "" Then ContinueLoop 2 ;~     Next ;~     ; There was nothing at all in that row ;~     _ArrayDelete($aLogBUD2, $i) ;~ Next ;END METHOD TWO _ArrayDisplay($aLogBUD2, "ending")

Image Search

$
0
0

Hello,

last time my topic was closed, so I decide to do something diffrent.

 

I want my script to find the photograph and moved the mouse incessantly into places which I want, all the way to the moment of finding other photograph which would finish the loop.

At this moment I have only this, but it isn't work as I want, so can you help me with that?

AutoIt         
#RequireAdmin #include <ImageSearch.au3> Global $y, $x $stop = _ImageSearch(@ScriptDir & "\dll.bmp", 1, $x, $y, 255) HotKeySet("{p}", "checkForImage") While 1    Sleep(10) WEnd Func checkForImage()    Do  Sleep(10)       $search = _ImageSearch(@ScriptDir & "\checkImage.bmp", 1, $x, $y, 255)       If $search = 1 Then          ContinueLoop       Else          MouseMove(0, 0)          Sleep(1000)          MouseMove(69, 69)          Return $search       EndIf    Until _ImageSearch(@ScriptDir & "\dll.bmp", 1, $x, $y, 255) EndFunc

 

Interesting to layman

$
0
0

Hi, I have been using AutoIt for quite some time now but a friend today got me into thinking about its interesting uses. I showed him a script that I wrote for automating mundane tasks like opening all my usual work related programs (microsoft visual studio, notepad++, unix editor, chrome browser etc) whenever I boot my PC. But, apart from that I couldn't impress him with anything that can be done with AutoIT. Do you know any such example scripts which can draw a layman to AutoIt? Ideas will also do, I can code :-)

Running the AD snapin

$
0
0

Hello everyone!

 

I've been searching the heck out of this issue and I just cant seem to find the answer. I will start off with saying sorry for not using the AD UDF by Water, and here's why.

 

So since my work has been migrating over to alt admin account setups, I have been looking to replace my morning ritual of signing into every program each time I start my machine. I understand most of these can be set using runas and using my alt account. I have already conquered all that, made a quick GUI with spiffy buttons (aid my coworkers to use the fruits of my labor). I add programs to a list and they all startup in an elevated priviledge. All that is all fine until I get to the Active Directory - Users and Computers snapin.

 

For the life of me, I can't get the runas to boot the AD snapin with admin priviledges whatsoever. When the run as sends, nothing happens - no errors. I have seen passed conversations(from a few years ago) where it was referenced to build your own interface for the AD using the UDF.

 

My question are: 

  • Why re-invent the wheel? The AD snapin is feature full. Everyone knows how to use it. Probably would be better than anything I can build.
  • Autoit is about making your life simpler, why go through another 500 lines of code when maybe 2 or 3 would do the trick?

I'm sure I could shell-execute it to work, but that goes back to step 1: having to manually enter credentials since shellexecute doesnt accept creditials as a parameter.

 

So, has anyone figured out how to swiftly execute the AD snapin with elevated priviledges of an alt account?

 

The system I am using is Win7 x64

Viewing all 12506 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>