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

Search tree and select items

0
0

Hi @all,

 

Do you know how to scan a tree and select an item. For example is the autoit help file. I expand all the tree and what it has to do next is scan the items with a "history" in its name. If true, it has to select it and sleep for 5 seconds and continue select the next item it finds until end loop. thanks.

#include <GuiTreeView.au3> $file = FileGetShortName("C:\Users\Smgl\Desktop\AutoIt3.chm") Run(@ComSpec & " /c start " & $file) WinWaitActive("AutoIt Help") _GUICtrlTreeView_Expand(ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]","", "[CLASS:SysTreeView32; INSTANCE:1]"),0, True) MsgBox(0,"","") Global $hWnd = ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", "", "[CLASS:SysTreeView32; INSTANCE:1]") $hItemFound = _GUICtrlTreeView_FindItem($hWnd, "History",True) _GUICtrlTreeView_SelectItem($hWnd, $hItemFound)

Attached Thumbnails

  • Untitled.png

Changing variable wrapped in a string

0
0

Hey guys,

 

Say I have;

$Test[0] = "a" $Test[1] = "b" $Test[2] = "c" for $i In $Path     $string = ($i)     send($i) Next

This would obviously send the variable of  $i until the array splits are depleted.

 

However, I would like to use the {"LETTER" DOWN/UP} syntax but i'm having a hard time figuring out how and if I can change the variable each time wrapped in something  like the  button up/down syntax.

 

I was fiddling a bit attempting things like;

$Test[0] = "a" $Test[1] = "b" $Test[2] = "c" for $i In $Path     $string = ("{($i) & "down"}")     send($i) Next

or something along those lines.....

 

So can It be done if so how ?

 

Thanks

Odin

Mouse Hook DLL - Block Input

0
0
The code below is taken from AZJIO from http://www.autoitscript.com/forum/topic/119804-volume-control Sense the Topic was over 3 years old, i felt i should make a new topic to ask my question.

The code allows a user to control the volume control by simily scrolling up and down with his mouse. An extremely cool idea (with some nice visuals i might add) though it is a little problematic as the scrolling itself is not blocked. So you end up at the bottom of a page when you just wanted to turn the volume down.

AutoIt         
#include <GUIConstantsEx.au3> Const $WH_MOUSE = 7 Const $WM_AUTOITMOUSEWHEELUP = 0x1400 + 0x0D30 Const $WM_AUTOITMOUSEWHEELDOWN = 0x1400 + 0x0D31 Global $tr = 0, $setico='', $TrGui=0, $iniTrn, $iniX, $iniY, $iniAtSt, $iniDV, $iniColBk, $iniColVol, $a, $iniHK='', $iniHKM='' $gui = GUICreate("", 30, 135, 0, 0) Global $DLLinst = DllCall("kernel32.dll", "hwnd", "LoadLibrary", "str", ".\hook.dll") Global $mouseHOOKproc = DllCall("kernel32.dll", "hwnd", "GetProcAddress", "hwnd", $DLLinst[0], "str", "MouseProc") Global $hhMouse = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE, "hwnd", $mouseHOOKproc[0], "hwnd", $DLLinst[0], "int", 0) DllCall(".\hook.dll", "int", "SetValuesMouse", "hwnd", $gui, "hwnd", $hhMouse[0]) GUIRegisterMsg($WM_AUTOITMOUSEWHEELUP, "myfunc") GUIRegisterMsg($WM_AUTOITMOUSEWHEELDOWN, "myfunc") While sleep(500) WEnd Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam)    ConsoleWrite("A") EndFunc

Attached File  hook.rar   1.34KB   1 downloads

 

 

Code above, along with the dll, is what i found is needed for seeing if the scroll wheel has been used. 

 

So does anyone know a way i could use this code but also block the scrolling when its detected?

 

Ian

 

*Extra

 

I am aware i could do the same thing with a _API_WindowsSetHookEx but i found using this type of hook makes the mouse laggy. I thought it was just me being weird but after doing some research online it seams that's not the case.

Remote Execution through WMI

0
0

How to open a remote computer program through WMI.

I use WMI Win32_Process remote computer can successfully open Process,But failed to open a graphical interface that only shows running in the Process.

If the remote I run Notepad, how to open it? (Non-Process mode) Like manually open Notepad as open.

 

I am looking for some articles, some say that Windows permissions problem.

 

Code :

  $Username = ""
  $Password = ""
  $Computer = ""
Func RemoteExecute($strProgToRun)

    Local $objWMIService, $objProcess, $objProgram

    $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator")
 

    $objWMI = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $Username, $Password)  
 
    $objWMI.Security_.ImpersonationLevel = 3

    $objProcess = $objWMI.Get("Win32_Process")

    $objProgram = $objProcess.Methods_("Create").InParameters.SpawnInstance_
    $objProgram.CommandLine = $strProgToRun

    $objWMI.ExecMethod("Win32_Process", "Create", $objProgram)                                       

EndFunc

 

Can be performed, but only in Process mode, can not see graphic.

Another psexec can start properly, no problem.

Unexpected behavior of = equals operator conditionals

0
0

AutoIt documentation of operations states, for the '=' operator,

 

= Tests if two values are equal.  e.g. If $var= 5 Then    (true if $var equals 5). Case insensitive when used with strings.

 

However, I have found that when the value to compare to is 0, all string values compare as equal to 0.

For example,

If("Foo" = 0) Then MsgBox(1, "Result", "Apparently, Foo = 0")

Also true for >= and <=

 

This behavior does not occur with the '==' operator.

Local $a="Foo", $b=0, $res="" If("Foo" = 0) Then $res&="Apparently Foo = 0"&@CRLF If ($a = $b) Then $res&="Apparently "&$a&" = "&$b&@CRLF If ($a == $b) Then $res&="Apparently "&$a&" == "&$b&@CRLF If ($a <= $b) Then $res&="Apparently "&$a&" <= "&$b&@CRLF If ($a >= $b) Then $res&="Apparently "&$a&" >= "&$b&@CRLF If ($a < $b) Then $res&="Apparently "&$a&" < "&$b&@CRLF If ($a > $b) Then $res&="Apparently "&$a&" > "&$b&@CRLF $b=1 If ($a = $b) Then $res&="Apparently "&$a&" = "&$b&@CRLF If ($a == $b) Then $res&="Apparently "&$a&" == "&$b&@CRLF MsgBox(1, "Results", $res)

TrueCrypt Volume Creation Automation

0
0

Hey guys, I am very unfamiliar with AutoIt3 and scripting in general. I've been playing with a piece of code I found on these forums a while back trying to automate TrueCrypt volume creation on Windows. The script performs as it should but I have two problems that I could use guidance on.

 

1) Specifying where the TrueCrypt volume is stored at. Right now it goes into the directory of the script.

 

2) Getting around the iniReader, storing the password in a settings.ini file is not the best approach, are there ways to prompt the user for this input? (as well as other configs)

 

Here is what I'm working with 

AutoIt         
#include <winapi.au3> #include <Constants.au3> AutoItSetOption("WinDetectHiddenText", 1) Opt("WinTitleMatchMode", 3) Global $PID_TC_Format = 0 Global $Encryption = iniRead("C:\Users\Cameron\workspace\settings.ini", "settings", "EncryptionAlgorithm", "AES") Global $Hash = iniRead("C:\Users\Cameron\workspace\settings.ini", "settings", "HashAlgorithm", "RIPEMD-160") Global $Size = iniRead("C:\Users\Cameron\workspace\settings.ini", "settings", "SizeInKB", "10000") Global $FileSystemType = iniRead("C:\Users\Cameron\workspace\settings.ini", "settings", "FileSystemType", "NTFS") Global $Password = iniRead("C:\Users\Cameron\workspace\settings.ini", "settings", "Password", "password") Global $Location = iniRead("C:\Users\Cameron\workspace\settings.ini", "settings", "Location", "location")     ConsoleWrite("_TC_Container_Create("") returned " & _TC_Container_Create("") & @TAB & @error & @CRLF) Func _TC_Container_Create($TC_Container_Location = $Location, $TC_Container_Encryption = $Encryption, $TC_Container_Hash = $Hash, $TC_Container_Size_KB = $Size, $TC_Container_Password = $Password, $TC_Container_Filesystem = $FileSystemType)     Local $b_TC_Volume_Creation_Wizard_failed = False, $hWnd_TC_Volume_Creation_Wizard = 0, $TC_Volume_Creation_Wizard_Error_Code = 0     ; NTFS min Size = 2829 KB     ; FAT min Size = 275 KB     ; ControlSetText() if it's just text you're sending. It's much faster.     If Not $TC_Container_Location Then $TC_Container_Location = @ScriptDir & "\Test.tc"     If $TC_Container_Size_KB < 275 Then $TC_Container_Size_KB = 275     If $TC_Container_Size_KB < 2829 Then $TC_Container_Filesystem = "FAT"     If FileExists($TC_Container_Location) Then         If MsgBox(262420, "TCMyFiles", "The Target File" & @CRLF & @CRLF & $TC_Container_Location & @CRLF & @CRLF & "already exists. Do you want to overwrite the file?") <> 6 Then             SetError(99)             Return 0         EndIf         FileDelete($TC_Container_Location)     Else         $TC_Check_Location = FileOpen($TC_Container_Location, 10)         If $TC_Check_Location <> -1 Then             FileClose($TC_Check_Location)             FileDelete($TC_Container_Location)         Else             SetError(96)             Return 0         EndIf     EndIf     $PID_TC_Format = Run('"C:\Program Files\TrueCrypt\TrueCrypt Format.exe"', @ScriptDir, @SW_HIDE)     ;$PID_TC_Format = Run('"' & @ScriptDir & '\TrueCrypt\TrueCrypt Format.exe"', @ScriptDir, @SW_SHOW)     ProcessWait($PID_TC_Format, 5)     If $PID_TC_Format = 0 Then         MsgBox(0, 'Error', '"TrueCrypt Format.exe" new PID could not be detected.')         SetError(98)         Return 0     Else         If WinWait("[TITLE:TrueCrypt Volume Creation Wizard; CLASS:CustomDlg]", "", 10) = 0 Then             MsgBox(0, 'Error', '"TrueCrypt Volume Creation Wizard" window not found...')             SetError(97)             Return 0         Else             $hWnds = WinList("[TITLE:TrueCrypt Volume Creation Wizard; CLASS:CustomDlg]", "")             For $I = 0 To UBound($hWnds) - 1                 If WinGetProcess($hWnds[$I][1]) = $PID_TC_Format Then $hWnd_TC_Volume_Creation_Wizard = $hWnds[$I][1]             Next             If $hWnd_TC_Volume_Creation_Wizard <> 0 Then                 ConsoleWrite('Step 01: Found TrueCrypt Volume Creation Wizard hWnd: ' & $hWnd_TC_Volume_Creation_Wizard & @CRLF)                 $TC_Volume_Creation_Wizard_Error_Code = 1             Else                 $b_TC_Volume_Creation_Wizard_failed = True             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While TimerDiff($TC_Timer) < 5000                     If StringInStr(WinGetText($hWnd_TC_Volume_Creation_Wizard), "Encrypt the system partition or entire system drive") Then                         ControlClick($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:3]')                         ConsoleWrite('Step 02: Create File Container' & @CRLF)                         $TC_Volume_Creation_Wizard_Error_Code = 2                         ExitLoop                     Else                         $b_TC_Volume_Creation_Wizard_failed = True                     EndIf                 WEnd             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While TimerDiff($TC_Timer) < 5000                     If StringInStr(WinGetText($hWnd_TC_Volume_Creation_Wizard), "Volume Type") Then                         ControlClick($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:3]')                         ConsoleWrite('Step 03: Select Standard Type' & @CRLF)                         $TC_Volume_Creation_Wizard_Error_Code = 3                         ExitLoop                     Else                         $b_TC_Volume_Creation_Wizard_failed = True                     EndIf                 WEnd             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While TimerDiff($TC_Timer) < 5000                     If StringInStr(WinGetText($hWnd_TC_Volume_Creation_Wizard), "Volume Location") Then                         ControlSetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Edit; INSTANCE:1]', $TC_Container_Location, 1)                         If ControlGetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Edit; INSTANCE:1]') = $TC_Container_Location Then                             ControlClick($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:3]')                             ConsoleWrite('Step 04: Set Container location to ' & $TC_Container_Location & @CRLF)                             $TC_Volume_Creation_Wizard_Error_Code = 4                             ExitLoop                         EndIf                     Else                         $b_TC_Volume_Creation_Wizard_failed = True                     EndIf                 WEnd             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While TimerDiff($TC_Timer) < 5000                     If StringInStr(WinGetText($hWnd_TC_Volume_Creation_Wizard), "Encryption Options") Then                         ControlCommand($hWnd_TC_Volume_Creation_Wizard, "", "[CLASS:ComboBox; INSTANCE:1]", "SelectString", $TC_Container_Encryption)                         If ControlCommand($hWnd_TC_Volume_Creation_Wizard, "", "[CLASS:ComboBox; INSTANCE:1]", "GetCurrentSelection", "") = $TC_Container_Encryption Then                             ControlClick($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:3]')                             ConsoleWrite('Step 05: Set Encryption Algorithm to ' & $TC_Container_Encryption & @CRLF)                             $TC_Volume_Creation_Wizard_Error_Code = 5                             ExitLoop                         EndIf                     Else                         $b_TC_Volume_Creation_Wizard_failed = True                     EndIf                 WEnd             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While TimerDiff($TC_Timer) < 5000                     If StringInStr(WinGetText($hWnd_TC_Volume_Creation_Wizard), "Volume Size") Then                         If _WinAPI_GetWindowLong(ControlGetHandle($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:6]'), $GWL_STYLE) <> 1342373897 Then                             ControlClick($hWnd_TC_Volume_Creation_Wizard, "", ControlGetHandle($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:6]'))                         ElseIf _WinAPI_GetWindowLong(ControlGetHandle($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:6]'), $GWL_STYLE) = 1342373897 Then                             ConsoleWrite('Step 06: Select KB as Container Size' & @CRLF)                             $TC_Volume_Creation_Wizard_Error_Code = 6                             ExitLoop                         EndIf                     Else                         $b_TC_Volume_Creation_Wizard_failed = True                     EndIf                 WEnd             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While TimerDiff($TC_Timer) < 5000                     If StringInStr(WinGetText($hWnd_TC_Volume_Creation_Wizard), "Volume Size") Then                         ControlSetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Edit; INSTANCE:1]', $TC_Container_Size_KB, 1)                         If ControlGetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Edit; INSTANCE:1]') = $TC_Container_Size_KB Then                             ControlClick($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:3]')                             ConsoleWrite('Step 07: Set Container Size to ' & $TC_Container_Size_KB & ' KB' & @CRLF)                             $TC_Volume_Creation_Wizard_Error_Code = 7                             ExitLoop                         EndIf                     Else                         $b_TC_Volume_Creation_Wizard_failed = True                     EndIf                 WEnd             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While TimerDiff($TC_Timer) < 5000                     If StringInStr(WinGetText($hWnd_TC_Volume_Creation_Wizard), "Volume Password") Then                         ControlClick($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:6]')                         ControlSetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Edit; INSTANCE:1]', $TC_Container_Password, 1)                         If ControlGetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Edit; INSTANCE:1]') = $TC_Container_Password Then                             ControlSetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Edit; INSTANCE:2]', $TC_Container_Password, 1)                             If ControlGetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Edit; INSTANCE:2]') = $TC_Container_Password Then                                 ControlClick($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:3]')                                 ConsoleWrite('Step 08: Set Container Password to "' & $TC_Container_Password & '"' & @CRLF)                                 $TC_Volume_Creation_Wizard_Error_Code = 8                                 ExitLoop                             EndIf                         EndIf                     Else                         $b_TC_Volume_Creation_Wizard_failed = True                     EndIf                 WEnd                 ControlClick("[TITLE:TrueCrypt Volume Creation Wizard; CLASS:#32770]", '', '[CLASS:Button; INSTANCE:1]')             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While TimerDiff($TC_Timer) < 5000                     If WinExists("[TITLE:TrueCrypt Volume Creation Wizard; CLASS:#32770]", "") = 1 Then ControlClick("[TITLE:TrueCrypt Volume Creation Wizard; CLASS:#32770]", '', '[CLASS:Button; INSTANCE:1]')                     If StringInStr(WinGetText($hWnd_TC_Volume_Creation_Wizard), "Volume Format") Then                         ControlCommand($hWnd_TC_Volume_Creation_Wizard, "", "[CLASS:ComboBox; INSTANCE:1]", "SelectString", $TC_Container_Filesystem)                         If ControlCommand($hWnd_TC_Volume_Creation_Wizard, "", "[CLASS:ComboBox; INSTANCE:1]", "GetCurrentSelection", "") = $TC_Container_Filesystem Then                             ConsoleWrite('Step 09: Set Container File Format to ' & $TC_Container_Filesystem & @CRLF)                             $TC_Volume_Creation_Wizard_Error_Code = 9                             ControlClick($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Button; INSTANCE:3]')                             ExitLoop                         EndIf                     Else                         $b_TC_Volume_Creation_Wizard_failed = True                     EndIf                 WEnd             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Container_Creation_Progress = ""                 $TC_Container_Creation_Progress_Save = ""                 $TC_Timer = TimerInit()                 While 1                     $TC_Container_Creation_Progress = StringReplace(ControlGetText($hWnd_TC_Volume_Creation_Wizard, '', '[CLASS:Static; INSTANCE:12]'), "%", "")                     If ($TC_Container_Creation_Progress <> $TC_Container_Creation_Progress_Save) And $TC_Container_Creation_Progress <> 100 Then                         $TC_Timer = TimerInit()                         $TC_Container_Creation_Progress_Save = $TC_Container_Creation_Progress                         ConsoleWrite("Step 10: Container creation progress: " & $TC_Container_Creation_Progress & "%" & @CRLF)                     EndIf                     If $TC_Container_Creation_Progress = 100.000 Then                         ConsoleWrite("Step 10: Container creation progress: " & $TC_Container_Creation_Progress & "%" & @CRLF)                         $TC_Volume_Creation_Wizard_Error_Code = 10                         ExitLoop                     EndIf                     If TimerDiff($TC_Timer) > 5000 Then                         ConsoleWrite("Step 10: No progress in 5 seconds... failure?" & @CRLF)                         $b_TC_Volume_Creation_Wizard_failed = True                         ExitLoop                     EndIf                 WEnd             EndIf             If $b_TC_Volume_Creation_Wizard_failed = False Then                 $TC_Timer = TimerInit()                 While 1                     If WinExists("[TITLE:TrueCrypt Volume Creation Wizard; CLASS:#32770]", "The TrueCrypt volume has been successfully created.") = 1 Then                         ControlClick("[TITLE:TrueCrypt Volume Creation Wizard; CLASS:#32770]", '', '[CLASS:Button; INSTANCE:1]')                         ConsoleWrite("Step 11: Container creation finished successfully" & @CRLF)                         $TC_Volume_Creation_Wizard_Error_Code = 11                         ExitLoop                     EndIf                     If TimerDiff($TC_Timer) > 15000 Then                         ConsoleWrite("Step 11: Progress at 100% but TC failed to notify about success for 15 seconds...failure?" & @CRLF)                         $b_TC_Volume_Creation_Wizard_failed = True                         ExitLoop                     EndIf                 WEnd             EndIf         EndIf     EndIf     SetError($TC_Volume_Creation_Wizard_Error_Code)     If $b_TC_Volume_Creation_Wizard_failed = True Then         Return 0     Else         Return 1     EndIf EndFunc   ;==>_TC_Container_Create Func OnAutoItExit()     ProcessClose($PID_TC_Format) EndFunc   ;==>OnAutoItExit

ControlClick() just not interacting with Dialog

0
0

Let's start with the code

#include <array.au3> #include <GuiComboBox.au3> #RequireAdmin Func _WinWaitActivate($title, $text, $timeout = 5) WinWait($title, $text, $timeout) If Not WinActive($title, $text) Then WinActivate($title, $text) If Not WinWaitActive($title, $text, 5) Then   Return 0 Else   Return 1 EndIf EndFunc   ;==>_WinWaitActivate _WinWaitActivate("Dexterity Runtime","") ControlClick("Dexterity Runtime","","[CLASS:Button; INSTANCE:1]")

No matter how hidden I make the "Dexterity Runtime" window, _WinWaitActivate does great finding it and bringing it to the forefront.

 

ControlClick("Dexterity Runtime","","Button1") didn't help

 

I also tried several MouseClick variants as well, but no matter what I've tried this window just won't click off.

 

Here's the relevant WindowInfo output:

Plain Text         
>>>> Window <<<< Title: Dexterity Runtime Class: TNTDLG Position: 717, 320 Size: 486, 200 Style: 0x94C00000 ExStyle: 0x00000101 Handle: 0x00000000001E1280 >>>> Control <<<< Class: Button Instance: 1 ClassnameNN: Button1 Name: Advanced (Class): [CLASS:Button; INSTANCE:1] ID: 1 Text: OK Position: 200, 132 Size: 80, 24 ControlClick Coords: 52, 12 Style: 0x5000030B ExStyle: 0x00000000 Handle: 0x00000000002211F8 >>>> Mouse <<<< Position: 972, 489 Cursor ID: 0 Color: 0xDDDDDD >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< OK >>>> Hidden Text <<<<

This is my third go-round with this, and I am just at a loss as to why it isn't working.

 

DiR create @SCRIPT DIR, by variable

0
0

Hi guys

 

Its a stupid question, but I'm just a noob that want to learn this magnificent tools, anyway I'm try to create folder in aplication by varible, I read the help file, and still doesnt create anything

 

please correct my code

$keyword = GUICtrlRead($Input1) DirCreate(@ScriptDir & $keyword)

thanks guys


_IEFormElementSetValue in INPUT - $o_object.fireEvent("OnClick")^ ERROR

0
0

I use IE in for next loop

to set value in INPUT and search something on the web

when site take me back response then I read what I need and back to home site

and again set value ....

 

 

 

<INPUT style="WIDTH: 135px" id=MainContent_txtAdvPesel maxLength=11 type=text name=ctl00$MainContent$txtAdvPesel>

 

$oIE_aspnetForm = _IEGetObjById($oIE, "aspnetForm") $oIE_aspnetForm_ctl00_MainContent_txtAdvPesel = _IEFormElementGetObjByName($oIE_aspnetForm, "ctl00$MainContent$txtAdvPesel")   ;When I use Consolewrite(isobj($oIE_aspnetForm_ctl00_MainContent_txtAdvPesel) & @CRLF) ;then result is always = 1     ;I Check to be sure that I have taken correct OBJ Consolewrite($oIE_aspnetForm_ctl00_MainContent_txtAdvPesel.name & @CRLF) ;then result is always = ctl00$MainContent$txtAdvPesel       ;so why not always but very often ;this function _IEFormElementSetValue($oIE_aspnetForm_ctl00_MainContent_txtAdvPesel, $s_new_value, 1) ; return to me that error

 

 

;~ C:\Program Files\AutoIt3\Include\ie.au3 (1307) : ==> The requested action with this object has failed.:

 

;~ $o_object.fireEvent("OnClick")
;~ $o_object.fireEvent("OnClick")^ ERROR
 

 

 

 

I do severals test by adding

 

sleep - do not take any diffrence 

trying to _IEAction($oIE_aspnetForm_ctl00_MainContent_txtAdvPesel,"click") - before SetValue

trying to _IEAction($oIE_aspnetForm_ctl00_MainContent_txtAdvPesel,"focus") - before SetValue

 
 
Click And Focus give me back that same errors
 
When I start again "For ... to ..." then its can do for example 50 more steps and crash 
sometimes do only 10 step somtimes 30 steps a 
 
 

Need Help Saving A Webpage (Internet Explorer)

0
0

Hello,

 

I got AutoIt to call up a web page and used

 

Send("{ALT}")
Send("f")
Send("a")

 

to call up the "Save Webpage" dialog box, but for the life of me I can't access the box. In addition to the direct approach, I tried these lines:

 

WinActivate("Save Webpage", "")
Send("Testfile")
Send("{ENTER}")

 

and:

 

WinActivate("[CLASS:Save Webpage]", "")
Send("Testfile")
Send("{ENTER}")

 

Neither of them worked to save "Testfile.htm" [the test name for the Webpage I'm trying to save] from the open dialog box.

 

How do I script it so that AutoIt saves the Webpage? Are there some commands that can access the dialog box, or should I use a different approach entirely?

 

As the lines above indicate, I just want to save the webpage raw - nothing fancy :)

 

 

Thanks.

MsgBox returns 0

Saving data from a Google Chrome page

0
0

I'm working on a script to open a series of webpages, extract and save certain information, then output that information.  To do this, I open the webpage, send a control+a, send a control+c, then paste the webpage to notepad and use StringRegExp to find the relevant data.  

 

The problem I am having is that the information on certain webpages loads in a chart, which loads after the webpage has loaded, thus using ShellExecuteWait or WinWait doesn't make the program wait until the information I want is actually there and so when I copy the webpage the important information isn't copied.  My solution at this point is just to Sleep(1000), which usually gives enough time for the entire page to load, however occasionally there is not enough time and I cannot be certain of the internet speeds everywhere this program is to be used.

 

I have searched the forums/web and found a few potentially helpful solutions with Internet Explorer, however I would much rather use Google Chrome. Is there a way to wait for all/certain parts of a Google Chrome webpage to respond before continuing the code? Or should I just admit defeat and recode for use with Internet Explorer? Or is there a better way all together to accomplish this with Google Chrome?

 

Any and all help or advice is appreciated.

Error: Unknown function name?

0
0

Hey guys i was  editing this script my friend gave me and changed it to suit my needs but for some reason i get the error.
I'm not sure what the problem with it is because it seems fine to me but i am new to this so any help would be greatly appreciated.

It gives me Error: Unknown function name 
line 16
I'm not sure what is the problem there because it seems fine to me but i am new to this so any help would be greatly appreciated.
 
Here is the script.
 
 

AutoIt         
Dim $Kill, $Delay, $Delay2 HotKeySet("{F9}", "Start") ; F9 to Start HotKeySet("{F10}", "Stop") ; F10 to Stop   $Delay = 1000 ; NPC Chat Delay $Delay2 = 7000 ; 10sec wait before redoing / reaccepting the quest.     While 1     Sleep(200) WEnd   Func Stop()     $Kill = True EndFunc                                                                                                   THE PROBLEM IS THIS LINE Func Start()     $Kill = False     While Not $Kill         Opt("MouseCoordMode", 0)   WinWaitActivate("Age of Wushu  Launch-BlueDragon","")     MouseClick("right",374,105,1) Sleep($Delay) MouseClick("left",289,488,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",423,106,1) Sleep($Delay) MouseClick("left",289,486,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",465,108,1) Sleep($Delay) MouseClick("left",291,485,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",501,110,1) Sleep($Delay) MouseClick("left",261,490,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",557,117,1) Sleep($Delay) MouseClick("left",282,481,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",599,103,1) Sleep($Delay) MouseClick("left",242,487,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",387,155,1) Sleep($Delay) MouseClick("left",278,486,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",422,148,1) Sleep($Delay) MouseClick("left",267,486,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",472,162,1) Sleep($Delay) MouseClick("left",285,482,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",508,145,1) Sleep($Delay) MouseClick("left",256,486,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",549,156,1) Sleep($Delay) MouseClick("left",279,494,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",595,155,1) Sleep($Delay) MouseClick("left",262,489,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",382,195,1) Sleep($Delay) MouseClick("left",301,486,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",424,199,1) Sleep($Delay) MouseClick("left",280,487,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",470,193,1) Sleep($Delay) MouseClick("left",303,487,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",507,197,1) Sleep($Delay) MouseClick("left",281,481,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",552,193,1) Sleep($Delay) MouseClick("left",287,484,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",590,192,1) Sleep($Delay) MouseClick("left",257,491,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",380,238,1) Sleep($Delay) MouseClick("left",295,490,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",431,238,1) Sleep($Delay) MouseClick("left",300,483,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",461,232,1) Sleep($Delay) MouseClick("left",277,486,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",508,238,1) Sleep($Delay) MouseClick("left",273,498,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",554,234,1) Sleep($Delay) MouseClick("left",284,486,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",598,237,1) Sleep($Delay) MouseClick("left",267,487,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",385,279,1) Sleep($Delay) MouseClick("left",282,490,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",421,289,1) Sleep($Delay) MouseClick("left",276,487,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",459,284,1) Sleep($Delay) MouseClick("left",286,492,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",513,279,1) Sleep($Delay) MouseClick("left",268,493,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",554,282,1) Sleep($Delay) MouseClick("left",281,483,1) Sleep($Delay) Sleep($Delay2) MouseClick("right",599,273,1) Sleep($Delay) MouseClick("left",274,496,1) Sleep($Delay) Sleep($Delay2)     WEnd EndFunc

Thanks

Calling Specific Functions Within Script/Compiled Exe

0
0

Hi,

 

I have written a large AutoIT script which monitors multiple aspects of a program.  It is contains service checking as well as specific db connection and look ups.  Currently the way I've designed this is to define each of these functions on one script and then write a separate script with an include to call them.  I would like to find a way that I can schedule certain functions within this script at different times to others. 

 

I am aware that I can compile this script and use windows scheduler to call it but I wanted to know if there is a way I can call specific functions or parts of the script without having to compile multiple different exes?

 

Thanks,

Rob

Exe issues on windows 7

0
0

Hy all fhirst of all i'm sorry if is another post like this but i didn't findit so that's why i'm am posting.I need a little help.I am a noob in programing but i have finished scripting a program.On my machine it work perfectly but i giveit to a friend to test it and for him doesn't work the Send comand who send some keys can anyone help me make the script fit to any windows??

i forgot to mentioned cuz my friend has windows 7 and me xp sp3.Thanks for your help and sorry if is another post like this.


Recording musics :

0
0

                              
Hey people,                                
                                
I'd like to know how I can save or record music from Spotify without paying for it? Do not quite know if this is legal, but I think if I do it with Spotify , it might not be as bad as the youtube or something, because that is much more popular ...? Any tips?                                
                                
Thanks in advance.                                
                      

edit or run .au3 files

0
0

I updated AutoIt to version 3.3.8.1
There was a question to uninstall the previous version which I did, but no
option to select edit or run .au3 files.
When I click on a sourcefile I don't get the SceTE editor what I want, but
the script executes, that is not what I want.

How do I change that in Windows-8

 

 

update e-mail ?

0
0

When everything works fine then I forget AutoIt.
I don't get a e-mail telling me that an new version exists.
I don't know if that can be turned on somewhere ?

Hook Double click

0
0

Hi guys, i'm experimenting WinAPI and Set Windows Hook Ex. Everything work as expected except double click:

AutoIt         
#include <WindowsConstants.au3> #include <WinAPI.au3> HotKeySet("{Esc}", "Cleanup") Global $hHook, $hStub_KeyProc _Main() Func _Main()     Local $hmod     $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")     $hmod = _WinAPI_GetModuleHandle(0)     $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod)     While 1         Sleep(10)     WEnd EndFunc   ;==>_Main ;=========================================================== ; callback function ;=========================================================== Func _KeyProc($nCode, $wParam, $lParam)     Local $tKEYHOOKS, $X, $Y, $Delta     $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)     If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)     Switch $wParam         Case $WM_LBUTTONDBLCLK             ConsoleWrite("LBUTTONDBLCLK" & @CRLF)     EndSwitch     Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc   ;==>_KeyProc Func Cleanup()     _WinAPI_UnhookWindowsHookEx($hHook)     DllCallbackFree($hStub_KeyProc)     Exit EndFunc   ;==>Cleanup

I don't see any ConsoleWrite...How i can resolve? Where is my error?

Thanks

Attempting to sort from multiple arrays and input into Excel

0
0

I have been working on a project for an insurance customer to connect to an Oracle db and pull a bunch of policy holder info. They would then like the data placed into an Excel spreadsheet. Unfortunately, because the data sets that I need to work from will be different each time, I'm finding it difficult to fulfill the objectives.

 

1. I pull the data from the database and plug it into a temp excel spreadsheet, performing some minor formatting. The temp worksheet looks like this:

 

1.png

 

2. I create an array of unique effective dates, and an array of unique class codes. Always 7 effective dates (not always the same dates), but anywhere from 1 to 16 Class Codes. These numbers are then plugged into the Master worksheet:

 

2.png

 

3. I then need to iterate through each row in the temp worksheet. I need to plug the sum value into the correct cell, by both the class code and the effective date. I was able to create something that works very well (below), but only when I know the value and number of class codes:

AutoIt         
  1.     $b = 32
  2.     $c = 32
  3.  
  4.     For $i = 2 To 500
  5.         $ccode = _ExcelReadCell($oExcel, $i, 1)
  6.             Select
  7.                 Case $ccode = ""
  8.                     ExitLoop
  9.                 Case $ccode = "0042"
  10.                     $line = $b
  11.                     $effDate = _ExcelReadCell($oExcel, $i, 5)
  12.                     $sum = _ExcelReadCell($oExcel, $i, 3)
  13.                     _ExcelWriteCell($oExcel1, $effDate, $b, 1)
  14.                     _ExcelWriteCell($oExcel1, $sum, $b, 3)
  15.                     $b += 1
  16.                 Case $ccode = 5183
  17.                     $line1 = $b
  18.                     $effDate = _ExcelReadCell($oExcel, $i, 5)
  19.                     $sum = _ExcelReadCell($oExcel, $i, 3)
  20.                     _ExcelWriteCell($oExcel1, $effDate, $c, 1)
  21.                     _ExcelWriteCell($oExcel1, $sum, $c, 4)
  22.                     $c += 1
  23.             EndSelect
  24.     Next
  25.  
  26.     _ExcelBookSaveAs($oExcel1, @DesktopDir & "\Output.xls", "xls", 0, 1)

I'm guessing I would need to do something like this, but have yet to get it to work:

 

   Start with the array of class codes.

   Loop through each row in the temp workbook.

   On each row, find the effective date and jump to that row in the Master Workbook.

   On each row, find the class code and jump to that column in the Master Workbook.

   Write that row's SUM value to the corresponding cell in the Master Workbook.

 

Any suggestions would be greatly appreciated, or if there is another way to do this logically.

Viewing all 12506 articles
Browse latest View live




Latest Images