
LongBowNZ
Active Members-
Posts
309 -
Joined
-
Last visited
Everything posted by LongBowNZ
-
AutoIt3Wrapper.au3 gets deleted?
LongBowNZ replied to MrCheese's topic in AutoIt General Help and Support
Adding an exception for the whole AutoIt3 folder instead of just the file seems to be working for now. -
AutoIt3Wrapper.au3 gets deleted?
LongBowNZ replied to MrCheese's topic in AutoIt General Help and Support
Experiencing this also. Frustrating that adding an exception doesn't work to stop it being moved to the virus chest. -
If Then MouseClick based on classNN
LongBowNZ replied to Farns's topic in AutoIt General Help and Support
Yeah, that would be better I also forgot an EndIf While 1 If ControlGetText("Window Title", "", $buttonControlID) = "Close" Then ControlClick("Window Title", "", $buttonControlID) ExitLoop EndIf WEnd -
If Then MouseClick based on classNN
LongBowNZ replied to Farns's topic in AutoIt General Help and Support
If I understand correctly you need something like this. While 1 If GUICtrlRead($buttonControlID) = "Close" Then ControlClick("Window Title", "", $buttonControlID) ExitLoop WEnd -
Linking form drop down items to a function
LongBowNZ replied to jtaft's topic in AutoIt GUI Help and Support
$Combo1 holds the control id of the combo box. You need to use GUICtrlRead() to get the current selected value. If GUICtrlRead($Combo1) = "Load Proxy 1" -
Yeah, sorry about that.
-
Generate code for message boxes using a GUI. Screenshot: '> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <UpDownConstants.au3> Global $sOK, $sOKCANCEL, $sABORTRETRYIGNORE, $sYESNOCANCEL, $sYESNO, $sRETRYCANCEL, $sCANCELTRYCONTINUE, $sButtonOptions $sOK = 'OK' $sOKCANCEL = 'OK and Cancel' $sABORTRETRYIGNORE = 'Abort, Retry, and Ignore' $sYESNOCANCEL = 'Yes, No, and Cancel' $sYESNO = 'Yes and No' $sRETRYCANCEL = 'Retry and Cancel' $sCANCELTRYCONTINUE = 'Cancel, Try Again, and Continue' $sButtonOptions = StringFormat('%s|%s|%s|%s|%s|%s|%s', $sOK, $sOKCANCEL, $sABORTRETRYIGNORE, $sYESNOCANCEL, $sYESNO, $sRETRYCANCEL, $sCANCELTRYCONTINUE) $hWnd = GUICreate('Message Box Generator', 500, 470) GUICtrlCreateGroup('Title', 10, 0, 485, 50) $iInputTitle = GUICtrlCreateInput('', 20, 20, 461, 21) GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup('Text', 10, 50, 485, 135) $iEditText = GUICtrlCreateEdit('', 20, 70, 461, 101) GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup('Icon', 10, 190, 211, 91) $iIconNone = GUICtrlCreateIcon('', 0, 20, 210, 32, 32) GUICtrlSetTip(-1, 'No icon') $iIconError = GUICtrlCreateIcon('C:\Windows\System32\user32.dll', -4, 60, 210, 32, 32) GUICtrlSetTip(-1, 'Error') $iIconQuestion = GUICtrlCreateIcon('C:\Windows\System32\user32.dll', -3, 100, 210, 32, 32) GUICtrlSetTip(-1, 'Question') $iIconWarning = GUICtrlCreateIcon('C:\Windows\System32\user32.dll', -2, 140, 210, 32, 32) GUICtrlSetTip(-1, 'Warning') $iIconInformation = GUICtrlCreateIcon('C:\Windows\System32\user32.dll', -5, 180, 210, 32, 32) GUICtrlSetTip(-1, 'Information') $iRadioIconNone = GUICtrlCreateRadio('', 30, 250, 13, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip(-1, 'No icon') $iRadioIconError = GUICtrlCreateRadio('', 70, 250, 13, 17) $iRadioIconQuestion = GUICtrlCreateRadio('', 110, 250, 13, 17) $iRadioIconWarning = GUICtrlCreateRadio('', 150, 250, 13, 17) $iRadioIconInformation = GUICtrlCreateRadio('', 190, 250, 13, 17) GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup('Buttons', 10, 290, 211, 51) $iComboButtons = GUICtrlCreateCombo('', 20, 310, 195, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, $sButtonOptions, $sOK) GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup('Default Button', 10, 350, 100, 51) $iComboDefButton = GUICtrlCreateCombo('', 20, 370, 80, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, 'First|Second|Third|Fourth', 'First') GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup('Modality', 120, 350, 100, 51) $iComboModality = GUICtrlCreateCombo('', 130, 370, 80, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, 'Application|System|Task', 'Application') GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup('Miscellaneous', 230, 190, 265, 241) $iCheckboxMB_HELP = GUICtrlCreateCheckbox('Add a Help button to the message box', 240, 210, 247, 17) GUICtrlSetTip(-1, 'Adds a Help button to the message box.' & @CRLF & 'When the user clicks the Help button or ' & @CRLF & 'presses F1, the system sends a WM_HELP ' & @CRLF & 'message to the owner.') $iCheckboxMB_SETFOREGROUND = GUICtrlCreateCheckbox('The message box becomes the foreground window', 240, 232, 247, 37, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_MULTILINE)) $iCheckboxMB_DEFAULT_DESKTOP_ONLY = GUICtrlCreateCheckbox('Message box shows on the desktop of the interactive window station.', 240, 270, 247, 27, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_MULTILINE)) $iCheckboxMB_TOPMOST = GUICtrlCreateCheckbox('Message box has top-most attribute set', 240, 300, 247, 17) $iCheckboxMB_RIGHT = GUICtrlCreateCheckbox('Title and text are right-justified', 240, 320, 247, 17) $iCheckboxMB_RTLREADING = GUICtrlCreateCheckbox('Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems', 240, 340, 247, 37, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_MULTILINE)) $iCheckboxMB_SERVICE_NOTIFICATION = GUICtrlCreateCheckbox('The function displays a message box on the current active desktop, even if there is no user logged on to the computer', 240, 380, 247, 47, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_MULTILINE)) GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup('Timeout(seconds)', 10, 410, 101, 51) $iInputTimeout = GUICtrlCreateInput('0', 20, 430, 80, 21) GUICtrlCreateUpdown(-1, BitOR($UDS_ARROWKEYS, $UDS_NOTHOUSANDS)) GUICtrlSetLimit(-1, 10000, 0) GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup('Parent Handle', 120, 410, 101, 51) $iInputParentHandle = GUICtrlCreateInput('', 130, 430, 81, 21) GUICtrlCreateGroup('', -99, -99, 1, 1) $iButtonCopyToClipboard = GUICtrlCreateButton('Copy code to clipboard', 230, 436, 120, 25) $iButtonInsertIntoScite = GUICtrlCreateButton('Insert into SciTE', 355, 436, 90, 25) $iButtonPreview = GUICtrlCreateButton('Preview', 450, 436, 45, 25) GUISetState(@SW_SHOW) $iFlags = 0 $sFlags = '' $iPreviewFlags = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $iButtonCopyToClipboard _GenerateFlags() ClipPut(_GenerateCode($sFlags)) _Reset() Case $iButtonInsertIntoScite _GenerateFlags() _InsertIntoSciTE(_GenerateCode($sFlags)) _Reset() Case $iButtonPreview _GenerateFlags() _Preview() _Reset() EndSwitch WEnd Func _Reset() $iFlags = 0 $sFlags = '' $iPreviewFlags = 0 EndFunc Func _GenerateCode($LsFlags = '') Local $sMsgBoxCode = '' $sMsgBoxCode &= 'MsgBox(' If $iFlags > 1 Then $sMsgBoxCode &= 'BitOr(' & $LsFlags & ')' Else $sMsgBoxCode &= $LsFlags EndIf $sMsgBoxCode &= ', ' & GUICtrlRead($iInputTitle) $sMsgBoxCode &= ', ' & GUICtrlRead($iEditText) If GUICtrlRead($iInputParentHandle) <> '' Then $sMsgBoxCode &= ', ' & GUICtrlRead($iInputTimeout) & ', ' $sMsgBoxCode &= GUICtrlRead($iInputParentHandle) ElseIf Guictrlread($iInputTimeout) <> 0 Then $sMsgBoxCode &= ', ' & GUICtrlRead($iInputTimeout) EndIf $sMsgBoxCode &= ')' Return $sMsgBoxCode EndFunc Func _GenerateFlags() If BitAND(GUICtrlRead($iRadioIconError), $GUI_CHECKED) Then _AddToFlags('$MB_ICONERROR', $MB_ICONERROR) ElseIf BitAnd(GUICtrlRead($iRadioIconQuestion), $GUI_CHECKED) Then _AddToFlags('$MB_ICONQUESTION', $MB_ICONQUESTION) ElseIf BitAnd(GUICtrlRead($iRadioIconWarning), $GUI_CHECKED) Then _AddToFlags('$MB_ICONWARNING', $MB_ICONWARNING) ElseIf BitAND(GUICtrlRead($iRadioIconInformation), $GUI_CHECKED) Then _AddToFlags('$MB_ICONINFORMATION', $MB_ICONINFORMATION) EndIf Switch GUICtrlRead($iComboButtons) Case $sOK _AddToFlags('') Case $sOKCANCEL _AddToFlags('$MB_OKCANCEL', $MB_OKCANCEL) Case $sABORTRETRYIGNORE _AddToFlags('$MB_ABORTRETRYIGNORE', $MB_ABORTRETRYIGNORE) Case $sYESNOCANCEL _AddToFlags('$MB_YESNOCANCEL', $MB_YESNOCANCEL) Case $sYESNO _AddToFlags('$MB_YESNO', $MB_YESNO) Case $sRETRYCANCEL _AddToFlags('$MB_RETRYCANCEL', $MB_RETRYCANCEL) Case $sCANCELTRYCONTINUE _AddToFlags('$MB_CANCELTRYCONTINUE', $MB_CANCELTRYCONTINUE) EndSwitch Switch GUICtrlRead($iComboDefButton) Case 'First' _AddToFlags('') Case 'Second' _AddToFlags('$MB_DEFBUTTON2', $MB_DEFBUTTON2) Case 'Third' _AddToFlags('$MB_DEFBUTTON3', $MB_DEFBUTTON3) Case 'Fourth' _AddToFlags('$MB_DEFBUTTON4', $MB_DEFBUTTON4) EndSwitch If BitAND(GUICtrlRead($iCheckboxMB_HELP), $GUI_CHECKED) Then _AddToFlags('$MB_HELP', $MB_HELP) If BitAND(GUICtrlRead($iCheckboxMB_SETFOREGROUND), $GUI_CHECKED) Then _AddToFlags('$MB_SETFOREGROUND', $MB_SETFOREGROUND) If BitAND(GUICtrlRead($iCheckboxMB_DEFAULT_DESKTOP_ONLY), $GUI_CHECKED) Then _AddToFlags('$MB_DEFAULT_DESKTOP_ONLY', $MB_DEFAULT_DESKTOP_ONLY) If BitAND(GUICtrlRead($iCheckboxMB_TOPMOST), $GUI_CHECKED) Then _AddToFlags('$MB_TOPMOST', $MB_TOPMOST) If BitAND(GUICtrlRead($iCheckboxMB_RIGHT), $GUI_CHECKED) Then _AddToFlags('$MB_RIGHT', $MB_RIGHT) If BitAND(GUICtrlRead($iCheckboxMB_RTLREADING), $GUI_CHECKED) Then _AddToFlags('$MB_RTLREADING', $MB_RTLREADING) If BitAND(GUICtrlRead($iCheckboxMB_SERVICE_NOTIFICATION), $GUI_CHECKED) Then _AddToFlags('$MB_SERVICE_NOTIFICATION', $MB_SERVICE_NOTIFICATION) Switch GUICtrlRead($iComboModality) Case 'Application' _AddToFlags('') Case 'System' _AddToFlags('$MB_SYSTEMMODAL', $MB_SYSTEMMODAL) Case 'Task' _AddToFlags('$MB_TASKMODAL', $MB_TASKMODAL) EndSwitch EndFunc Func _InsertIntoSciTE($sCode) If WinExists('[CLASS:SciTEWindow]') Then Local $sClip = ClipGet() ClipPut($sCode) ControlSend('[CLASS:SciTEWindow]', '', '[ID:350;CLASS:Scintilla]', '^v') ClipPut($sClip) Else MsgBox($MB_ICONERROR, 'Error', 'Cannot find SciTe window.') EndIf EndFunc Func _Preview() MsgBox($iPreviewFlags, GUICtrlRead($iInputTitle), GUICtrlRead($iEditText), GUICtrlRead($iInputTimeout), GUICtrlRead($iInputParentHandle)) EndFunc Func _AddToFlags($LsFlag = '', $LiPreviewFlags = 0) If $LsFlag <> '' Then If $iFlags > 0 Then $sFlags &= ', ' $sFlags &= $LsFlag $iFlags += 1 $iPreviewFlags += $LiPreviewFlags EndIf EndFunc MsgBoxGenerator.au3
-
Tooltip with color background
LongBowNZ replied to power1power1's topic in AutoIt General Help and Support
This works for me. #include <GUIConstantsEx.au3> #include <GUIToolTip.au3> Example() Func Example() Local $msg $hGUI = GUICreate("My GUI control tip") ; will create a dialog box that when displayed is centered $iLabel = GUICtrlCreateLabel("my label", 10, 20) $hLabel = GUICtrlGetHandle($iLabel) $hToolTip = _GUIToolTip_Create(0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolTip, "wstr", 0, "wstr", 0) _GUIToolTip_SetTipBkColor($hToolTip, 0x1EBFFF) _GUIToolTip_AddTool($hToolTip, 0, "Tooltip text", $hLabel) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GUIToolTip_Destroy($hToolTip) GUIDelete($hGUI) EndFunc ;==>Example -
Wouldn't the number of parameters in $CmdLine be the same in both. $CmdLine[0] returns the number of parameters on the command line. Try RegWrite("HKEY_CLASSES_ROOT\*\shell\Encrypt\command", '', 'REG_SZ', '"' & @ScriptFullPath & '" "%1"') RegWrite("HKEY_CLASSES_ROOT\*\shell\Encrypt", '', 'REG_SZ', "Encrypt") RegWrite("HKEY_CLASSES_ROOT\*\shell\Decrypt\command", '', 'REG_SZ', '"' & @ScriptFullPath & '" "%2"') RegWrite("HKEY_CLASSES_ROOT\*\shell\Decrypt", '', 'REG_SZ', "Decrypt") If $CmdLine[1]=1 Then MsgBox ('', 'Test', 'encrypt ' & $CmdLine[2]) EndIf If $CmdLine[1]=2 Then MsgBox ('', 'Test', 'decrypt ' & $CmdLine[2]) EndIf or RegWrite("HKEY_CLASSES_ROOT\*\shell\Encrypt\command", '', 'REG_SZ', '"' & @ScriptFullPath & '" "%1"') RegWrite("HKEY_CLASSES_ROOT\*\shell\Encrypt", '', 'REG_SZ', "Encrypt") RegWrite("HKEY_CLASSES_ROOT\*\shell\Decrypt\command", '', 'REG_SZ', '"' & @ScriptFullPath & '" "%2"') RegWrite("HKEY_CLASSES_ROOT\*\shell\Decrypt", '', 'REG_SZ', "Decrypt") If $CmdLine[2]=1 Then MsgBox ('', 'Test', 'encrypt ' & $CmdLine[1]) EndIf If $CmdLine[2]=2 Then MsgBox ('', 'Test', 'decrypt ' & $CmdLine[1]) EndIf
-
Creating an Installer Script for the first time.
LongBowNZ replied to Aeremis's topic in AutoIt General Help and Support
Have a look at the http://www.autoitscript.com/autoit3/docs/functions/ControlSetText.htm Function. -
HotKeySet("{F9}", "size") While 1 Sleep(100) WEnd Func size() Send("!I") Send("z") WinWaitActive("Resize") $width = ControlGetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:1]");reads the current width, change width with the correct control MsgBox(0, "Hello", "Width: " & $width) $height = ControlGetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:2]");reads the current height, change height with the correct control MsgBox(0, "Hello", "Height: " & $height) $resolution = ControlGetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:5]");reads the current resolution, change resolution with the correct control MsgBox(0, "Hello", "Resolution: " & $resolution) If $width < $height Then; compare the 2 ControlSetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:1]", "4000");set the width control, change width with the correct control Else ControlSetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:2]", "4000");set the height control, change height with the correct control EndIf If $resolution <> "100.000" Then ControlSetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:5]", "100");set the resolution control, change resolution with the correct control ;add other actions "to click ok" etc EndFunc Try this. Also I don't know if you saw my edit before, to delete the "Send("z")" if you don't need to send "z".
-
;;[autoit] HotKeySet("{F9}","size") Func size() Send("!I") Send("z") $width = ControlGetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:1]");reads the current width, change width with the correct control msgbox("tvt","Hello",$width) $height = ControlGetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:2]");reads the current height, change height with the correct control msgbox("tvt","Hello",$height) $resolution = ControlGetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:5]");reads the current resolution, change resolution with the correct control msgbox("tvt","Hello",$resolution) If $width < $height Then; compare the 2 ControlSetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:1]", "4000");set the width control, change width with the correct control Else ControlSetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:2]", "4000");set the height control, change height with the correct control EndIf If $resolution <> "100.000" Then ControlSetText("Resize", "", "[CLASS:AfxWnd42; INSTANCE:5]", "100");set the resolution control, change resolution with the correct control ;add other actions "to click ok" etc EndFunc ;;[/autoit] While 1 Sleep(100) WEnd I changed the comparison from > to < and made the comments match the code. See if this works. EDIT: Do you need to send "z" after "alt+i", if not, you should get rid of Send("z")
-
You did on line 15 but not on the ControlGetText function on what looks like line 9.
-
$resolution = ControlGetText("Resize", "", "resolution");reads the current resolution, change resolution with the correct control ------------------------------------------------^ You probably need to get the class and instance instead of "resolution". Just like you did with the other two.
-
This might work: Go to options>Open Global Options File Search for "#Pascal|pas||\" without quotes and remove the hash (#) save and restart scite
-
Insert a .bat code into a .au3 code?
LongBowNZ replied to 345138's topic in AutoIt General Help and Support
Because parts that are needed aren't included in the bat code you posted smart-arse. So post the full code and I might translate it for you. OR If you want to continue being a smart-arse then post another "I just need this part translated" or similar and that's when I will stop posting in this thread. -
I want to build a chat bot
LongBowNZ replied to program builder's topic in AutoIt General Help and Support
Have a look at StringInStr -
That example is incomplete, the error handler is for Internet Explorer windows.
-
Please don't bump your thread within 24 hours of your last post/bump. Someone will get to your topic when they can.
-
Insert a .bat code into a .au3 code?
LongBowNZ replied to 345138's topic in AutoIt General Help and Support
You're not listening to anyone here. IT WOULD BE A HELL OF A LOT EASIER TO TRANSLATE THAT .BAT CODE TO .AU3 IF WE HAD THE WHOLE .BAT. Get it now? -
Insert a .bat code into a .au3 code?
LongBowNZ replied to 345138's topic in AutoIt General Help and Support
You could start learning how to do it yourself or do what I said in the first place and post the full bat code and someone might translate it for you. -
Insert a .bat code into a .au3 code?
LongBowNZ replied to 345138's topic in AutoIt General Help and Support
Post the full .bat code and someone might translate it for you if they are bored. But don't expect anyone to write something for you, they don't have to, you are not paying for our help -
Search first http://www.autoitscript.com/forum/index.ph...;hl=GuiList.au3
-
AutoIt Gui with button on titlebar
LongBowNZ replied to taurus905's topic in AutoIt General Help and Support
You could see if this has the source included in the download (if not maybe PM the maker): http://www.autoitscript.com/forum/index.php?showtopic=71198 -
Attempting to open a program.
LongBowNZ replied to MrVitar's topic in AutoIt General Help and Support
Tested: Run(@ProgramFilesDir & '\Internet Explorer\iexplore.exe', @WorkingDir, @SW_MAXIMIZE)