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

Please, help me if you understand my error :(

$
0
0
First before I say my problem I must say that I'm not allowed to share the script because I'm not suposed to ask help without advising my team :S, I just need a little hint to  idea.gif so I can continue my work  sweating.gif
 
Please don't say anything unless this is related to this error thanks  huggles.gif
 
I hope you understand my situation even if it doesn't seem to be an good reason to you.
 
 
 
Please help me if you aldready had this error before , I don't understand whats the error below mean:
 
 
Local $IBUTTONMARGIN = ((BitAND($IFLAGS, 32)) (0) ((BitAND($IFLAGS, 16)) (20) (40)))
 
error: unbalanced paranthesis expression.
 
This error occurs at:
 
Line (14) : Local $IBUTTONMARGIN = ((BitAND($IFLAGS, 32)) (0) ((BitAND($IFLAGS, 16)) (20) (40)))
 
And
 
Line (40) : Local $IITEM_START = 0, $IITEM_END = $IROWCOUNT - 1, $ISUBITEM_START = 0, $ISUBITEM_END = (($IDIMENSION = 2) ($ICOLCOUNT - 1) (0))
<snip>
I believe you need more than only the function, if you want to explain me in which kind of occurence this error appears and if you remember the solution to fix it.
 
For whoever helping me: I can't find the words to tell you how I appreciate your helps.
 
Best Regards,
Williamas Kumeliukas

Which is the fastest?

$
0
0

Hello, I am experimenting with "If" & "Switch" to determine which method is faster...

 

I am currently using this script to test them:

AutoIt         
  1. Global $number = Random(0 , 10, 1)
  2. Global $pass = False
  3.  
  4. Global $time_if = TimerInit()
  5. For $i = 0 To $number
  6.     If $i = $number Then $pass = True
  7.  
  8. $time_if = TimerDiff($time_if)
  9. MsgBox(64, "Timer", '"If" took ' & $time_if & ' milli-seconds.')
  10. $pass = False
  11.  
  12. Global $time_switch = TimerInit()
  13.  
  14. Switch $number
  15.     Case 0
  16.         $pass = True
  17.        
  18.     Case 1
  19.         $pass = True
  20.    
  21.     Case 2
  22.         $pass = True
  23.        
  24.     Case 3
  25.         $pass = True
  26.        
  27.     Case 4
  28.         $pass = True
  29.        
  30.     Case 5
  31.         $pass = True
  32.        
  33.     Case 6
  34.         $pass = True
  35.        
  36.     Case 7
  37.         $pass = True
  38.        
  39.     Case 8
  40.         $pass = True
  41.        
  42.     Case 9
  43.         $pass = True
  44.        
  45.     Case 10
  46.         $pass = True
  47.        
  48.  
  49. $time_switch = TimerDiff($time_switch)
  50. MsgBox(64, "Timer", '"Switch" took ' & $time_if & ' milli-seconds.')
  51.  
  52. MsgBox(64, "The winner is...", "The winner is...", 3)
  53.  
  54. If $time_if < $time_switch Then
  55.     MsgBox(64, "The winner is... If!!!", "The winner is... If!!!")
  56.     Global $diff = $time_switch - $time_if
  57.     MsgBox(64, "The winner is... Switch!!!", "The winner is... Switch!!!")
  58.     Global $diff = $time_if - $time_switch
  59.  
  60. MsgBox(64, "Intel", "The difference was only " & $diff & " milliseconds.")

Sometimes "Switch" wins, Sometimes "If" wins...

 

Thanks in Advance :)

FileWrite using variable file names

$
0
0

Here is what I have attempted to do.

I have a populated Listview where one of the columns contains various names and those names are used as file names when i write the listview text lines to a file. In this code $myVar[5] represents the variable file names.

So I am reading the Listview, assigning the file names and then attempting to write the data from all the columns in each line.  The file names in the List are not sequential. So all the lines for say $myVar[5] = "XYZ" will go to its own file and $myVar[5] = "ABC" to its own file. Finally a totally separate file contains all "XYZ" and all "ABC".

I need to use the over write mode, since I can edit the Listview.  I can see the FileWrite as written won't work the way I want since the handle doesn't change.  This is what I need help learning.

 

Thanks

Hobbyist

AutoIt         
    case $ListSave = $list5         for $i = 0 to $savecount  -1         $savecounterx = _GUICtrlListView_GetItemTextString ( $ListSave,$i  )         $savecounterx = $savecounterx & "|"         $myVar = StringSplit($savecounterx , "|")                 For $k = 1 To 5         Next         $savecounterx  =  '"'&$myVar[1]&'"'&","&$myVar[3]&","&'"'&$myVar[2]&'"'&","&","& '"'&$myVar[5]&'"'           $sFileStuff = ("c:\MySuff\01 MyLog\" & _MyMonth($sMon) & ".csv")         $sFileSave = ("c:\MySuff\"&$myVar[5]  &"\MyLog\" & _MyMonth($sMon) & ".csv")             If FileExists($sFileSave) then               $hFileOpen2 = FileOpen ($sFileSave, 2)                         EndIf              If FileExists($sFileStuff) then                            $hFileOpen = FileOpen ($sFileStuff,2)                     EndIf Next     GUICtrlRead ( $ListSave) for $i = 0 to $savecount  -1         $savecounterx = _GUICtrlListView_GetItemTextString ( $ListSave,$i  )         $myVar = StringSplit($savecounterx , "|")         For $k = 1 To 5         Next                 $savecounterx  =  '"'&$myVar[1]&'"'&","&$myVar[3]&","&'"'&$myVar[2]&'"'&"," &","& '"'&$myVar[5]&'"'                 FILEWRITE($hFileOpen  ,  $savecounterx  &@crlf )                 FILEWRITE($hFileOpen2,  $savecounterx  &@crlf ) Next                 FileClose ($hFileOpen)                 FileClose ($hFileOpen2)     EndSelect

How to activate a certain tab on a program

$
0
0

hello again here is my question i have a tabbed program ( a program that has multiple tabs inside it , just like any browser)

 

i want to select a tab containing a certain title and activate it . how can i do it?

 

thank you in advance regards

Break alternative in AutoIt

$
0
0

Is there any alternative to Break (in python, used to exit out of functions) in AutoIt?

 

(Except this: )

  1. Func Example()
  2.     While 1
  3.         ;Statements
  4.         ExitLoop
  5.     WEnd

TD :)

What do i do if the author of a udf didn't answer my question ?

$
0
0

Hi all,

I have some doubts about Manadar's Hotstring UDF. I have asked 10 days ago and he didn't replayed me. What do i do. I would like to know the answer. Or i need to drop the script work related to hotstring.

Opening Microsoft Word File

$
0
0

Yesterday I asked for help, but surprisingly it is not available now. It seems my question is lost in cyberspace.

I have run into AutoIT couple of days ago. It is interesting to me as I keep on working to a MS Word file where I am to perform a number of repetitive actions of mouse clicks and keystrokes. I opened the file through following code

 

$MSWordPath= "D:\Program Files\Microsoft Office\Office12\WINWORD.EXE"
$parameter = ' "E:\Backup-required\Backup\KnowledgeManagementEbooks\MainDoc.docx"'
Run($MSWordPath & $parameter)
 
Afterwards, I need to send few keystrokes as ALT+w. I used
 
Send("!w")
 
Here comes my problem. As MainDoc.docx requires certain time to get open the keystrokes were lost. There can be a possible solution. A dialogue box may be inserted with an OK button to get manual pause. When OK button is clicked, the dialogue box may disappear and focus should shift to Word file. Will someone help me how to code it?

PixelGetColor in dynamic array not working

$
0
0

Hello,

 

I've been using AutoIt off and on since I was about 13 years old, but this is the first time I've been really stumped about a bug in one of my scripts.

 

This is the part of my code that isn't running as I intended. It is supposed to get the number of rows in a table (up to a max of 9). 

 

Each row is 40 pixels apart on the y axis. And sometimes a row will be skipped if it isn't the color I'm looking for. 

No matter what I do, the output in tooltip is always 9. The variable $pc shouldn't be increasing unless the $hparr variable matches one of two colors. 

AutoIt         
#RequireAdmin Global $i = 0 Global $hparr[10] Global $p[2] Global $pc $dt = TimerInit() While 1         ;; Check Table Size         $pc = 1         $i = 1         $p[0] = 64  ;49         $p[1] = 106 ;93         Do             $i += 1             $p[1] += 40             $hparr[$i] = PixelGetColor($p[0],$p[1])             If $hparr[$i] = 16768669 or 15849372 Then $pc += 1         Until $i = 9         $i = 0         ;; delay at random         $delay = Random ( 150, 355 )         $dtt = TimerDiff($dt)         While $dtt < $delay             $dtt = TimerDiff ($dt)         WEnd         $dt = TimerInit()                 ToolTip ("This section is showing: " & $pc & " rows") Wend

WM_PAINT work on tabs and resetting to default colour

$
0
0

i have some troubles with WM_PAINT work on tabs (it wont redraw pic on tab item change) and also with resetting image place holder to default colour before drawing new pic in to it (previous pic can be seen if it aspect ratio is different from new)...

what i'm doing wrong?

see:

AutoIt         
#AutoIt3Wrapper_Version=Beta #include <File.au3> #include <Array.au3> #include <GuiListBox.au3> #include <GDIPlus.au3> #include <WinAPIGdi.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <GuiStatusBar.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Global $hBitmap_Scaled, $hGraphics #Region ### START Koda GUI section ### Form= $ChoiserGUI = GUICreate("Choiser GUI", 623, 449, 192, 114) $Tab1 = GUICtrlCreateTab(8, 32, 609, 385) $TabSheet1 = GUICtrlCreateTabItem("first tab") $Group1 = GUICtrlCreateGroup("Selector", 16, 64, 329, 193) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Prewiev", 352, 64, 257, 313) Global $aPrewievPic[4] = [360, 80, 244, 292] $PrewievPic = GUICtrlCreatePic("", 360, 80, 244, 292, BitOR($GUI_SS_DEFAULT_PIC,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE,$GUI_WS_EX_PARENTDRAG)) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Choise", 16, 264, 329, 113) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button_Next = GUICtrlCreateButton("Next", 456, 384, 75, 25) $TabSheet2 = GUICtrlCreateTabItem("second tab") $TabSheet3 = GUICtrlCreateTabItem("third tab") GUICtrlCreateTabItem("") $StatusBar1 = _GUICtrlStatusBar_Create($ChoiserGUI) GUIRegisterMsg($WM_PAINT,"WM_PAINT_PrewievPic") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _GDIPlus_Startup() $hDC = _WinAPI_GetDC ( $ChoiserGUI ) $BkColor = _WinAPI_GetBkColor ( $hDC ) ConsoleWrite($BkColor&@crlf) _WinAPI_ReleaseDC($ChoiserGUI, $hDC) $hBrush = _GDIPlus_BrushCreateSolid($BkColor) Global $hImage, $hBitmap_Scaled, $hGraphics $sSourceFolder = "C:\WINDOWS" $picExtentions = "*.jpeg;*.jpg;*.png;*.tiff;*.tif;*.gif;*.tga;*.bmp;*.pcx;*.jpe;*.jif;*.jfif;*.jfi;*.dib;*.tpic" $fl = _FileListToArrayRec($sSourceFolder,$picExtentions,Default,Default,Default,  2 ) $spath = $fl[Random(1,$fl[0],1)] QQQ($spath) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             _GDIPlus_Shutdown()             Exit         Case $Button_Next             QQQ($fl[Random(1,$fl[0],1)])     EndSwitch WEnd Func QQQ($spath)     Local $iW, $iH, $iAspect, $iAspectFrame, $iH_new, $iW_new     _GDIPlus_BitmapDispose($hImage)     _GDIPlus_BitmapDispose($hBitmap_Scaled)     $hImage = _GDIPlus_ImageLoadFromFile($spath)     $iW = _GDIPlus_ImageGetWidth($hImage)     $iH = _GDIPlus_ImageGetHeight($hImage)     $iAspect = $iW/$iH     $iAspectFrame = $aPrewievPic[2]/$aPrewievPic[3]     Select         Case $iAspectFrame >= $iAspect             $iH_new = $aPrewievPic[3]             $iW_new = $iH_new*$iAspect         Case $iAspectFrame < $iAspect             $iW_new = $aPrewievPic[2]             $iH_new = $iW_new/$iAspect     EndSelect     $hBitmap_Scaled = _GDIPlus_ImageResize($hImage, $iW_new-8, $iH_new-8)     $hGraphics = _GDIPlus_GraphicsCreateFromHWND($ChoiserGUI)     _GDIPlus_GraphicsFillRect($hGraphics, $aPrewievPic[0]+4, $aPrewievPic[1]+4, $aPrewievPic[2]-8, $aPrewievPic[3]-8, $hBrush)     _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Scaled, $aPrewievPic[0]+4, $aPrewievPic[1]+4) EndFunc Func WM_PAINT_PrewievPic($hWnd,$wParam,$lParam)     #forceref $hWnd,$wParam,$lParam     _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Scaled, $aPrewievPic[0]+4, $aPrewievPic[1]+4)     Return $GUI_RUNDEFMSG EndFunc

How to know the time delay between two keypresses

$
0
0

Hi all, i am using _IsPressed function in my script. I need to measure the time delay between two key presses. i.e. If the gap between key A and key B is greater than a specific time (say 2000 ms), then function will not work. How to know the time gap.

Wariable no declared? Bug?

Over moderation

$
0
0

Hello,

 

I understand the mods here have a job to do, but I do want to point out that occasionally you guys make judgements too quickly, and it can have a negative effect on the community when mistakes are made.

For example:

 

A previous post of mine

 

EDIT: Wow, I am careless. I found the problem. I used the OR logical operator incorrectly. I needed to restate the variable like this:

If $hparr[$i] = 16768669 Or $hparr[$i] = 15849372 Then $playercount += 1

NOT like this:

If $hparr[$i] = 16768669 Or 15849372 Then $playercount += 1

The difference is that the latter is interpreted as: "If this color is gold OR if 15849372 = 15849372 then do this.


was locked by SmOke_N for merely containing the word "playercount" and "gold." 

 

 

Gold + Player Count = Forum Rules

 


However, what I'm actually talking about is GOLD THE COLOR (16768669) and P-Layer Count (Used in my script for counting the objects in a layer labeled P).

I'm sure this was an honest mistake, so no hard feelings, but jumping the gun based on mere variable names is a little harsh. Particularly when the rest of the code clearly shows in context that the purpose is within forum regulations.

After a certain point, attempts to enforce the rules can cause your community to seem unwelcoming to new members. Please be more patient in the future.

 




 

Zombie Timer?

$
0
0
 

 

Hi guys, 
 
I'm new to AutoIt and i need a explanation on Timers, because something is happening and i can't understand why.
 
I need a timer, so i did:
Global $TIMER = 0 Global $TIMERDIFF = 0 Main() Func Main()     While 1     $TIMERDIFF = Round(TimerDiff($TIMER) / 1000, 1)             ToolTip($TIMERDIFF, 100, 100, "Info", 1, 1)         WEnd     WEnd EndFunc

Recovering from a DllCall crash

$
0
0

Is there any way to recover and carry on running an app after a DllCall becomes unresponsive?

 

The problem is that I need to run this dll  call and sometimes it will fail and never return  

(AutoIt3.exe ended.rc:-1073741819).

 

DllCall("msvcrt.dll", "int:cdecl", "memcmp", "ptr", $ptr1, "ptr", $ptr2, "int", $smallest)

 

The closest I can get to a solution is _OnAutoItErrorRegister

http://www.autoitscript.com/forum/topic/126714-onautoiterrorregister-handle-autoit-critical-errors/

but that seems to need my script to close and restart rather than just carrying on with the code after the DllCall

 

how to open new tab in IE

$
0
0

I dont see a function like _fftabadd like in firefox


handle initiated MsgBox

$
0
0
Hi,
 
What conditions do i need to set to an initiated MsgBox command so I can close it when something changes via $WM_COMMAND like for instance when WM_DEVICECHANGE sees a different drive (while MsgBox is still showing)
 
so I can close the MsgBox from there ($WM-Function) with auto answering "no" to it
 
I see there is a command like _GUICtrlButton_Click that may be used for this
but I'm guessing I need the MsgBox's win-handle for this to work  or can the win-handle be retrieved as soon as the MsgBox is launched
 
What would be the right way to handle this Msgbox
TIA for any idea's on this
 

Question

$
0
0

Hello Every one i have  Qustion ..

 

if i have like 10 window for game and  i want user make select one or tow or three of them how i can do it .. and  10 window with same name   :)

 

 

--other Question 

 

 

how i can make script mouse keep clicking on point in window and i use mouse on pc normal o:)

 

Help with _FileReadToArray

$
0
0

I have a file that changes values on occaision that looks like:

1;1 2;2 3;3 4;4 5;7 9;3

The file in called text.ini. I want to read these into a 2d array and I cannot find any examples of anyone doing it and I do not understand the function reference on the net. Can someone show me the correct syntax?

Execute from var?

$
0
0

I am experimenting with Execute function.

This way- works fine for me

$a = "fileread" $f = Execute ('fileread ("test.txt")') ConsoleWrite ($f)

But  if I replace fileread with variable $a then it wont work

$a = "fileread" $f = Execute ('$a ("test.txt")') ConsoleWrite ($f)

Is there a way to make it work from var?

 

Great thanx in advance!

Extra Options for Radio Boxes?

$
0
0

Ive been playing with the extra styles for a radio box and cant seem to get it how i want

 

Problem 1

The radio button sits on the edge of the left boundary of the slot it occupies is there a way to have a gap near the edge of the area

ie move the round bit to the right to create a gap on the left so it looks better

Capture1.PNG

 

Problem 2

Is there a way to make a darker border or a line for the edge of the area? ie this edge

Capture.PNG

 

Any options?

Viewing all 12506 articles
Browse latest View live


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