We need to automate Silverlight Application. Can we use AutoIT for the same? If yes then how?
How to Automate Silverlight Application using AutoIT
Need help with #include <FTPEx.au3>
Hello everyone am a new member here and i know that i shouldn't ask for help without giving something in return but this one is very important for me .
i want to make something like this . i want to make a ftp script that would create a directory on the server with computer name and date something like this
the previous script doesn't work can anyone find the mistake and help me ??
Thank you .
Unable to run a .bat file with psexec commands
Hi all, so I've been trying to write a script that'll run a local .bat file.
It's a simple idea that i run a batch file from autoit using the codes below with a simple run command.
Then the batch file will execute the command line
psexec -i -d \\SGP101TEST02 -u TEST02 -p admin3t -f -c C:\AutoTestPackage\TestSuite\SmokeTest\Configure\Basic_Configuration.bat
However when i run the script below, the cmd window would appear but it gives an error saying
'psexec.exe' is not recognized as an internal or external command.
I also tried directly writing this in autoit
Move all content from folderA to folderB
Hey guys How can I move ALL content from folderA to folderB?
$source = 'C:\folderA' $dest = 'C:\folderB' dirmove($source, $dest, 1) ; This just moves folderA under folderB, which is not what I want!
filemove --> only moves files, not directories
ill a byte array from DllStructGetData($lpBuffer, 1)
Edit:
hit return and it submitted before I had actually posed my question....
Delete specific folder found in a text file
Hello,
I am trying to build a script that reads a text file with multiple lines (every line has a folder name that needs to be deleted).
Then I want to look for the folder name in the folder list (using _FileListToArrayRec) and if the folder name is found - delete it.
This is the code I have so far, but it fails on line 43 - "Array variable has incorrect number of subscripts or subscript dimension range exceeded"
would appreciate some help.
#include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <file.au3> #Include <Date.au3> #include <Array.au3> ; ***** Create local logs Eof() ; Create a constant variable in Local scope of the filepath that will be read/written to. ; Open the file for reading and store the handle to a variable. ; Read the contents of the file using the handle returned by FileOpen. ; Retrieve a list of all the folders in $sRoot, and store them as an array in $aList Global $aList = _FileListToArrayRec ($sRoot, "*", 2, -2) ; _FileListToArray("path" [, "Filter" [, Flag]]) ; Look at what _FileListToArray() puts into $aList If FileExists($sRoot & "\" & $aList[$i] & "\" & $aArray[$i]) Then _filewritelog ($log, "Deleting, " & $aArray[$i])
ControlSetText on toolbarWindow
Hello!
I have a little script and in it a function that is responsible for handling saves in PDFCreator. When such a situation arise, it should set the destination folder to one predestinated in a global variable (a folder in our innernetwork).
Originally I achieved this by moving the window to 0,0 then mouseclick on a specified coordinates on the screen (I know, I know, thats why I want to change it something more reliable, more intelligent)
My candidates were ControlSetText, ControlSend and ControlCommand. I rejected ControlCommand outright since it isn't really for this. ControlSend cause the script to exit, when it reaches the first point where it would use the function.
ControlSetText returns the next console (run_debug_mode=Y)
Here is my function so far: (sorry its under construction)
Func RenamePDF($TopUpName) Sleep(1000) WinActivate("PDFCreator 1.", "") WinWaitActive("PDFCreator 1.", "") ControlCommand("PDFCreator 1.", "", "[CLASSNN:ThunderRT6TextBox6]", "EditPaste", $TopUpName) ControlSetText("PDFCreator 1.", "", "[CLASSNN:ThunderRT6TextBox6]", $TopUpName) ControlClick("PDFCreator 1.", "", "[CLASSNN:ThunderRT6CommandButton7]") $WindowWaitCheck = WinWaitActive("Mentés másként", "", 5) If $WindowWaitCheck = 0 Then ControlClick("PDFCreator 1.", "", "[CLASSNN:ThunderRT6CommandButton7]") EndIf WinMove("Save as", "", 0, 0) ;MouseClick("", 565, 50) ;Not like this, to many possible errors! ;Send("{BS}" & $PDFmentesPath & "{Enter}") ;ControlCommand ;ControlSend("Save as", "", "[CLASSNN:ToolbarWindow323]", & $PDFmentesPath) ControlSetText("Save as", "", "[CLASSNN:ToolbarWindow323]", & $PDFmentesPath) ControlClick("Save as", "", "[CLASSNN:Button1]") Sleep(1500) EndFunc ;==>RenamePDF
I have a guess that there is a problem in how I try to write/send the variable $PDFmentesPath, but not sure I know how should I do it. Trying random things that come to mind for now.
Thank you for your time and help!
UIA Invoke click for a UIA_TextControlTypeId - Is that possible?
Good Morning AutoIT Gurus
How is everyone this fine Tuesday?
I have been using SimpleSpy and inspect.exe to get data from various program windows - but this one, I'm not sure about since it's a button - but it's also text.
Could I treat UIA_TextControlTypeID (TextBlock) as a button and click on it somehow? - If so, how would I do that? FYI - I have successfully been using code examples from LarsJ and Junkew in the past.
The reason I have to treat that text as a button is that the button itself has no data. (At least we have an element [][Button]) and the text within the button does... (At least we have an element [Run Threat Analysis Scan][TextBlock])
SimpleSpy info:
#include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP6=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Symantec Help v2.1;controltype:=UIA_WindowControlTypeId;class:=Window", $treescope_children) _UIA_Action($oP6,"setfocus") Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_CustomControlTypeId;class:=SharedWindow", $treescope_children) Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=;controltype:=UIA_CustomControlTypeId;class:=Home2", $treescope_children) Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_PaneControlTypeId;class:=ScrollViewer", $treescope_children) Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=UIA_CustomControlTypeId;class:=Ui2Widget", $treescope_children) Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=;controltype:=UIA_CustomControlTypeId;class:=UiActionButton", $treescope_children) Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_ButtonControlTypeId;class:=Button", $treescope_children) ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll("RunThreatAnalysisScan.mainwindow", "title:=Run Threat Analysis Scan;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Run Threat Analysis Scan;ControlType:=UIA_TextControlTypeId", $treescope_subtree) _UIA_action($oUIElement,"click")
This fails as well...
Local $hWindow = WinGetHandle("Symantec Help v2.1") If Not $hWindow Then Return ConsoleWrite("Window handle ERR" & @CRLF) ConsoleWrite("Window handle OK" & @CRLF) ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation) If Not IsObj($oUIAutomation) Then Return ConsoleWrite("UI Automation object ERR" & @CRLF) ConsoleWrite("UI Automation object OK" & @CRLF) ; Get UI Automation element from window handle Local $pWindow, $oWindow $oUIAutomation.ElementFromHandle($hWindow, $pWindow) $oWindow = ObjCreateInterface($pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) If Not IsObj($oWindow) Then Return ConsoleWrite("Automation element from window ERR" & @CRLF) ConsoleWrite("Automation element from window OK" & @CRLF) ; Condition to find "Run Threat Analysis Scan" button Local $pCondition, $pCondition1, $pCondition2 $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_ButtonControlTypeId, $pCondition1) $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Run Threat Analysis Scan", $pCondition2) $oUIAutomation.CreateAndCondition($pCondition1, $pCondition2, $pCondition) If Not $pCondition Then Return ConsoleWrite("Run Threat Analysis Scan condition ERR" & @CRLF) ConsoleWrite("Run Threat Analysis Scancondition OK" & @CRLF) ; Find "Run Threat Analysis Scan" button Local $pButton, $oButton $oWindow.FindFirst($TreeScope_Descendants, $pCondition, $pButton) $oButton = ObjCreateInterface($pButton, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) If Not IsObj($oButton) Then Return ConsoleWrite("Find button ERR" & @CRLF) ConsoleWrite("Find button OK" & @CRLF) ; Click (invoke) "Run Threat Analysis Scan" button Local $pInvoke, $oInvoke $oButton.GetCurrentPattern($UIA_InvokePatternId, $pInvoke) $oInvoke = ObjCreateInterface($pInvoke, $sIID_IUIAutomationInvokePattern, $dtagIUIAutomationInvokePattern) If Not IsObj($oInvoke) Then Return ConsoleWrite("Invoke pattern ERR" & @CRLF) ConsoleWrite("Invoke pattern OK" & @CRLF) $oInvoke.Invoke() Sleep(2000)
Thank you all very much - I do appreciate your help as always.
List of Applications
Is there a function that returns a list of currently running applications, similar to the list that appears on the Task Manager's Applications tab?
Thanks!
<Prospeed.au3> A simple working example please
Hi
Can anyone provide a really simple basic example of the prospeed.au3 in action. I'm aware that there are many complete examples around but I have haven't been able to get any of these dated versions working because of syntax errors..... I just need a basic setup where I can manipulate an image within a XY axis using some of the UDF features.
Thanks
<Prospeed.au3>
v
AutoIt bcdedit.exe (Not work)
i tried yesterday some on autoit so, i have friends , where get always kicked form a game server because the DEP off
they need always to write by him self the whole code in cmd, so i just thinking i could programm him some little programm where he just
need to press on the button and its fixxing here my code :
<snip>
so i tryd it , but its still not changing , i always watch on CMD after every boot under {current}but can only still reading : AlwaysOff
i start this programm everytime as admin
I hope one of your nice guys can help me
Thanks in advance
PS : i don't want to use a VBscript , bat file
Can't work with specific window
Hi! First post on AutoIT Forum! I am facing a big problem. I have tried commands like WinMove, ControlClick, MouseClick and many others with success, interacting with Calculator window. Now I am trying to click o a button of HWiNFO32 program but i just can't. No ControlClick, no WinMove no MouseClick, not even Send command!!! What can I do? Is there a workaround? You can try it for yourself, try getting HWiNFO32 portable and then click on something or move the window. I can't. Where's the problem?
silly question (variables and memory)
Maybe this question is silly, but I'm still experimenting, and there are many things that I'm not sure how they work.
So the question. Functions like WinGetPos - can be used multiple times like this?
Local $variable1 = WinGetPos(something)
Local $variable2 = WinGetPos(somethingelse)
...
?
I mean - will variables remember these selections after the function is re-triggered on something else?
Splitting text file
Kinda new to autoit. I have this situation where I need to take the print output from a dos program and split the pages apart so it will print properly. This is a 25+ year old program, running in DosBox. The issue is that when printing statements the next page will start on the first, and so on. I've tried different dos->windows printer type programs and none of them will split the pages apart properly.
I had this working at one point but some changes in their system have removed that possibility.
I believe a simple autoit script could do this.
My thinking was something like this:
Read the text file - Easy
Split the pages - Eh
Print the pages -
It's been a while since I've done any coding but I can't figure out how to split the pages apart. Each page starts out "COMPANY NAME, INC". I can split around that but I lose that line or "COMPANY NAME, INC" depending on which method.
Anyone have an idea on splitting?
I found this code
#include <File.au3> Global $FileArray $file = @ScriptDir & "\test.txt" ;"C:\SBT\Incoming\SBTFILE.txt" $newfile = @ScriptDir & "\split-" ; "C:\SBT\Work\SBTFILE-" _FileReadToArray($file, $FileArray) $filecount = 1 $sNewFile_Text = "" ProgressOn("Processing SBT File", "Reading The File...", "0 Lines") For $i = 1 To $FileArray[0] If StringInStr($FileArray[$i], "****** END OF REPORT ******") Then ; We need to write the current file FileWrite($newfile & $filecount & ".txt", $sNewFile_Text & $FileArray[$i]) ; And start a new one $filecount = $filecount + 1 $sNewFile_Text = "" Else ; Add line to string $sNewFile_Text &= $FileArray[$i] & @CRLF EndIf $Percent = Int(($i / $FileArray[0]) * 100) ProgressSet($Percent, $Percent & " Percent Complete") Next ProgressSet(100, "Done", "Complete") Sleep(1000) ProgressOff()
And modified the END OF REPORT to match the string I am looking for but can't figure out how to make it split right before that line. That code makes files like this
File 1:
COMPANY NAME etc
File 2 and so forth:
ADDRESS
** REST OF PAGE **
COMPANY NAME
Your help is appreciated.
What is the error in this code
Hi all.
I am trying to get some data from a SQLite database. But this code is not working. Please suggest where is the error.
And this is my database file.
gui adjustments
anyone knows of a to date function UDF that will help adjusting the gui to scale correctly with labels, font sizes.. (for different desktops/dpi)
I found this topic
http://www.autoitscript.com/forum/topic/93974-fontgui-resizing/#entry675142
I tried to run it with the example but it errors in scite :
$hDC = DllCall("user32.dll", "long", "ReleaseDC", "long", $hWnd, "long", $hDC)
(56) : ==> Variable used without being declared.:
and it seems to be declared
Thanks
Autoit how to implement javascript functions?
Hello coders. I've been working with the FF.au3 extension which allows user to do things in Firefox via javascript (_FFCmd function sends javascript and then returns values)
But in a lot of cases, there may come handy a javascript function, and now I found that it is probably essential to implement one. The case is:
http://stackoverflow.com/questions/15055185/document-getelementsbyclassname-exact-match-to-class
I've got elements with class "item" and class "item one"
if I do
_FFCmd("someMoreThings.getElementsByClassName('item')")
, it picks the items "item one" also. I need to pick only "item". That issue is solved by a javascript/jquery function on stackoverflow forum. How can I do something like that in AutoIt?
Thanks for help, Knuckles
EDIT: I'm thinking of using something like this:
document.getElementsByClassName('item' && !'item one');
JSLint says Weird condition. (so it's probably not the right way to do it)
Listview Group WM_NOTIFY trigger ?
Does anyone know, how to be notified when a Listview Group has been clicked, or expanded, etc. ?
#include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Local $tInfo, $tNMHDR = DllStructCreate($tagNMHDR, $lParam), $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Switch $hWndFrom Case $hWndListView Switch $iCode ; Case $of?????? ; A Group was clicked <---- I need help with this ; No return value Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button ; No return value Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY EndFunc ;==>_DebugPrint If Not StringInStr($CmdLineRaw, "/ErrorStdOut") Then Exit MsgBox($MB_TOPMOST, @ScriptName, 'please run from the editor, thanks', 10) Example() ; Load images ; Add columns ; Add items ; Build groups _GUICtrlListView_SetGroupInfo($idListview, 1, "Group 1", 0, $LVGS_COLLAPSIBLE + $LVGS_COLLAPSED) ; <--- _GUICtrlListView_SetGroupInfo($idListview, 2, "Group 2", 0, $LVGS_COLLAPSIBLE + $LVGS_COLLAPSED) ; <--- ; Loop until the user exits. EndFunc ;==>Example
GIF blinks and plays too fast
I don't know why this is happening but the gif plays smoothly on chrome (link for this gif)
I'm using GIFAnimation UDF from trancexx
#include <WindowsConstants.au3> #include <GIFAnimation.au3> Global $bLoading = "0x4749463839612B000B00F10000FFFFFF07A3F685D1FA07A3F621FF0B4E45545343415045322E300301000000" & _ "21FE1A43726561746564207769746820616A61786C6F61642E696E666F0021F904090A0000002C000000002B000B00000232848E0" & _ "8CB96D9D883F3C50A1BDE56F3CB85E036865859A166277DDE9ABEA70C672D49D787CA2EFAC4B3F93EB8A020324C15000021F90409" & _ "0A0000002C000000002B000B0000023DC48E08CB200F6163B19A84C7AC7CF39861DEF78C6498989FCAA14A434A702CB8076BCDB1A" & _ "DE9240EB20165141A6F58F27D8ECA4ED3E29A2C6252C7AF000021F904090A0000002C000000002B000B0000023D848E08CB300F6163A9" $Form1 = GUICreate("Example", 300, 300, -1, -1, BitOR($WS_THICKFRAME,$WS_SYSMENU)) GUISetBkColor(0xFFFFFF) $hGIF = _GUICtrlCreateGIF($bLoading, "", 125, 120,Default,Default,Default,0xFFFFFFFF) GUIRegisterMsg(133, "_Refresh") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit EndSwitch WEnd Func _Refresh($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GIF_RefreshGIF($hGIF) EndFunc ;==>_Refresh
Using this udf it plays faster and blinks when is beginning the animation again.
Hope I'm doing something wrong, its hard to find cool looking loading gifs with less than 1kb :\
Scripts failing
Hello, I noticed lately my scripts are failing. random parts of my code getting "has failed" errors, is anyone else getting the same issue? My PC might have been hacked or something. I even tried downgrading IE from Version 10 to Version 8. My codes have been working for more than 2 months now, today whenever I run them random codes get errors and I'm not changing anything. Just wondering if anyone else experienced hits