-
Posts
1,005 -
Joined
-
Last visited
Everything posted by computergroove
-
https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm If I try to run a script with the following I get an error: If _IsPressed(6F) Then;hex key for "/" msgbox(0,"","/") EndIfIt works when I am using a hexkey that doesn't have a letter in the character code. For instance: If _IsPressed(55) Then;hex key for "u" msgbox(0,"","u") EndIfThis works. Can I use the ascii dec character code instead of the hex code?
-
GUICtrlCreateAvi problems starting
computergroove replied to Champak's topic in AutoIt General Help and Support
Cant you delete the instance and recreate it? Is this embedded in another gui window? Could you start the window shown and then hide the window? Does that work? -
My first thought is to use the UDF to open in the 0,0 axis and take a full screen shot. Save the image as whatever and open it in paint and resize it and save as jpeg. Why dont you want to use screen capture?
-
@DannyFirex I modified your code slightly to accept userinput: #include <String.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Global $Answer #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 1156, 123, 254, 124) $Input1 = GUICtrlCreateInput("Input1", 8, 48, 1137, 21) $Go = GUICtrlCreateButton("Go", 8, 80, 113, 25) $Label1 = GUICtrlCreateLabel("Enter a string of characters and click go. This program will order the characters like AaBbCc etc.", 8, 24, 456, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Go $sMainString = GUICtrlRead($Input1);get user input $len = StringLen($sMainString);count number of characters $Answer = _SortChars($sMainString) MsgBox(0,"",$Answer) EndSwitch WEnd Func _SortChars($sString) Local Const $sChars = $sMainString Local $sOutString = "" Local $sChar = "" For $i = 1 To StringLen($sChars) $sChar = StringMid($sChars, $i, 1) StringReplace($sString, $sChar, "", 0, 1) If @extended Then $sOutString &= _StringRepeat($sChar, @extended) EndIf Next Return $sOutString EndFunc ;==>_SortCharsand it returns too many characters. I dont believe that worked.
-
I got it. I wanted to reorder the characters from a sentence to look like AAaaBBbbCCccDDdd etc. Upper case A's first followed by lower case a's. This finally worked however I can tell that there is a bug somewhere because I had to use the if statement to prevent rogue A's from appearing at the end of the characters as it was counting them. Can you remove the if statement and make the answer come out correctly? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Global $len, $Answer = "", $AsciiValue = 65 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 1156, 123, 254, 124) $Input1 = GUICtrlCreateInput("Input1", 8, 48, 1137, 21) $Go = GUICtrlCreateButton("Go", 8, 80, 113, 25) $Label1 = GUICtrlCreateLabel("Enter a string of characters and click go. This program will order the characters like AaBbCc etc.", 8, 24, 456, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Go $UserInput = GUICtrlRead($Input1);get user input $len = StringLen($UserInput);count number of characters Ascii() EndSwitch WEnd Func Ascii() For $i=1 To 52 $StringTemp = $UserInput Do $TempString = StringInStr($StringTemp,Chr($AsciiValue),1);Number where the character exists $StringTemp = StringTrimLeft($StringTemp,$TempString - 1);Strip characters on left side where first string is located $StringLeft = StringLeft($StringTemp,1) If $StringLeft == Chr($AsciiValue) Then $Answer = $Answer & $StringLeft;Add character to answer EndIf $StringTemp = StringTrimLeft($StringTemp,1) Until $TempString == 0 If $AsciiValue <= 96 Then $AsciiValue = $AsciiValue + 32 Else $AsciiValue = $AsciiValue - 31 EndIf Next MsgBox(0,0,$Answer) EndFunc
-
I have a input box that I wand to order the characters in a msgbox ie: AABBCCBBAA would return AAAABBBBCC. What I have tried is not working. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Global $len, $Answer #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 1156, 123, 254, 124) $Input1 = GUICtrlCreateInput("Input1", 8, 48, 1137, 21) $Go = GUICtrlCreateButton("Go", 8, 80, 113, 25) $Label1 = GUICtrlCreateLabel("Enter a string of characters and click go. This program will order the characters like AaBbCc etc.", 8, 24, 456, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Go $UserInput = GUICtrlRead($Input1);get user input $len = StringLen($UserInput);count number of characters Ascii() EndSwitch WEnd Func Ascii() $AscStart = 65 For $i = 65 To 90;characters A - Z $StringTemp = $UserInput ;~ MsgBox(0,"Original String",$StringTemp) Do $TempString = StringInStr($StringTemp,Chr($i),1);Number where the character exists $StringTemp = StringTrimLeft($StringTemp,$TempString - 1);Strip characters on left side where first string is located $StringLeft = StringLeft($StringTemp,1) $Answer = $Answer & $StringLeft;Add character to answer $StringTemp = StringTrimLeft($StringTemp,1) Until $TempString == 0 Next MsgBox(0,0,$Answer) EndFunc
-
Resizing a GUI with a button
computergroove replied to computergroove's topic in AutoIt GUI Help and Support
Excellent. That worked. -
I want to click a button and toggle a GUI Size. I can get it to work for one toggle if I delete the GUI and then call the Main function again but it only works once and when I do this I cannot close the window with the x in the upper right corner. Here is my code: #include <GUIConstantsEx.au3> Global $GUI, $fStartMonday = False, $iGridSize = 1, $sTheme = "Blue", $GUIBackX = 800, $GUIBackY = 600, $CalXPos = 20, $CalYPos = 40, $CalWidth = 760, $CalHeight = 520, $CalFontSize = 30, $ToggleSizeValue = 1 _Main() Func _Main() Local $GUI = GUICreate("Calendar example", $GUIBackX, $GuiBackY, -1, -1) Opt("GUIOnEventMode",1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetState();Makes the GUI visible to the user GUICtrlCreateButton("Toggle Size", 20, 20, 150, 20) GUICtrlSetOnEvent(-1, "Btn_ToggleSize") While 1 Sleep(50) WEnd EndFunc Func _Exit() Exit 0 EndFunc Func Btn_ToggleSize() If $ToggleSizeValue == 1 Then ;1024 x 768 $ToggleSizeValue = 2 $GUIBackX = 1024 $GUIBackY = 768 $CalXPos = 20 $CalYPos = 40 $CalWidth = 984 $CalHeight = 688 GUIDelete($GUI) _Main() ElseIf $ToggleSizeValue == 2 Then ; 1280 x 1024 $ToggleSizeValue = 3 $GUIBackX = 1280 $GUIBackY = 1024 $CalXPos = 20 $CalYPos = 40 $CalWidth = 1240 $CalHeight = 944 GUIDelete($GUI) _Main() Else $ToggleSizeValue = 1; 800 x 600 $GUIBackX = 800 $GUIBackY = 600 $CalXPos = 20 $CalYPos = 40 $CalWidth = 760 $CalHeight = 520 GUIDelete($GUI) _Main() EndIf EndFuncWhat should I do to refresh the size settings on the GUI without recreating it?
-
You should use some debug code to determine what the script is detecting as a pixel value when someone comments. MsgBox(0,"Coordinate Detected", "The pixel detected is: " & $coord)
-
Is there any way to keep sending same key?
computergroove replied to JJ1122's topic in AutoIt General Help and Support
My guess is that autoit is fighting with the function native to windows that will press a repeatedly when you hold it in. You can see what I'm talking about if you open notepad and hold down the a key. Something something DllCall... might work -
On line 657 in the UDF you need to change to the following in what is now autoit version 3.3.14.2: $__aCALDAYS[$i][0] = GUICtrlCreateLabel("", $iDayPosX + ($iDayOfWeek = 7 ? 0 : $iGridSize), $iDayPosY + $iGridSize, $iDayWidth - $iGridSize, $iDayHeight - $iGridSize)
-
_Iif converted to Tenary request
computergroove replied to computergroove's topic in AutoIt General Help and Support
Looks like I got it: $__aCALDAYS[$i][0] = GUICtrlCreateLabel("", $iDayPosX + ($iDayOfWeek = 7 ? 0 : $iGridSize), $iDayPosY + $iGridSize, $iDayWidth - $iGridSize, $iDayHeight - $iGridSize) -
_Iif converted to Tenary request
computergroove replied to computergroove's topic in AutoIt General Help and Support
Making progress - https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=https%3A%2F%2Fautoit.de%2Fonlinehilfe%2Flibfunctions%2F_Iif.htm&edit-text=&act=url -
I ran across this post: When I try to execute the example code I get an error in the included UDF on line 657. As Melba mentioned, a user would need to "replace it with a ternary expression". I cannot find the structure of the _Iif function. Can someone convert the line so I can use the code? Not that it will help imensly but here is the line in question: $__aCALDAYS[$i][0] = GUICtrlCreateLabel("", $iDayPosX + _Iif($iDayOfWeek = 7, 0, $iGridSize), $iDayPosY + $iGridSize, $iDayWidth - $iGridSize, $iDayHeight - $iGridSize)
-
While loop quits
computergroove replied to computergroove's topic in AutoIt General Help and Support
The problem is that the togglepause is initiated when the letter p is sent and there are p's in some email addresses. -
I think this is what you are looking for https://www.autoitscript.com/autoit3/docs/functions/GUICtrlRead.htm
-
While loop quits
computergroove replied to computergroove's topic in AutoIt General Help and Support
SMH. Yes genuine question. I figured it out. When I hover over the tray icon it says line 52 sleep(100). I see the problem. I was using "p" instead of my usual "{PAUSE}" button for toggle pause. -
While loop quits
computergroove replied to computergroove's topic in AutoIt General Help and Support
Where will I see the output for this? Im running with F5 from Scite. -
While loop quits
computergroove replied to computergroove's topic in AutoIt General Help and Support
That was included because I started to make the script open the webpage and login to the site but I just did that manually as I only need to do this once. As for blocking, the same thing happened when I used a for loop with ubound($aArray) - 1 instead of the while loop. I added several seconds between entries for random load times between the prompts and the problem isn't that the mouse is clicking in the wrong places it's that the script just stops working. It still runs but it just freezes. I can send the data if you want to try to reproduce. It's just a text file with 3600 email addresses in it. Nothing special that should affect my script in this manner. I have run scripts for many weeks on my VM's for other purposes in the past so I dont thing it's my VM. -
My script will loop 10-20 times then it will just freeze. I cannot figure it out. I also tried a for loop and go the same results. I am running on a Windows 8 VM. Here is my code: #include <MsgBoxConstants.au3> #include <array.au3> #include <IE.au3> Global $Paused HotKeySet("p", "TogglePause") HotKeySet("{ESC}", "Terminate") $Paused = $Paused OPT("SendKeyDelay",25) $File = FileOpen(@DesktopDir & "\email addresses 11-17-2015.txt") $File1 = FileOpen(@DesktopDir & "\Count.txt") $aArray = FileReadToArray($File) Sleep(5000) ;~ _ArrayDisplay($aArray) Global $Count = 0 While 1 MouseClick("",909,221);add customer MouseMove(691,421) Sleep(5000) MouseClick("",691,421);email address location MouseMove(708,196) Sleep(1000) Send($aArray[$Count]) Sleep(500) MouseClick("",708,196);save MouseMove(691,500) Sleep(5000) MouseClick("",691,500);Click OK on already exists MouseMove(805,206) Sleep(3000) MouseClick("",805,206);Click Cancel MouseMove(909,221) Sleep(5000) ;~ Local $PCS = PixelChecksum(662,479,762,510) ;~ If $PCS == 361411749 Then ;~ MouseClick("",715,496) ;~ Sleep(1000) ;~ MouseClick("",778,198) ;~ Sleep(2000) ;~ EndIf $Count += 1 WEnd Func TogglePause() $Paused = Not $Paused While 1 Sleep(100) ToolTip('Paused', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() FileClose($File1) Exit 0 EndFunc ;==>TerminateIt takes a list of email addresses and adds them to a mailing list online. Is this a bug?
-
How to determine the PNG image is black or white.
computergroove replied to Trong's topic in AutoIt General Help and Support
Can you show your code? The pictures above are both black and white. What are you trying to do exactly? PixelSearch will only search the user defined area for 1 pixel being a user defined color. Maybe this will help. You can use this script to identify the location of the pixel position your mouse is currently on. It has been invaluable to me when using autoit: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=C:\Users\user\Desktop\PGCAH2.0.Exe #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) Opt("WinTitleMatchMode", 4) Global $xoffset = 10;X axis distance from mouse pointer to blue label Global $yoffset = 23;Y axis distance from mouse pointer to blue label Global $wposx, $wposy, $dt, $cwin, $xcalcl, $xcalcr, $ycalc, $cpos, $pos, $tpos, $hexv, $pcolor Global $title = "Your Title Here" HotKeySet("{ESC}", "Terminate") $pgui = GUICreate($title, 250, 13, -1, -1, $ws_popup);Rear place holder for back of the blue label box (Title, Length of the blue lable box, Height of the blue label box,,) $startlab = GUICtrlCreateLabel(" X: 0000, Y: 0000", 0, -1080, 250, 13) GUICtrlSetBkColor($startlab, 13434879);blue label box color WinSetOnTop($pgui, "", 1) GUISetState(@SW_SHOW) While 1 _nmgp() WEnd Func _nmgp() Local $_cpos = MouseGetPos();get current position of the mouse on desktop Sleep(10) $pcolor = PixelGetColor($_cpos[0], $_cpos[1]);help $pos = MouseGetPos() GUICtrlSetData($startlab, " X: " & $pos[0] & ", Y: " & $pos[1] & " HEX: " & Hex($pcolor, 6) & " DEC: " & $pcolor) ;************************************ Moves the blue label with the mouse ***************************** If $dt = 1 Then $xcalcr = 0.95 * @DesktopWidth $xcalcl = 0.05 * @DesktopWidth $ycalc = 0.9 * @DesktopHeight If $pos[1] > $ycalc Then $wposy = $pos[1] - $yoffset * 2 Else $wposy = $pos[1] + $yoffset EndIf If $pos[0] > $xcalcr Then $wposx = $pos[0] - $xoffset * 3 ElseIf $pos[0] < $xcalcl Then $wposx = $pos[0] + 10 Else $wposx = $pos[0] - $xoffset EndIf Else _clientmouse() EndIf WinMove($title, "", $wposx, $wposy) ;************************************ End Moves the blue label with the mouse *************************** EndFunc Func _clientmouse() Opt("MouseCoordMode", 1) $tpos = MouseGetPos() $cpos = WinGetPos($cwin) $xcalcr = 0.95 * $cpos[2] $xcalcl = 0.95 * $cpos[2] $ycalc = 5.0 * $cpos[3];Y axis for offsetting the text box when you reach the top of the screen (so you can stil see the coordinates) If $tpos[1] > $ycalc Then $wposy = $tpos[1] - $yoffset * 2; Y Axis to determine the distance from the mouse pointer and the blue text box Else $wposy = $tpos[1] + $yoffset EndIf If $tpos[0] > $xcalcr Then $wposx = $tpos[0] - $xoffset - $xcalcr ; X Axis to determine the distance from the mouse pointer and the blue text box ElseIf $tpos[0] < $xcalcl Then $wposx = $tpos[0] + 10 Else $wposx = $tpos[0] - $xoffset EndIf EndFunc Func terminate() Exit 0 EndFunc Compile the above code and run it. You can hit esc to exit out of it. pixlesearch - https://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm If you want to look for a black color then I would try something like this: #include <MsgBoxConstants.au3> $color = PixelSearch(0,0,500,500,0);This checks the upper left corner of your main monitor for the color black (dec code '0') If Not @Error Then MsgBox(0,0,"Black was found!") EndIF