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

creating directories from a list.

$
0
0

Hey Guys,

 

has been a little while since using autoit, just wanting to check im not missing something here?

 

Or can i not use dircreate in a way like this... have a list of names, wanting to create folders from said list.

 

Also tried using serverpaths didnt work :(

error: (11) : ==> Error parsing function call.:

;;creating lots o folders! #include <Excel.au3> $oExcel = _Excel_Open() $wkbk = _Excel_BookOpen($oExcel,"\\fbnecl3\inzb\Documents\Content Support\Tom\Automation\Autoit Test Scripts\foldernames.xlsx") For $i = 1 To 490 ;Loop $location = _Excel_RangeRead($wkbk, default,"a"&$i, 1) $name = _Excel_RangeRead($wkbk, default,"b"&$i, 1)    dircreate("q:\Documents\HGIF\South Pac\"&$location&"\"&$name&"\" Next _Excel_Close($oExcel)

Cant remember what a control is called :/

$
0
0

A lot of apps have a status bar across the bottom of the window that displays info, I know autoit has the functionality to add this, because I've done it in the past, but I cant rememeber what it's called.

2 Questions

$
0
0

I'm really posting about 1 problem, but while I'm here, I figured I'd ask another question that I've had for a quite a long time now too :P

 

My main problem is this:  I want a script that will prevent the use of the enter key whenever it's running.  The script sleeps unless a specific window is active, and while said window is active, I want to prevent myself from using enter at any point in time.  I found the _IsPressed() function, which will tell me if enter was pressed, but I can't seem to figure out how to interupt/block the press from happening in the first place.  Any ideas on how I could accomplish this?  I know in C++/VB/etc, you can just say 'if enter is pressed, do not send the key_down event, but I can't seem to find anything similar with autoit.

 

The second question I have is regarding the window spy.  In alot of situations, when you hover over something, it changes color.  How do you grab the original pixel color when this happens?

 

Thanks in advance!

Converting relative into absolute Coordinates

$
0
0

Since WinMove seems only to work in absolute coordinates I wanted to convert my relative coordinates into absolute ones.
The problem is that I can only think of one filthy way to complete that task and that involves MouseMove. For example:

Opt("MouseCoordMode", 2) Winactivate([$WorkingWindow) MouseMove($X,$Y,0) Opt("MouseCoordMode", 1) Local $abs = MouseGetPos() Opt("MouseCoordMode", 2) WinMove($Window, $abs[0], $abs[1])

Can you help me out with a better solution?

 

 

EDIT: Thank you very much. This is just perfect.

How to convert Javascript to _FFCmd

$
0
0
  • This is code for address bar on web browser.

    javascript:{var evnt = window.document.createEvent('KeyboardEvent');evnt.initKeyEvent('keypress', true, true, window, false, false, false, false, 13, 13);window.document.getElementById('masthead-search-term').dispatchEvent(evnt);void(0)}

    How convert to _FFcmd ?

     

    thanks very much!

Click "button" in order to upload a file

$
0
0

I need to click into a div in order to open a file dialog.

 

When i browse the page source i see this

<div id="upload_a_file" content_type="files"></div>

But when i see the source using the developer tools i see this

<div id="upload_a_file" content_type="files"><div class="qq-uploader"><div class="qq-upload-drop-area" style="display: none;"><span original-title=""><img src="../fileuploader/add_file.png" alt="" border="0" class="middle" width="16" original-title=""></span></div><div class="qq-upload-button" style="position: relative; overflow: hidden; direction: ltr;"><div>Send File</div><input multiple="multiple" type="file" name="file" style="position: absolute; right: 0px; top: 0px; font-family: Arial; font-size: 118px; margin: 0px; padding: 0px; cursor: pointer; opacity: 0;" class="" original-title=""></div><span class="qq-drop-processing" original-title=""><span original-title="">undefined</span><span class="qq-drop-processing-spinner" original-title=""></span></span><ul class="qq-upload-list"></ul></div></div>

How i could click into "Send File" in order to open the file dialog ?

 

Atm i've this to click on the submit button

Global $oIE = _IECreate("link", 0,0) Local $btn_upload = _IEGetObjByName($oIE ,"upload") _IEAction($btn_upload, "click")

Very slow performance after the first run!

$
0
0

Hello,

 

I'm currently having a small issue with my script. I'm automating the export of some files with a 3rd party application which lacks a decent way to script around.

 

The app works just fine, but after the 2nd or 3rd run, whole OS (I'm running this on Windows 7 inside VMWare) is slow as hell!

 

I tried adding sleep()'s all around just to give it time to catch up, but to no avail.

 

Can someone shed some light as to why this is happening? (My code to "allow the VM to catch up" doesn't really fix anything, even after that long pause, the VM is still slow as hell)

 

My code:

AutoIt         
#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <MsgBoxConstants.au3> #include <Date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $program = "C:\Program Files\Smart Player\Smart Player.exe" Opt("MouseCoordMode", 0) Opt("WinTitleMatchMode", 4) Opt("SendKeyDelay", 25) Opt("TrayIconHide", 1) $count = 0 Func GetFile()     $file = RecursiveFileSearch("Z:\Surv\_swap", "\.(dav)", ".", 1, True)     If $file[0] > 0 Then         ConsoleWrite("There are " & $file[0] & " files left" & @CRLF)         Return $file[1]     Else         Return False     EndIf EndFunc   ;==>GetFile Func _log($string)     $time = _Date_Time_GetSystemTime()     $time = _Date_Time_SystemTimeToDateTimeStr($time)     ConsoleWrite("[" & $time & "] " & $string & @CRLF)     Sleep(15) EndFunc   ;==>_log Func ConvertFile($file)     _log("Do: " & $file);     If ProcessExists("Smart Player.exe") Then         _log("Exit Program")         ProcessClose("Smart Player.exe")     EndIf     _log("Run Program")     Run($program & " " & $file)     _log("Waiting for activation...")     WinWaitActive("Smart Player")     Sleep(500)     _log("Closing preview...")     ; close preview     MouseMove(629, 83, 0)     MouseClick("left", 629, 83, 1, 0)     Sleep(50)     MouseMove(627, 110, 50)     Sleep(250)     MouseClick("left", 627, 110, 1, 0)     ;ControlClick("Smart Player", "", "[CLASS:QWidget; INSTANCE:119]", "left", 1, 296, 11)     _log("Clicking export...")     ; click to export     ;MouseMove(336,36)     Sleep(75)     MouseClick("left", 336, 36, 1, 0)     _log("Checkmark on the file")     ; check file     ;MouseMove(644, 157)     Sleep(75)     MouseClick("left", 644, 157, 1, 0)     ; stopping preview     ;MouseMove(184, 475)     Sleep(150)     ;MouseClick("left", 184, 475, 1, 0)     ControlClick("Smart Player", "", "[CLASS:QWidget; INSTANCE:32]")     Sleep(1000)     _log("Clicking on Format")     ; click on format     ;MouseMove(788, 442, 0)     Sleep(500)     ;MouseClick("left", 788, 442, 1, 0)     ControlClick("Smart Player", "", "[CLASS:QWidget; INSTANCE:11]")     _log("Selecting AVI")     ; Select AVI     MouseMove(770, 538, 0)     Sleep(250)     MouseClick("left", 770, 538, 1, 0)     Sleep(250)     _log("Exporting now...")     ; Click EXPORT     MouseMove(487, 544, 0)     Sleep(250)     MouseClick("left", 487, 544, 1, 10)     ControlClick("Smart Player", "", "[CLASS:QWidget; INSTANCE:27]")     ; get directory     $dir = GetDir($file)     _log("Typing Directory: " & $dir)     ; type directory     Sleep(2500)     WinWaitActive("Find Directory")     Send($dir & "{ENTER}")     Sleep(15000)     _log("Checking if there are JPG files in here")     $findjpg = RecursiveFileSearch($dir, "\.(jpg)", ".", 1, False)     If $findjpg[0] > 0 Then         _log("Found JPG files... we failed :-(")         ProcessClose("Smart Player.exe")         FileChangeDir($dir)         FileDelete("*.jpg")         Sleep(1000)         Return True     EndIf     _log("Waiting to finish export...")     ; now waiting to finish export...     WinWaitActive("[W:301; H:136]")     _log("Clicking OK")     ; clicking "OK"     ;MouseMove(159, 111)     Sleep(75)     MouseClick("left", 159, 111, 1, 0)     _log("Exit Program")     ProcessClose("Smart Player.exe")     Sleep(500)     ;DONE     $newfile = StringReplace($file, ".dav", ".done")     _log("Moving file to: " & $newfile)     FileMove($file, $newfile)     _log("--- --- --- DONE --- --- --") EndFunc   ;==>ConvertFile While True     ConvertFile(GetFile())     Sleep(1000)     $count = $count + 1     If $count >= 5 Then         ConsoleWrite(@CRLF & "Allowing VM to catch up..." & @CRLF)         Sleep(20000)         $count = 0     EndIf WEnd Func GetDir($sFilePath)     Local $aFolders = StringSplit($sFilePath, "\")     Local $iArrayFoldersSize = UBound($aFolders)     Local $FileDir = ""     If (Not IsString($sFilePath)) Then         Return SetError(1, 0, -1)     EndIf     $aFolders = StringSplit($sFilePath, "\")     $iArrayFoldersSize = UBound($aFolders)     For $i = 1 To ($iArrayFoldersSize - 2)         $FileDir &= $aFolders[$i] & "\"     Next     Return $FileDir EndFunc   ;==>GetDir #cs ----------------------------------------------------------------------------     AutoIt Version: 3.2.10.0     Author: WeaponX     Updated: 2/21/08     Script Function: Recursive file search     2/21/08 - Added pattern for folder matching, flag for return type     1/24/08 - Recursion is now optional     Parameters:     RFSstartdir: Path to starting folder     RFSFilepattern: RegEx pattern to match     "\.(mp3)" - Find all mp3 files - case sensitive (by default)     "(?i)\.(mp3)" - Find all mp3 files - case insensitive     "(?-i)\.(mp3|txt)" - Find all mp3 and txt files - case sensitive     RFSFolderpattern:     "(Music|Movies)" - Only match folders named Music or Movies - case sensitive (by default)     "(?i)(Music|Movies)" - Only match folders named Music or Movies - case insensitive     "(?!(Music|Movies)\:)\b.+" - Match folders NOT named Music or Movies - case sensitive (by default)     RFSFlag: Specifies what is returned in the array     0 - Files and folders     1 - Files only     2 - Folders only     RFSrecurse: TRUE = Recursive, FALSE = Non-recursive     RFSdepth: Internal use only #ce ---------------------------------------------------------------------------- Func RecursiveFileSearch($RFSstartDir, $RFSFilepattern = ".", $RFSFolderpattern = ".", $RFSFlag = 0, $RFSrecurse = True, $RFSdepth = 0)     ;Ensure starting folder has a trailing slash     If StringRight($RFSstartDir, 1) <> "\" Then $RFSstartDir &= "\"     If $RFSdepth = 0 Then         ;Get count of all files in subfolders for initial array definition         $RFSfilecount = DirGetSize($RFSstartDir, 1)         ;File count + folder count (will be resized when the function returns)         Global $RFSarray[$RFSfilecount[1] + $RFSfilecount[2] + 1]     EndIf     $RFSsearch = FileFindFirstFile($RFSstartDir & "*.*")     If @error Then Return     ;Search through all files and folders in directory     While 1         $RFSnext = FileFindNextFile($RFSsearch)         If @error Then ExitLoop         ;If folder and recurse flag is set and regex matches         If StringInStr(FileGetAttrib($RFSstartDir & $RFSnext), "D") Then             If $RFSrecurse And StringRegExp($RFSnext, $RFSFolderpattern, 0) Then                 RecursiveFileSearch($RFSstartDir & $RFSnext, $RFSFilepattern, $RFSFolderpattern, $RFSFlag, $RFSrecurse, $RFSdepth + 1)                 If $RFSFlag <> 1 Then                     ;Append folder name to array                     $RFSarray[$RFSarray[0] + 1] = $RFSstartDir & $RFSnext                     $RFSarray[0] += 1                 EndIf             EndIf         ElseIf StringRegExp($RFSnext, $RFSFilepattern, 0) And $RFSFlag <> 2 Then             ;Append file name to array             $RFSarray[$RFSarray[0] + 1] = $RFSstartDir & $RFSnext             $RFSarray[0] += 1         EndIf     WEnd     FileClose($RFSsearch)     If $RFSdepth = 0 Then         ReDim $RFSarray[$RFSarray[0] + 1]         Return $RFSarray     EndIf EndFunc   ;==>RecursiveFileSearch

Parsing/converting array!

$
0
0

I have had total brain block on this for almost a week, I simply cannot get my head around the logic.

 

Asking if someone else can.

 

It does not look like a difficult problem, but I'm simply psychoblocked on the matter.

 

Bigger issue, which boils down to creating one array from another.

 

The two arrays below are what I start with and what I need to get to programmatically.

 

I'm seriously, usually fine and unafraid of arrays and this sort of logic, and don't understand why I'm suffering this mental block.

 

Please help a man in distress.

AutoIt         
#include <Array.au3> ; In the following array, you see that Type1 one has 3 SubTypes, ; Subtype1, Subtype2, and Subtype3. ; ; Type 2 has 2 subtypes, type3, only 1 etc... ; ; Of course this is not fixed size array and the anount of subtypes vary ; The array is sorted by type though Global $aFirstArray[10][2] = [["Type1", "Subtype1"],["Type1", "Subtype2"], _         ["Type1", "Subtype3"],["Type2", "Subtype4"], _         ["Type2", "Subtype5"],["Type3", "Subtype5"], _         ["Type4", "Subtype6"],["Type4", "Subtype7"], _         ["Type5", "Subtype8"],["Type5", "Subtype9"]] _ArrayDisplay($aFirstArray, "This") ; This is the desired output array ; Like a Parent(Type) header, then Children (Subtypes) bel;ow it Global $aSecondArray[15] = ["Type1", "Subtype1", "Subtype2", "Subtype3", _         "Type2", "Subtype4", "Subtype5", _         "Type3", "Subtype5", _         "Type4", "Subtype6", "Subtype7", _         "Type5", "Subtype8", "Subtype9"] _ArrayDisplay($aSecondArray, "To This")

Cannot fire this dropdown though I can change it's value

$
0
0

This 'Select' element is on my bank account's page so I can't provide the url.

I found an example page at http://events.msdn.microsoft.com where, again,  I can change the value of any dropdown but unable to fire/update the page.  I've done many searches but never found a similar problem.  Please point me in the right direction. Below is the html and what I have tried already.

 

I have tried the following:

  1. #include <ie.au3>
  2.  
  3. Local $oIE = _IEAttach("Account Activity")
  4. Local $oForm = _IEFormGetCollection($oIE,0)
  5. Local $oSelect = _IEGetObjById($oForm,"StatementPeriodQuick")
  6. ; Any of these 3 methods work to select the 5th item "All Transactions"
  7. _IEFormElementOptionSelect($oSelect,"ALL",1,"byValue",1)
  8. _IEFormElementOptionSelect($oSelect,"All Transactions",1,"byText",1)
  9. _IEFormElementOptionSelect($oSelect,"4",1,"byIndex",1)
  10.  
  11. ;Nothing happens when I try any of the following
  12. _IEAction($oSelect, "focus")
  13. $oSelect.fireEvent("onSelect")
  14. $oSelect.fireEvent("onselectstart")
  15. $oSelect.fireEvent("onchange")
  16. $oSelect.fireEvent("onclick")
  17. $oSelect.fireEvent("onmousedown")
  18. $oSelect.fireEvent("onmouseup")
  19.  
  20. ;Submitting the form just refreshes the page with the defaults
  21. ;_IEFormSubmit($oForm)
<select name="StatementPeriodQuick" tabIndex="115" class="chaseanalytics-track-option" id="StatementPeriodQuick"><option value="SINCE_LAST_STATEMENT" data-pt-name="stmtquick_sincelaststmt">Since Last Statement</option> <option value="LAST_STATEMENT" data-pt-name="stmtquick_1monthsago">Statement Ending Mar 11, 2015</option> <option value="TWO_STATEMENTS_PRIOR" data-pt-name="stmtquick_2monthsago">Statement Ending Feb 11, 2015</option> <option value="THREE_STATEMENTS_PRIOR" data-pt-name="stmtquick_3monthsago">Statement Ending Jan 11, 2015</option> <option value="ALL" data-pt-name="stmtquick_all">All Transactions</option> </select>

 

Open a file without its name

$
0
0

need some help

 

i have a PHP script that save reports each 30 min in CSV file

In the directory is always only 1 file(if there is already a file than script delete it and save new one each 30 min)

 

So,i need to open this specific CSV file with au.3

 

file name its a random combination of 20 character(ex:4jd#6eor93$ufie5@sd7)

 

file have each time random unique name

shift-click system tray icon

$
0
0

Anyone know how to require a shift-right click on the script icon in the system tray to make it do something?  I want it to require a shift-right click to trigger an action.
 
I have it working with a right click but dont know how to require the shift key at the same time. 

#include <TrayConstants.au3> Opt("TrayMenuMode", 3) TraySetState($TRAY_ICONSTATE_SHOW) While 1     Switch TrayGetMsg()         Case $TRAY_EVENT_SECONDARYDOWN             msgbox(0,"","test")         ExitLoop     EndSwitch WEnd

AHK to AutoIT

$
0
0

is there a way to convert an AHK script to perfom the same in AutoIT

this AHK is not just sending keystrokes, it launches a PPT  based on an INI config, and if the app is modified it will close and relaunch to update the changes

 

any ideas?

 

How to send virtual mouse clicks

$
0
0

I've been reading tutorials for hours but I'm a complete computer newb and I learn best with examples. I'm trying to automate some repetitive tasks mostly using the mouse but I need the mouse to be invisible and not interfere with the actual mouse pointer (I have 2 monitors and multitasking).

 

In particular if someone could show me the code for these 3 very simple tasks I would try to take it from there:

 

- If chrome.exe is open or opens the mouse will move to (x:300,y:300) and click at that location.

- If pixel at (x:300,y:300) or (x:600,y:600) becomes 1D3458 the mouse will click at that/those location.

- If active window is "Windows Media Player" mouse will move to (x:300,y:300), double click, and type "hello".

 

The important part is that the real mouse must not be affected by these tasks and the tasks must be executed prefrably with 0 delay and as long as the script is ON it will continue to perform the tasks. Thank you so much for any replies, I spend most of my day on PC and learning how to make some simple scripts such as these would be really amazing, think of it as saving someone's life!  :thumbsup:

Inaccurate Desktop Resolution

$
0
0

Using the autoit window info tool or using the macros @desktopwidth or @desktophieght gives me a resolution of 1600 x 900 when in fact I'm using a resolution of 1920 x 1080 is there anyway to correct this? it's making scripting extremely difficult.

 

Hooking into the mouse?

$
0
0

I remember there is a winapi function that allows a user to hook into they keyboard and get all events, is there a hook like this to get all mouse click, without having to check for the click using ispressed?

 

Thanks much.


Need Help adjusting my mouse click to different screen sizes

$
0
0

Hi everyone, i have just finished my script, but when i run it on a different PC with a different size click coords change. I did an adjustment for clicking into the window, took the relative coords of the window i want it to click like that example:

 

AutoItSetOption("MouseCoordMode",0)

 
WinWait("program name")
WinActivate("program name")

MouseClick("primary", 211,322,1,5) 

 

But nothing changes so im just wondering what can be wrong.... i tryed many different things and nothing..... Can someone help me please???

Searching the forums for answers, examples, etc

$
0
0

I'm finding that a whole lot of questions get posted on these forums with very little background searching done by the asking users. 

 

I can appreciate the fact that the built-in forum search may not be the best (they usually aren't). So I would recommend using Google first with the argument "site:autoitscript.com" (remove the "") following with your question.

 

E.g .http://www.google.com/webhp?ion=1&espv=2&ie=UTF-8#q=site%3Aautoitscript.com%20how%20to%20create%20a%20gui 

 

Majority of the time you will find your answer on the first page or the second page. 

 

Is there a way to parse/Read midi files as notes

$
0
0

Hi, i'm trying to read midi files but i cant seem to find a way to do it, i did found lots of examples how to read midi instruments inputs or play midi files but what i want is to parse a file, execute functions depending on the notes or even save it as text.

Does anyone knows how to do it?

Thanks,

how to navigate to drop down box on a web page with autoit

$
0
0

I need some general direction (help) on using autoit to navigate to a drop down box (more than one actually) and then select an entry...   I have attached a picture of the web page.

 

laf screen.jpg

Getting text from a label control in ie?

$
0
0

Maybe its escaped me, but I cant figure out how to get say the value or text of a label is that updated say via javascript in IE.

 

For example, there is a page that lists the user who created a ticket.

 

Heres the html code of the label:

<span id="_ctl0_phMain_fvOrderDetails_lblCreator">randerson</span>

How do I get the value of 'randerson' for this? Doing a simple _IEPropertyGetValue doesnt work, and im obviously not understanding this one.

 

Viewing all 12506 articles
Browse latest View live


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