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

While 1 and Sleep

$
0
0
I have a script that works fine, but I'm wondering if I'm not following "best practices" guidelines.  It's a simple script that maps the middle mouse button to a hotkey used by a clipboard manager. Click on the middle button , anywhere, and the clipboard manager pops up.  It loads at start-up and is always running.
#include <Misc.au3> Local $hDLL = DllOpen("user32.dll") While 1     If _IsPressed("04", $hDLL) Then Send("^!C") WEnd

My question is should I have a Sleep(100), or something, in the loop?  It's seems that many examples, that have an infinite loop, do this.  

 

Thanks...Jimbo


Mouse stopped for no apparent reason

$
0
0

My script was running beautifully for two weeks.  Then the mouse stopped working in the pop-up windows.  It gets to a certain point and then stops. The script just sits there.  I have rebuilt from scratch, etc... not sure what is happening.

 

Below is are the code and then the system information.

 

Windows 7 professional 64 bit.

 

 

 

 

#region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000409)  ---

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '')
If $aResult[1] <> '00000409' Then
  MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000409->' & $aResult[1] & ')')
EndIf

EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
 WinWait($title,$text,$timeout)
 If Not WinActive($title,$text) Then WinActivate($title,$text)
 WinWaitActive($title,$text,$timeout)
EndFunc

_AU3RecordSetup()
#endregion --- Internal functions Au3Recorder End ---

$DashCounter = 0
$LoginCounter = 0
While $LoginCounter < 2
$LoginCounter = $LoginCounter  +1
$DashCounter = 0

_WinWaitActivate("Start","")
MouseClick("left",34,16,1)
_WinWaitActivate("Start menu","All Programs")
MouseClick("left",89,22,1)
_WinWaitActivate("Web Based CMMS Software | PM Software | Facility Maintenance | Login - Windows Internet Explorer","Address Combo Contro")
sleep(6000)
Send("xxxxxxxxxxx{ENTER}")
Sleep(20000)
MouseClick("left",425,77,1,20)
Sleep(3000)
_WinWaitActivate("http://www.maintenanceconnection.com/?s=34B3B746866800134E561993B07F2993D6BCF855B695316F6DA1FCA - Windows Internet Explorer","Address Combo Contro")
sleep(12000)
MouseClick("left",410,75,1)
sleep(8000)

_WinWaitActivate("My Dashboard -- Webpage Dialog","")

While $DashCounter < 42
$DashCounter = $DashCounter + 1
sleep(3000)
MouseClick("left",82,531,1)
Sleep(10000)
MouseClick("left",65,544,1)
Sleep(20000)
MouseClick("left",92,530,1)
Sleep(20000)
MouseClick("left",116,531,1)
Sleep(20000)
MouseClick("left",119,545,1)
Sleep(20000)
MouseClick("left",109,561,1)
Sleep(20000)
MouseClick("left",90,587,1)
Sleep(20000)
MouseClick("left",80,602,1)
Sleep(20000)
MouseClick("left",75,614,1)
Sleep(20000)
MouseClick("left",75,628,1)
Sleep(20000)
MouseClick("left",73,642,1)
Sleep(20000)
MouseClick("left",63,657,1)
Sleep(20000)
MouseClick("left",61,672,1)
Sleep(20000)
MouseClick("left",66,689,1)
Sleep(20000)
MouseClick("left",64,702,1)
Sleep(20000)
MouseClick("left",64,716,1)
Sleep(20000)
MouseClick("left",58,730,1)
Sleep(20000)
MouseClick("left",58,738,1)
Sleep(20000)
MouseClick("left",58,740,1)
Sleep(20000)
MouseClick("left",58,755,1)
Sleep(20000)
MouseClick("left",57,768,1)
Sleep(20000)
MouseClick("left",57,785,1)
Sleep(20000)
MouseClick("left",61,797,1)
Sleep(20000)
MouseClick("left",61,808,1)
Sleep(20000)
MouseClick("left",66,810,1)
Sleep(20000)
MouseClick("left",63,824,1)
Sleep(20000)
MouseClick("left",61,840,1)
Sleep(20000)
WEnd

ProcessClose("iexplore.exe")
sleep(1000)
ProcessClose("iexplore.exe")
sleep(1000)
ProcessClose("iexplore.exe")
sleep(1000)
ProcessClose("iexplore.exe")

WEnd

#endregion --- Au3Recorder generated code End ---

 

 

 

System Information

--------------------------------------------------------------------------------------------
OS                       Windows 7 Professional x64 Edition 6.1 (build: 7601) Service Pack 1
BIOS Version             Dell Inc. A16
Last booted              10/23/2014 7:34 AM
Computer Name            CROTHALL-PC
Computer Description     Crothall-PC
Interactive User         Crothall-PC\Crothall
Default Browser          Internet Explorer
Default Browser Path     C:\Program Files\Internet Explorer\iexplore.exe
Default Browser Version  10.00.9200.17116
Device screen            1024 x 768 x 32

CPU Information

-----------------------------------------------------
CPU Name         Intel® Core™ i5-3470 CPU
CPU Clock        3192 MHz
CPU Description  Number 4 Level 6 Model 58 Stepping 9
CPU Usage        5%

Memory Information

-------------------------------
Physical Memory Size    3.95 GB
Physical Memory Used    1.32 GB
Physical Memory Used %  33%
Physical Memory Free    2.63 GB
Physical Memory Free %  66%
Commit Memory Size      7.90 GB
Commit Memory Used      1.62 GB
Commit Memory Used %    20%
Commit Memory Free      6.28 GB
Commit Memory Free %    79%

Disk Drives

Drive  Size       Free       % in use
-------------------------------------
C:\    452.10 GB  410.06 GB  10%
D:\    574.43 MB  0 KB       100%

Processes (Top 5 per CPU)

Name                 CPU%  Memory
------------------------------------
System Idle Process  95%
System               2%
LMI_Rescue_srv.exe   1%    48.54 MB
LMI_Rescue_srv.exe   1%    103.52 MB
dwm.exe              1%    140.38 MB

Events (Last 5 Errors)

Type  Generated           Source                                   Event ID
---------------------------------------------------------------------------
      10/23/2014 7:36 AM  WinMgmt                                  10
      10/23/2014 7:34 AM  Microsoft-Windows-WLAN-AutoConfig        4001
      10/23/2014 7:33 AM  Microsoft-Windows-User Profiles Service  1530
      10/23/2014 3:19 AM  WinMgmt                                  10
      10/23/2014 3:18 AM  System Restore                           8210

 

 

 

 

_FileWriteFromArray

Lost with functions

$
0
0

Hello,

 

First off I feel really stupid because I cannot grasp how to create the function that I want to make. Looking at the examples in the help file just confuse me more. I am trying to simply build a function that will either A: Encrypt a string and return the value or B: Decrypt a string and return the value. I have encryption and decryption working fine I just want to create a function to do the work because I will be doing a lot of encrypting and decrypting in my script. I am working on a TCP register/login/logoff script if anyone is wondering.

 

Thanks!

Find String in text File

_ExcelReadSheetToArray not in latest build of Excel.AU3

$
0
0

I downloaded the latest version of AutoIT in order to get the enhanced performance _ExcelReadSheetToArray function. I'm reading in large excel sheets to an array to compare data & the earlier versions of this function takes a very long time. According to posts, the latest version 3.3.12 has the new Excel UDF that supposedly fixes this problem. With the latest install, I can't find this function in the file. Any suggestions of where I can download a version that has the fix

regress in Run-time errors on objects no longer fatal?

$
0
0

Autoit 3.3.9.0 has Changed: Run-time errors on objects no longer fatal (execution of the script is not halted). 
And it work in 3.3.12.0
 
But in beta 3.3.13.19 script ended with error  The requested action with this object has failed
 
Or maybe this is Script Breaking Changes?
 

$a = ObjCreate('scripting.dictionary') $a.add('x','a') ConsoleWrite(@error & @CRLF) $a.add('x','a') ConsoleWrite(@error & @CRLF)
>Running:(3.3.12.0):D:\Program Files\AutoIt3\autoit3.exe "D:\Users\user\Desktop\AutoIt v3 Script (2).au3"     --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop 0 -2147352567 +>18:03:05 AutoIt3.exe ended.rc:0
>Running:(3.3.13.19):D:\Program Files\AutoIt3\Beta\autoit3.exe "D:\Users\user\Desktop\AutoIt v3 Script (2).au3"     --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop 0 "D:\Users\user\Desktop\AutoIt v3 Script (2).au3" (45) : ==> The requested action with this object has failed.: $a.add('x','a') $a^ ERROR ->18:03:28 AutoIt3.exe ended.rc:1

UTF8 conversion problem

$
0
0

Hi,

 

I have a problem when I read my external IP from a simple external PHP script (with InetRead), result is provided as UTF8 from my web server.

 

When I convert it into decimal, few characters are added at the beginning, meaning it's not the right charset.

Into Hex, there is that header (UTF8) : 0xEFBBBF

So, I use BinaryToString($external_ip, 4) to convert from UTF8 into decimal.

 

With that, I am near of my goal : I obtain a full IP address, but it stays just a little "?" char before.

In Hex, I see that strange header : 0x3F

In theory, UTF8 header must disappear with the first BinaryToString conversion, no ?

 

For now, I can't use my script because conversion seems to be partial, or maybe there is another solution ?

 

Full example :

Binary resultat from the PHP script :

0xEFBBBF38372E3233312E32372E323335

If converted with BinaryToString($external_ip, 4) and converted again into Binary :

0x3F38372E3233312E32372E323335

Decimal obtained : ?87.231.27.235

 

Expected result :

0x38372E3233312E32372E323335

Decimal expected : 87.231.27.235

 

 

Thank you ;)


DriveGetSerial report different hdd serial no.

$
0
0

hi all

$var = DriveGetSerial( "c:\" )
MsgBox(4096, "Serial Number: ", $var)

My hdd serial is 4MQ08LX3
the above script return 2004997699

 

how do i find serial is  4MQ08LX3 by using autoit ?

thx all !

Counting and sorting duplicate lines

$
0
0

Hey ya'll,

 

So im in a bit of a pickle here.  I have a text file, file1.txt with a few hundred lines, some of these lines are exact duplicates.

 

What i'm trying to do is pick out the duplicate lines, and sort them out by number of occurrences and write the 10 most frequently seen duplicate lines to another file.  So the "top 10" duplicate lines from file1.txt would be output to file2.txt

 

I've looked around at the _array functions but i only see a way to remove duplicates and make unique arrays, which isn't exactly what i need...

 

Any help?

_FileListToArray

$
0
0

Hi.

 

I wrote this code that make list from text contain with _FileListToArray Function. but when I use _ArrayDisplay for view array there is a 1 number at first list. please Guide Me.

 

Thanks

Local $List = _FileListToArray (@DesktopDir, "*", $FLTA_FOLDERS,False) _ArrayDisplay ($List)

Attached Thumbnails

  • 1.jpg

How build a loop like this (compound loop)

$
0
0
I'm trying to solve a function but not'm getting. 
Someone can help-me?
This simplified form:
 
You run the function `foo` 
The function foo contains two functions: function1 () and function2 () 
 
The results of the functions function1 () and function2 () are: 
If it worked, it returns something data.
If you went wrong, set some value in @error.
 
Now the details: 
 
The function function1 () loop in between, and will not be executed until having @error
The function function2 () and executed, and give @error, it executes function1 () function again. 
The function function2 () will be executed until not @error present. 
Then the function `foo` function returns the result of function2 ().
 
Maybe this draw can help.
function.png
 
AutoIt         
foo() Func foo()     Local $try = 0     Local $aa = 0, $bb = 0     ConsoleWrite("start" & @LF)     Do         Switch $try             Case 0, 2                 $aa = function1()                 If @error Then                     $try = 1                 Else                     $try = 0                     $bb = function2()                     If @error Then                         $try = 2                     Else                         $try = 0                     EndIf                 EndIf                 ConsoleWrite("$TRY[" & $try & "]" & @LF)             Case 1                 $aa = function1()                 If @error Then                     $try = 1                 Else                     $try = 0                 EndIf                 ConsoleWrite("$TRY[" & $try & "]" & @LF)         EndSwitch     Until Not $try EndFunc   ;==>wer Func function1()     If Random(0, 1, 1) Then Return 1     Return SetError(1, 0, 0) EndFunc   ;==>aa Func function2()     If Random(0, 1, 1) Then Return 1     Return SetError(1, 0, 0) EndFunc   ;==>bb

need a converter

$
0
0

i have a input of 5/3 that gives me 1,666666666666667 this is a very lager number

i want a output of 1,666 any possible way to convert that?

Seeking '@YDAY' calculation for dates other than today

$
0
0

@YDAY returns a 3-digit number for the current day of the year. Does anyone have a similar calculation that will return the 3-digit number for any date supplied?

 

Thanks!

Processclose not closing Excel when running macros

$
0
0
When my Excel is busy running a macro, Processclose is not closing Excel. If Excel is not busy doing anything, processclose Excel works fine.

Is there any way autoit can close Excel while it is running macros? At the moment I'm closing Excel by Task Manager End Task.

Many thanks

How to Call Some AutoIt Functions That I Created in AutoIt, from C#?

$
0
0

Hi

 

 

Let's say I wrote an AutoIt codefile that contains 5 functions.

I now want to call those functions from a C# program.

 

 

How can I do it?

 

 

Is it possible to compile an AutoIt codefile to a .DLL, so I can then include that DLL in a C# program and call the functions in it?

 

 

If not, then other ways that can help?

 

 

Thank you

Zohar

Subscript used on non-accessible variable - Error message

$
0
0

So here is the error:

 ==> Subscript used on non-accessible variable.:

 

Here is the code:

  1. Func GetHandleFromPID($PID)
  2.     Local $aReturn = _WinAPI_EnumProcessWindows($PID)
  3.     Local $hReturn
  4.  
  5.     ;$hReturn = $aReturn[1][0]   ; this is the line that gives me the error "Subscript used on non-accessible variable"
  6.     _ArrayDisplay($aReturn, "Handles")  ;but this line works fine (see screenshot below)
  7.     Return $aReturn

The array seems to be there when I pass it to the _ArrayDisplay() function but in the prior line it gives me the error.

 

f7d9ddfd6c5db45e767e32a159178581.png

 

List COM port problem(Subscript used on non-accessible variable)

$
0
0

Hi everyone,

 

I am using martin's UDF to query my COM ports. Here is my code:

#include <CommMG.au3> #include <MsgBoxConstants.au3> Global $portlist = _CommListPorts(0) For $i = 0 To $portlist[0]    MsgBox( $MB_SYSTEMMODAL, "", $portlist[$i]) Next

I've already put CommMG.au3 and commMG.dll in the same directory. When I use Tools => Go in Autoit SciTE-Lite everything is fine. The program print out all my COM ports. But when I compile this program to an EXE file and execute it. An error occurs as following:

 

9lBVkD.png

 

This is so confusing. I try another experiment that removing commMG.au3, then Tools=> GO again. It shows the error like it is in EXE:

 

xCxQ8E.png

 

Is this indicating that something wrong in #include <CommMG.au3> ???

 

Thank you for your great support!

 

 

 

My code is packaged as an attachment.

Attached Files

Reproduce the ballon: Internet Explorer_Server

$
0
0

Is possible build a ballon or pop-up from this way?
I thinking this is build with a Internet Explorer's code, I am write?

 

Br Detefon

 

Tiberina.jpg

If not for 2 checks

$
0
0
$searchstring1 = "2394JF" $searchstring2 = "9345DC" $read_link = clipget() If Not StringInStr($read_link, $searchstring1) Or StringInStr($read_link, $searchstring2) Then

Here's my code, the problem is I want to do this on a single line, and it works fine if I use: "if not for the first : "If Not StringInStr($read_link, $searchstring1)"

 

But I also wanna use if not, for the next check, something like: 

If Not StringInStr($read_link, $searchstring1) Or if not StringInStr($read_link, $searchstring2) Then

But that causes a syntex error, does someone got a suggestion :)?

Viewing all 12506 articles
Browse latest View live


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