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

Problem with _IsPressed

$
0
0

Trying to make different small scripts to learn autoit, this time I'm trying to make a script that when a button is pressed it will click in 1 place then click in another place then return the mouse to it's original position.

 

This is the original one that I made which works.

HotKeySet("c", "practice") while 1     sleep(1) WEnd Func practice()         $pos=MouseGetPos()         MouseClick("left",100,922,1,0)         MouseClick("left",200,921,1,0)         MouseMove($pos[0],$pos[1],0) EndFunc

The problem is when I try to implement an On/Off hotkey, I can no longer find a way to make it work. (ideally just 1 hotkey for turning on and off but would be nice to learn with 2 hotkeys as well)

Here is what I tried:

AutoIt         
#include <Misc.au3> HotKeySet("{F1}", "_Pause") Global $Paused = False HotKeySet("c") While 1     If Not $Paused Then         If _IsPressed("c") Then             $pos=MouseGetPos()             MouseClick("left",100,922,1,0)             MouseClick("left",200,921,1,0)             MouseMove($pos[0],$pos[1],0)         EndIf     EndIf WEnd Func _Pause()     $Paused = Not $Paused EndFunc

But this code doesn't seem to be doing anything at all  :


Help with StringRegExp

$
0
0

I'm trying to find the last decimal number from a text file.  Problem is that the array that is returned will return multiple values, but only from the first line in which they occur, not from additional lines in the file.

$tmpTxt = "tmptxt.txt" $aFile = FileOpen($tmpTxt) $file = FileRead($aFile) $regex = StringRegExp($file,'([0-9]{1,5}\.[0-9]{2})(.*)', 1)

Thanks for any help you can provide.

SNMP request returning weird output

$
0
0

Sorry for posting this here, the other board is being spam by some jerk so I'm posting this here temporarily

 

I'm trying to retrieve a snmp output from my router, I can do it using "snmpwalk 5.7.0" and "MIB Browser", so is not a problem with router configuration. 

AutoIt         
#include "snmp_UDF-v1.7.4.au3" Global $Port = 161 ; UDP 161 = SNMP port Global $SNMP_Version = 2 ; SNMP v2c (1 for SNMP v1) Global $SNMP_Community = "public" ; SNMPString(Community) (change it) Global $SNMP_ReqID = 1 Global $SNMP_Command Global $Start = 1 Global $result Global $Timeout_msec = 2500 UDPStartup() $Socket = UDPOpen('192.168.1.1', $Port) $SNMP_Command = _SNMPBuildPacket('.1.3.6.1.2.1.1.5', $SNMP_Community, $SNMP_Version, $SNMP_ReqID, "A0") UDPSend($Socket, $SNMP_Command) _StartListener() Sleep(200) UDPCloseSocket($Socket) UDPShutdown() Sleep(200) Exit Func _StartListener()     If $Start = 1 Then         $Timeout = TimerInit()         While (1)             $srcv = UDPRecv($Socket, 1200)             If ($srcv <> "") Then                 $result = _ShowSNMPReceived($srcv)                 ConsoleWrite("received: " & $srcv &@LF)                 ;_ArrayDisplay($result)                 ExitLoop             EndIf             Sleep(100)             If TimerDiff($Timeout) > $Timeout_msec Then                 ExitLoop             EndIf         WEnd     EndIf EndFunc   ;==>_StartListener Func OnAutoItExit()     UDPCloseSocket($Socket)     UDPShutdown() EndFunc   ;==>OnAutoItExit

Request oid: .1.3.6.1.2.1.1.5

Expected result: TP-LINK

Received: 0x3082002E02010104067075626C6963A282001F020101020100020100308200123082000E060A2B0001030601020101058000 [ascii: 0‚.public¢‚0‚0‚ +€]

 

what am I doing wrong here? There's other cleaner way of doing this, like _snmpGet(server,comunity, oid)?

thanks for your time :)

 

EDIT: So, there's an output when I use "A1" parameter (but not the correct one), but with A0 I returns 0 or something like that

really quick easy question

$
0
0

so i want this to work 

#cs ----------------------------------------------------------------------------  AutoIt Version: 3.3.12.0  Author:         myName  Script Function:     Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ProcessClose ( "Acrobat.exe" ) $PR = InputBox("2CB COMP + TAAL", "1") Run("F:\2CB\" $PR ".indd")

I want it to run what is inserted in the inputbox and add .indd after it

Run Excel VBA Macro via AutoIt...

$
0
0

Hi Guys,

I used to use the following: 

$Excs = _ExcelBookOpen("C:\Us\Excs.xlsm", 0) Sleep(1000) $Excs.Run("MAIN_DS");

But after the Excel.au3 was re-write it doesn't work. 

I've had a look at https://www.autoitscript.com/autoit3/docs/libfunctions/Excel%20Management.htm mainly, [url=https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_BookOpen.htm and [url=https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_Open.htm but I can't seem to open the file nor can I find anything about how to run a macro.

Any advise would be very much welcome.

Following _Excel_BookOpen I get the following error...
 NJNZxYv.png

 

I'm using Excel 2013 64bit.

How add to combobox +20.000 lines FAST ?

Extract function from AU3

$
0
0

Hi guys,

Since i don't want to reinvent the wheel, i'm asking if is exist in Scite or some external example/UDF to extract a function from a script and paste it on another file. I need to get all the MsgBox from my long code and check if there are correct ( the code is multilinguage so i need to verify for every language if there is something wrong or misspelling )

The final code i'd like to have is like this:

MsgBox(16, $aArray[1][$iLang], $aArray[2][$iLang]) ; there is a comment in my language for the original one MsgBox(16, $aArray[3][$iLang], $aArray[4][$iLang]) ; there is a comment in my language for the original one ;etc.

Thaks for the help :D

Mass Spam Attack - Please Do Not Report The Posts

$
0
0
Hi,

As you have probably all noticed we have been under a mass attack from what seems to be a Korea spammer over the past few days. We are doing our best to limit the damage, but short of cutting off all access from most of that part of the world there is not a lot we can do to prevent it. sad.png

Now we know that it is happening on a regular basis, PLEASE DO NOT REPORT THE SPAM POSTS - they are obvious to anyone viewing the forum and it makes even more work for us to deal with the aftermath if lots of well-meaning people all report different posts. We try and clean up the mess as soon as we can, but contrary to the opinions of some the Mods are all human and do have to sleep sometimes! wink.png

Thanks for your cooperation. smile.png

M23

IE value does not post to field

$
0
0

I'm puzzled.

I can find the elements and have confirmed the names. But the values do not change with this script.

    ;;;; go through new screen and insert ID & BIRTH     Local $cID = "00401889792"     Local $cBirthDate = "07/21/2004"     $oForms  = _IEFormGetCollection ($oIE )     For $oForm In $oForms         $oElements = _IEFormElementGetCollection ($oForm)         For $oElement IN $oElements             If $oElement.name = "txtMemberId" Then                 _IEFormElementSetValue( $oElement , $cID )                 $oElement.value = $cID         ; redundant attempt to assign value                 MsgBox(1, "found ID",@error )  ; pops up and confirms name found             EndIf             If $oElement.name = "txtDob" Then                 _IEFormElementSetValue( $oElement , $cBirthDate )             EndIf         Next     Next

Is there a better way to assign a new value??

Thank in advance

 

Jim Rumbaugh

 

SciTe - How to Clear Most Recently Used Files List

$
0
0

Hi,

 

Does anyone know how to clear the most recently used files list that can be seen in the SciTe editor by clicking on the 'File' menu?

 

(I've searched this forum, the web and inside the windows registry to see where this MRU information is kept, and how to clear it, - can't find it anywhere.)

Which change in the beta fixed my IE.au3 bug?

$
0
0

I was about to open a defect against 3.3.12.0, but decided for completeness to retest using the beta and sure enough my symptoms have gone away.  Now I'm trying to find why, and none of the issues listed in the bug tracker seem likely.  So I'm really looking for some reassurance that this was fixed and not something I'm going to see as a regression in the future.

 

I distilled the relevant bits of code down to the following reproduction.

Windows XP/IE 8/AutoIt 3.3.12.0 - seems fine.

Windows 8.1/IE 11/AutoIt 3.3.12.0 - _IEFrameGetObjByName fails ~0.5% of the time.

Windows 8.1/IE 11/AutoIt Beta 3.3.13.19 - seems fine.

 

AutoItSetOption("MustDeclareVars", 1) #include <IE.au3> Local $o_IE = _IEAttach("_IE_Example", "title") If Not IsObj($o_IE) Then     $o_IE = _IE_Example("frameset") EndIf Local $oFrameMain = _IEFrameGetObjByName($o_IE, "Main") If IsObj($oFrameMain) Then     ConsoleWrite("Object" & @CRLF) Else     ConsoleWrite("Not an object" & @CRLF) EndIf

Line 701 (File "c:\Program Files (x86)\AutoIt3\Include\IE.au3"):

If $oFrames.length Then

If $oFrames& ERROR

Error: Variable must be of type "Object".

 

 

In my real app after generous attempts at recovery all of which fail (it acts like the IFrame is missing, but it's clearly there) the final recovery is to "clone" the current request by launching AutoIt with the current script, with the current parameters, and return the child return code.  Presumably this simply pushes the failure rate from 0.5% down to 0.0025% (in fact it's recursive with no limit, so for that one in 40,000 failure it will just retry deeper and deeper clones until RunWait() fails).

 

I'm at a loss as to how AutoIt can _IEAttach() fine in every case, but when failing no amount of retrying _IEAttach, _IELoadWait, _IEFrameGetObjByName, added delays, etc. within that process can make that IFrame accessible, yet launching AutoIt again in a new process generally works.  Yet the beta has mysteriously changed this for the better.

ControlSend for Chrome

$
0
0

Hi guys, i'm trying to send a command to Chrome with ControlSend, but i can't, i had read some @junkew post about this, but is too much information for now, i need some fix quickly, can you guys help me please.

 

This is the code i tried, with no success:

ControlSend("[CLASS:Chrome_WidgetWin_1]", "", 199624464, "Test")

Math and progressbar

$
0
0

Hi,

Everytime is always hard for me to explain all the situation :D

So, i need to "monitor" a file download from a different software, example this file is called:

File1.exe.part

 

Of this file i know the original size, File1.exe, example it is 10MB

I'm using Adlib in this way:

AdlibRegister("_Monitor") Func __Monitor()     Local Static $iStartingSize = 10000 ; 10MB, i'll change the value dinamically     Local $iCurrentSize = FileGetSize("File1.exe.part")     If $iCurrentSize <> $iPreviousSize Then         $iPreviousSize = $iCurrentSize         GUICtrlSetData($hProgress, Int($iCurrentSize / ($iStartingSize) * 100))     EndIf EndFunc   ;==>__MonitorFile_Crypt

Until that work, i'm fill the progressbar at 100% and i know when is done using WinGetHandle of the original software for stopping it.

 

But with 1 file... but i have more than 1 :D

Example if i have 4 file the progressbar need to fill at 100% only if all the files are download.

 

Pratically from 0 to 25% file 1, from 25% to 50% file 2 but always base this value on the real size of the file.

 

The question is, How to use GUICtrlSetData for partially fill the progressbar like from 0-25 25-50 instead of from 0 to 100% but always based on filesize?

If something is not clear...i can't post any code this time i don't know how to reproduce the script

_MsgBox UDF Problem

$
0
0

Hello, why is the below code not splitting buttons? (_MsgBox)

_MsgBox(48, "Test", "Test", -1, 0, "Pest|Paste")

TD :)

Net Time

$
0
0

Someone knows if there is some means or udf to syncronize periodically time and date with a domain server without using the DOS utility Net.exe by Net /time ?.

 

This is, doing it just inside AutoIt; some dll call may be ?


Help the hotkey

$
0
0

I am new in autoit programming.
Used for a long time ahk.
In ahk there is a $ you use the key and more the function of the script.
I wonder if the autoit have something?

example:
I use left is script will use to left and then up.
script:

$left:: send {left} send {up} return

In Autoit there doing this?

Browser has been deleted, _iecreate failure

$
0
0

Ive been working on a great script the last two weeks. Everything is ironed out and working great. All my IE calls are solid and working. Today I go into the business to test the latest code and using the EXACT code from yesterday that worked, does not today.

 

There site is an internal one, which is added to there trusted zones on their browsers. It is in IE8, all environments are windows 7.

 

Now it was working yesterday, but today when creating a blank browser it works. I can navigate that browser to google.com and it works just fine. As soon as I navigate it to there internal site that object reference is no longer valid. I get the Browser has been deleted error. I cannot use that reference any longer.

 

Ive tried getting the window handle after creation and using that at the later point when this happens... no luck. Ive tried reattaching via the title and no luck. Ive tried many ways to get around this however it comes back to the problem of, it worked yesterday but not today.

 

 

Any suggestions on where to go? Im hoping it fixes itself overnight, but is there any way to deal with this error? It happens on multiple computers (4 tested) and they all run into the same error. So I know its not just one user messing up their settings.

 

The real kicker is, there is one computer (out of a possible 5) that is pretty much identical to the rest except it runs on that one just fine. Same code, same OS, same everything. Why is this happening?

 

Can't interact with router webpage

$
0
0

I've tried on and off for over a year now, but without any success.What I'm trying to do is simply make a script that will disconnect the router, wait about 12 seconds then reconnect.

 

- Tried adapting the script from my old router, but no dice: 

$sPOST = 'STOP0=%C4%E4%BB%DF&sWebSessionnum=0&sWebSessionid=-0000000000' $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST",  "http://192.168.11.1/cgi-bin/cgi?req=frm&frm=info.html", False, "admin","password") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sPOST)

- Tried reading up on how to make AutoIt click a webpage button... but the guides were rather obtuse from my point of view, couldn't even get a basic script together.

 

- Tried using packets with TCPStartup>TCPConnect>TCPSend ... also didn't work, packet data was pulled from 2 sources, Wireshark and JDownloader. No difference, it didn't throw any errors, but didn't cut the connection either, so I'm without any ideas to where to go from here.

Plain Text         
$packet1 = 'GET / HTTP/1.1'&@CRLF& _ 'source: 192.168.11.2'&@CRLF& _ 'Host: 192.168.11.1'&@CRLF& _ 'user-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0'&@CRLF& _ 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'&@CRLF& _ 'accept-language: en-US,en;q=0.5'&@CRLF& _ 'accept-encoding: gzip, deflate'&@CRLF& _ 'authorization: Basic YWRtaW46cGFzc3dvcmQ='&@CRLF& _ 'credentials: admin:password'&@CRLF& _ 'connection: keep-alive'&@CRLF& _ 'if-modified-since: Tue, 30 Jul 2013 04:17:10 GMT'&@CRLF& _ 'cache-control: max-age=0'&@CRLF&@CRLF $packet2 = 'POST /cgi-bin/cgi?req=frm&frm=info.html HTTP/1.1'&@CRLF& _ 'source: 192.168.11.2'&@CRLF& _ 'Host: 192.168.11.1'&@CRLF& _ 'user-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0'&@CRLF& _ 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'&@CRLF& _ 'accept-language: en-US,en;q=0.5'&@CRLF& _ 'accept-encoding: gzip, deflate'&@CRLF& _ 'authorization: Basic YWRtaW46cGFzc3dvcmQ='&@CRLF& _ 'credentials: admin:password'&@CRLF& _ 'connection: keep-alive'&@CRLF& _ 'content-type: application/x-www-form-urlencoded'&@CRLF& _ 'content-length: 5'&@CRLF& _ 'STOP0'&@CRLF&@CRLF TCPStartup() $socket = TCPConnect('192.168.11.1', 80) $bytes = TCPSend($socket, $packet1) $bytes = TCPSend($socket, $packet2) TCPCloseSocket($socket) TCPShutdown()

It's a Buffa​lo  WZR-450HP Ver.1.96, the http://192.168.11.1/cgi-bin/cgi?req=frm&frm=info.html address is the "Status" page, it's contains general text and 2 buttons, Start/Stop and an "Update" button, much simpler than the main router page that is full of frames, links and buttons. 

hide on taskbar

$
0
0

Hi All,

 

I wrote an app a few years ago and have revisited it to improve it, one thing I can't sort it to not show it on the taskbar, but show it in the system tray, the point of the app is to allow users easy access to info that tech support may ask, like username, pc name & IP address.

 

I've searched the forums but not found a answer, can anyone point me in the right direction.

 

Thanks in advance#

 

RichE

Help needed in SAP UDF _SAPObjValueSet

$
0
0

Hi;

I need a help in executing 1 SAP transaction.

I am reading a XLS file & passing that value to SAP Transaction.

Here I am using the  _SAPObjValueSet with variable ; but it seems to fail.

For $i = 1 To $rows ;Loop     Local $sCellValue = _ExcelReadCell($oexcel, $i, 1)     _SAPObjValueSet("usr/txtTERMSCHL-LOW","$sCellValue")     _SAPObjValueSet("usr/ctxtABRDATV", "01.01.2001")     _SAPObjValueSet("usr/ctxtABRDATB", "31.12.2020")     _SAPVKeysSend("F8") Next

Can any one help me please ?

Viewing all 12506 articles
Browse latest View live


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