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

Always running script - what is the best way ?

$
0
0
I want to run a "utility" script which performs small tasks, like closing specific windows if they appear, short urls with hotkey, resize window if some specific thing happens, set volume to a specific level if media player start, etc.

What is the best (I mean fastest-running, least memory-consuming) way to run it all the time ?
If I do
[ autoit ]      
won't it slow down my computer ? What about memory ?
I tought I do it like this: a bunch of
[ autoit ]      
and
[ autoit ]      
If I need a new functionality, I just add one more and that's it.
Is there a better way ?

Also what is the best way if I edit and save, the script reload itself (or at least one click solution).

Also, I would like to see all the
[ autoit ]      
output. How can I see it without running Scite ?

How to Change the Colors and Font Styles, etc, in Scite-Lite of v3.3.8.1 To Be Like It Used To Be Before v3.3.8.1?

$
0
0
Hi


After installing AutoIt v3.3.8.1, I must say that it's really difficult for me to adapt to the Colors and Fonts Styles of v3.3.8.1.

The way it was in all prior versions, since I started using AutoIt several years ago, till v3.3.6.1, was perfect and distinct and clear.


How can I make it all be what it used to be?

(that is, without uninstalling v3.3.8.1 and re-installing v3.3.6.1)



Thank you
Zohar

winexists/winwait problem

$
0
0

i have the following code. i tried winwait but that didnt work.
I am trhying winexisting and it doesn't work. I know this because the msgbox
does not display the "here" message hence the controlclick will not work.

the window is a window that i created. the didtle is correct "MCH Win2"
see attachment this is a screen print.


opt("WinTitleMatchMode", 2)
			 
	while 1			
	if winexists("MCH Win2") then 
		ExitLoop
	EndIf
	sleep(400)
	wend
	
	
	msgbox(0,"","here")
	controlclick("MCH Win2","","Button1","left")

Attached Files

Check if os is window 7 or not ?

$
0
0
hello I am writing a program that support both win xp and 7 . But there are some functions only for window 7 or xp.
Please Help me
how can I know that which os in which application is running.

check timer against array values

$
0
0
Hi All,

I'm trying to get my head around a statement and was wondering if anyone could help me out?

I have a timer that counts up, this is set to use 3 variables, $min, $sec and $milsec. I also have an array that has a number of times ie;


[ autoit ]      
;count $array[0][0] = 3 ;Cue 1 $array[1][0] = 00 ;Min $array[1][1] = 00 ;Sec $array[1][2] = 5 ;Millisec ;Cue 2 $array[2][0] = 00 ;Min $array[2][1] = 02 ;Sec $array[2][2] = 3 ;Millisec Cue 3 $array[3][0] = 01 ;Min $array[3][1] = 03 ;Sec $array[3][2] = 9 ;Millisec

As a demo I have only 3 entries but i'm thinking of running up to 200-300 timers in the array. I'm trying to create a statement that will check if the timer is the same as a timer in the array and run a function. The only way i can think of doing this would be to create a while loop when the timer is counting to check if the time is the same but I don't want to overload the program. ie.

[ autoit ]      
$i = 1 While $i <= $linecount - 1 if $min == $array[$i][0] and $sec == $array[$i][1] $milsec == $array[$i][2] then dofunc($i) EndIf $i = $i + 1 WEnd

Is there a better way to do this on a big array?

script problem?

$
0
0
Hi.

My scripts does not respond how it should do.
  I did a little bot a for a game,it worked fine,but now it does not work anymore.When i'm in-game it acts like is not there,no reaction,and when i go on my desktop it works fine.
Why?


Thanks alot!
----------------
Baetu

Button function not working out for me!

$
0
0
Hi, I am pretty much a noob in autoit :P
So I used Au3Record to record some things I do and it worked excellent but when I made a GUI using Koda GUI designer and I made a button and I wanted to linked my recorded functions to the button, but I just can't get it right!
can someone maybe show me what I was doing wrong here :)

(sorry if the GUI I uploaded isn't functional since the images inside the program are on my pc :) )

Attached Thumbnails

  • how the Gui looks.PNG

Attached Files

error message

$
0
0
hi for all

do there is any command in windows to block some folder

please can you see in attachment files

Attached Thumbnails

  • blockfolder.PNG

Above desktop

$
0
0
I want to reformulate my question and it sounds like this:

First time i used AutoIT(First 2days),every script of mine did what i told him to do,even with something above my desktop(Me into a running process besides explorer).Now my scripts don't work correctly(i don't think the script is the cause),they only work if i'm on my desktop.

Is that good?

Regards,
Baetu

Current Time Range

$
0
0
It's been years since I've posted, I think originally when I created my account I had a question about MM Bot. This is my first time doing any real scripting and I must say I'm having a blast. I understood the first basic scripts in the "Examples" folder well enough and have built off of them. For me there seems to be a very large difference between those and the include scripts.

Anyway I'm looking for some advice on how to set a somewhat top level check on the current system time. I'm writing a script that I will be running on a virtual computer 24-7 and I'm thinking the code will look something like this:

Select
Case {CurrentTime 8am - 11am}
  Global $meal = "Breakfast"
Case {CurrentTime 11:01am - 4pm}
  Global $meal = "Lunch"
Case {CurrentTime 4:01pm - 8pm}
  Global $meal = "Dinner"
Case {CurrentTime 8:01pm - 1am}
  Global $meal = "Evening"
Case {CurrentTime 1:01am - 7:59am}
  Global $meal = "Closed"
EndSelect


I just used plain english for the part inbetween "{" & "}" markers to give you an idea of what I'm looking to do. I have looked at some of the time stuff in the help file and the includes and I just can't figure out how to do it.

That's what I'm thinking at this point. Again I'm a newb so if there is something better than Select / Case I welcome advice on that.

Listview scrolling problem

$
0
0
So I have this function


Func FunPopulateListView($parse)
;GUICtrlCreateListViewItem("1|2|3|4|5|6|7|8|9|10",$mainlist)
$i = 1

While $Parse[$i] <> ""
$split = StringSplit($Parse[$i], "|")
$split2 = StringSplit($split[4],",")
Select

Case GUICtrlRead($childchkct) = 1 And $split2[1] = "CT"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkct) = 1 And $split2[2] = "CT"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkct) = 1 And $split2[3] = "CT"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkct) = 1 And $split2[4] = "CT"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkct) = 1 And $split2[5] = "CT"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkmr) = 1 And $split2[1] = "MR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkmr) = 1 And $split2[2] = "MR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkmr) = 1 And $split2[3] = "MR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkmr) = 1 And $split2[4] = "MR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkmr) = 1 And $split2[5] = "MR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)	
Case GUICtrlRead($childchkus) = 1 And $split2[1] = "US"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkus) = 1 And $split2[2] = "US"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkus) = 1 And $split2[3] = "US"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkus) = 1 And $split2[4] = "US"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkus) = 1 And $split2[5] = "US"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)	
Case GUICtrlRead($childchkxr) = 1 And $split2[1] = "XR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkxr) = 1 And $split2[2] = "XR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkxr) = 1 And $split2[3] = "XR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkxr) = 1 And $split2[4] = "XR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)
Case GUICtrlRead($childchkxr) = 1 And $split2[5] = "XR"
	GUICtrlCreateListViewItem($Parse[$i],$mainlist)	
	
EndSelect
$i = $i + 1

WEnd
EndFunc



That populates a list view that is declared with
;List
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)
Global $mainlist = GUICtrlCreateListView("", 10, 90, $screenwidth - 20, $screenheight - 200, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($mainlist, $iExListViewStyle)

; Add column
_GUICtrlListView_AddColumn($mainlist, "Locked", 50)
_GUICtrlListView_AddColumn($mainlist, "Last Name", 200)
_GUICtrlListView_AddColumn($mainlist, "First Name", 200)
_GUICtrlListView_AddColumn($mainlist, "Modality", 100)
_GUICtrlListView_AddColumn($mainlist, "Status", 300)
_GUICtrlListView_AddColumn($mainlist, "Status Time", 100)
_GUICtrlListView_AddColumn($mainlist, "Total Time", 100)
_GUICtrlListView_AddColumn($mainlist, "Beverage", 100)
_GUICtrlListView_AddColumn($mainlist, "Notes", 1000)
_GUICtrlListView_AddColumn($mainlist, "PatientNum", 0)



The thing is my right scroll bar disappears if I don't have at least 1 GUICtrlCreateListViewItem out of the select statement.  If I move GUICtrlCreateListViewItem($Parse[$i],$mainlist) (the exact same line as the select statement) the right scroll bar is there, but once I move it down 2 lines the right scroll bar disappears.  Has anyone seen this before?

Thanks,

GDI Count with _ProcessListProperties

$
0
0
Is there a way to get the GDI count associated with the _ProcessListProperties function, or should I be using a different tool?


So far, using the following keeps returning 32, regardless of what process specified.

[ autoit ]      
Global Const $GR_GDIOBJECTS = 0 $PID = WinGetProcess("LooAlert.Client.Notifier.exe") consolewrite(@crlf & @crlf & "GDI Object: " & _WinAPI_GetGuiResources(0, $PID) & @crlf & @CRLF)


Edit:

The following returns 0 when I use a valid PID. So far, I'm not getting the GDI Objects number that Windows Task Manager shows.

[ autoit ]      
$GR_GDIOBJECTS = 0 $PID = WinGetProcess("Microsoft Outlook") consolewrite(@crlf &  "PID: " & $PID & @crlf & "GDI Object: " & _WinAPI_GetGuiResources($GR_GDIOBJECTS,6984) & @crlf & @CRLF)

General question about autoit capability

$
0
0
I am new to AutoIt. I am wrting a script in powershell using selenium. The script logs into a web console using Firefox. The console has few buttons. One a specific  button is selected, it generates a pop up window that has 2 buttons "Save File" and "Cancel". If you click the "Save", it will save the file into a local directory.

My script can log into the web console and click on the button. But, I do not know what too use to click on the pop up. The pop up is a standalone, not part of the web console. After you click the "Save", it dissapears.

Someone told me that Autoit can be used. I tried it, took the tutorial. But so far, it seems that it can act on windows or pop ups that it creates. I didn't see anything from the tutorials and examples that indicates I can use Autoit for my purpose.

Any experts to comment, suggest or help ?

Thanks

FileOpen/File In Use

$
0
0
There is an app that writes to a file.  When the file is complete, I need to move the file to another location.  I have no control over the application that is writing the file.  What I have done is to check the file size, sleep for 30 second and then check the file size again.  If they were equal, I would assume the file was done writing.  Most of the time that works fairly well.

Unfortunately, on the first of the month, the other application could have the file open and writing to it for 4 or 5 hours while the job runs.  There may be times when nothing gets written to the file for 5 or 10 minutes.  What I need is a way to check the file to see if it is open by another process.  I have scoured the help files and the forum but haven't found anything that looks to be my solution.

Is there something in AutoIT that will return some value to let me know if the file is really in use?  I have experimented with differrent files and AutoIT will let me do a FileOpen and read from a file that I already have open with another application.

please help urgently

$
0
0
please if any one can assist and help me , I have excel sheet inside it some information for our company staff breaks so I want to update our scheduling software with this information , this software is aspect workforce management

PixelChecksum, explain it to a dummie?

$
0
0
So if I got PixelChecksum correctly, it can check a square of pixels on a window. Can I somehow use this to invoke a forced continuation of the script?
An example:

I have one window where the pixels will be the same for an unknown period of time, and suddenly changes.
Instead of using Sleep(x) I want the script to recognize when the pixels in the window has changed, and then continue executing. Is this possible with PixelChecksum?

Also is it possible with any kind of reliable way to get the ControlHandle of a Window and store it as a variable? I can only get it through the AutoIt Window Spy.

Thanks!

Blob size issue

$
0
0
Hello all

I have a tricky problem that I have been wrestling with for a few days now, but cannot seem to make any headway.  I'm not sure if it is an AutoIT related issue, or a mySQL issue, so I will try here first.

The Mission
Read in a file, store it in a database blob field, retrieve said file from database, and present to user.  Files will generally be Word or Excel or jpgs.

So, to some code.  I'm going to leave out the boring stuff like starting mySQL, var declarations and the like, to get to the nub of the matter.

global $chars,$sSQL,$name="test.xlsx",$type="Excel",$iRval,$hDBHandle,$aResult
global $file = FileOpen($name, 16)
global $size = FileGetSize($name)


So here we just open the file in binary mode, and get the size.  The size reported of the file above is 10253 bytes, which corresponds to the Windows directory listing of 11k.  All good so far.

Next, I read the entire file into a variable and then close the input file:

$chars = FileRead($file,$size)
FileClose($file)

Just to check the integrity of the contents of the $chars variable, I write the whole thing back out to another file (this is just for testing purposes, to get my head around what is happening):

$file = FileOpen("testoutput.xlsx",2)
Filewrite($file,$chars)
FileClose($file)


I think do a checksum on both the input and output files.  They are identical as you would expect.

Now comes the part where it starts to go pear shaped.  I write the $chars out to the database.  (The "content" field below is defined as a mediumblob.)

$sSQL = "INSERT INTO `test`.`upload2` (`name`, `type`, `size`, `content` ) " _  
   & "VALUES (""" & $name & """, """ _
   & $type & """, """ & $size & """, """ & binary($chars) & """);"
   $iRval = _SQL_Execute($hDBHandle,$sSQL)
   if $iRval = $SQL_ERROR Then
   msgbox(0,"Error","Error inserting  row !")
   Else
  msgbox(0,"Success","Record saved")
   EndIf


The record saves fine, and a quick peek into the database shows the blob is stored in the "content" field.  (BTW, the "binary" function in the above sql statement was just a test. It made no difference using it or not.)

Now at this stage I can either retrieve the same row using SQL or go directly to the database using MySQL Workbench and retrieve the blob data.  It doesn't matter which I use the result is the same.

The result is that the blob is now exactly twice the size of the input ($chars) plus two bytes.  And I have no idea why.  And it is driving me crazy.

I am pretty sure mySQL is not at fault, as I can manually input a file into the blob field above, and then retrieve it, and input and output will be identical.

I'm at a road block on this and need some help kind people.

I would even look at an alternative solution.  Something whereby users can drop attachments into my application, and then (other users) can view them at a later stage.

Thanks in advance

Clark

how to operate xml and properties file

$
0
0
I'd use autoit to operate xml and properties/ini files, like changing some node/key values, inserting/deleting node/key.
Not sure what's the best way to achieve this?

LWINUP?

$
0
0
Hey all, back again for some help.

I'm once again just trying to write a simple macro...

Send ("{LWINDOWN}") - works fine

Send ("d") - works fine

Then I try to send the "LWINUP" function, and LWINUP simply never turns orange, it stays grey like normal text.

Any ideas as to why this is happening? The help file simply says, {LWINDOWN} presses the left windows key down until the {LWINUP} key is sent. Am I missing something here? I've checked and double checked the syntax...

Cannot click on the button and show dropdown menu

$
0
0
Hi all!
I am a newbie in AutoIt scripts and need an advice.
There is a button in an application (“Reports” - at least, AutoIt Windows Info says that it is a button). This button shows a dropdown menu.
I'd like my script to click on the button, choose an item from the dropdown menu and click on it.
But it seems that ControlClick and ControlCommand methods do not work for me. The only working method is MouseClick. And I’d also like to run the script using scheduled tasks – so I can’t use this method.
I have tried the following code:

First attempt (the Button267 = “Reports”; not clicked):
WinWaitActive("Systematica Radius Terminal")
ControlClick("Systematica Radius Terminal", "", "Button267")
ControlClick("Systematica Radius Terminal", "", "Kondor+ Open Reports")
ControlClick("Systematica Radius Terminal", "", "XXX1")
ControlClick("Systematica Radius Terminal", "", "XXX2")


Second attempt (The dropdown menu is not shown):
WinWaitActive("Systematica Radius Terminal")
ControlCommand("Systematica Radius Terminal", "", "Button267", "ShowDropDown")


Third attempt (This code works, but I can’t use it):
WinWaitActive("Systematica Radius Terminal")
MouseClick("", 295, 50)


Please refer to the attached screenshots for more information:
Posted Image

Posted Image
Viewing all 12506 articles
Browse latest View live


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