Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/13/2017 in all areas

  1. Agree with Jos, @jmendonca automating Excel with mouseclicks is , there are far easier ways to do so in AutoIt. If you start with a clear and concise explanation of what application you're working in, and what you're trying to accomplish, and then work backward from there, you will probably receive a lot more help.
    1 point
  2. I see we were both typing and posting at the same time. Just some advice: I assume you used the recorder to produce this and that is really not the best way to automate a process. Maybe you can start with what you want to automate so we can point you in the right direction. Jos
    1 point
  3. Yes, I solved it. You have to get a TreeWalker and just test regex on each one. Just stinks that they don't provide it through the API. Also appears to be quite slow. Oh well.
    1 point
  4. iamtheky

    ArrayFindAll values

    Why would you need to retrieve the values from the array? You could just replace all of the indices returned with the second parameter of the arrayfindall function?
    1 point
  5. Like most things in AutoIt, there are multiple ways to do it, depending on 1D, 2D, etc. How about an example of the array you're working with and the values you're trying to capture, rather than asking us to guess?
    1 point
  6. Somerset

    Freelance

    Necro-poster. It has been 9 years since the last post, prior to yours.
    1 point
  7. water

    Stop Script

    You could set a key combination to exit your script. Please check the help file for HotKeySet.
    1 point
  8. aa2zz6, This works for me... #include <Array.au3> Local $aFile = StringSplit(FileRead(@ScriptDir & '\aa2zz6 help.txt'), @CRLF, 3) Local $out = '' For $1 = 0 To UBound($aFile) - 1 If $aFile[$1] = '' Then ContinueLoop $out &= $aFile[$1] & ' ' Next ConsoleWrite($out & @CRLF) Local $hfl = FileOpen(@ScriptDir & '\aa2zz6 help (final).txt', 2) FileWrite($hfl, $out) FileClose($hfl) file used for testing...aa2zz6 help.txt kylomas
    1 point
  9. Old habits die hard
    1 point
  10. Batman22, Glad it's workiing! (...pulling on a cold Miller Lite...)
    1 point
  11. You probably need to use an urlencode before sending and urldecode function when receiving the data. Maybe this will work Jos
    1 point
  12. The truly useless key nowadays, is the "Scroll Lock". So I use as a "play a macro ON" key. In this case for speaker volume control. #include <WinAPIvkeysConstants.au3> Global $hDLL = DllOpen("user32.dll") OnAutoItExitRegister("OnAutoItExit") Func OnAutoItExit() DllClose($hDLL) EndFunc main() Func main() Local $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If Not $iScrollState Then Send("{SCROLLLOCK}") $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If Not $iScrollState Then Exit MsgBox(262144+16, StringTrimRight(@ScriptName,4), 'failed to turn on "Scroll Lock"',5) If $iScrollState Then Send("{SCROLLLOCK}") $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If $iScrollState Then Exit MsgBox(262144+16, StringTrimRight(@ScriptName,4), 'failed to turn off "Scroll Lock"',5) ; the above code is to make sure we are affecting the keyboard $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) Local $iScrollStateWas = $iScrollState While 1 $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If $iScrollStateWas <> $iScrollState Then $iScrollStateWas = $iScrollState If $iScrollState Then ToolTip("SCROLLLOCK is ON") HotKeySet("{PAUSE}","f_PAUSE") HotKeySet("{UP}","f_UP") HotKeySet("{DOWN}","f_DOWN") HotKeySet("{ESC}","f_ESC") Else HotKeySet("{PAUSE}") HotKeySet("{UP}") HotKeySet("{DOWN}") HotKeySet("{ESC}") ToolTip("") EndIf EndIf Sleep(50) WEnd EndFunc Func f_PAUSE() Send("{VOLUME_MUTE}") ToolTip("VOLUME_MUTE") Send("{SCROLLLOCK OFF}") ; return keyboard use EndFunc ; by {SCROLLLOCK OFF} Func f_UP() Send("{VOLUME_UP}") ToolTip("VOLUME_UP") EndFunc Func f_DOWN() Send("{VOLUME_DOWN}") ToolTip("VOLUME_DOWN") EndFunc Func f_ESC() Exit ; just in case you hide the Tray icon EndFunc Func _WinAPI_Key_GetState($vKey, $vDLL = 'user32.dll') ; read help on _WinAPI_GetAsyncKeyState() and DllOpen() Local $aRet = DllCall($vDLL, 'short', 'GetKeyState', 'int', $vKey) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_GetKeyState Func _WinAPI_Key_Pressed($vKey, $vDLL = 'user32.dll') ; read help on _IsPressed(), but use Virtual-Key Codes (WinAPIvkeysConstants.au3) Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", $vKey) If @error Then Return SetError(@error, @extended, False) Return BitAND($a_R[0], 0x8000) <> 0 EndFunc ;==>_IsPressed Also here is the version of _IsPressed() I use.
    1 point
  13. @Earthshine Here you go... modified version for you to use in case you want the capslock to do more than one thing yet still work normally. Global Const $VK_CAPITAL = 0x14 $WshShell = ObjCreate("WScript.Shell") $rancommand = 0 While 1 Sleep(100) If _Key_Is_On($VK_CAPITAL) Then If $rancommand = 0 Then Run( "notepad.exe");Place command to run when capslock is on here. $rancommand = 1 EndIf EndIf If Not _Key_Is_On($VK_CAPITAL) Then $rancommand = 0 EndIf WEnd Func _Key_Is_On($nVK_KEY, $vDLL = 'User32.dll') Local $a_Ret = DllCall($vDLL, "short", "GetKeyState", "int", $nVK_KEY) Return Not @error And BitAND($a_Ret[0], 0xFF) = 1 EndFunc
    1 point
  14. Problem solved! Thank you JFX! Cool! #include <APIRegConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIDiag.au3> #include <WinAPIReg.au3> HotKeySet('^+{END}', '_quit') ; Ctrl+Shift+END Opt('TrayAutoPause', 0) Local $hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', BitOR($KEY_NOTIFY, $KEY_WOW64_64KEY)) If @error Then ConsoleWrite('linha[' & @ScriptLineNumber & '] @error[' & @error & '] @extended[' & @extended & '] msg[' & _WinAPI_GetErrorMessage(@extended) & ']' & @LF) Exit EndIf _WinAPI_RegQueryReflectionKey($hKey) ConsoleWrite('linha[' & @ScriptLineNumber & '] @error[' & @error & '] @extended[' & @extended & '] msg[' & _WinAPI_GetErrorMessage(@extended) & ']' & @LF) Local $hEvent = _WinAPI_CreateEvent() If Not _WinAPI_RegNotifyChangeKeyValue($hKey, $REG_NOTIFY_CHANGE_LAST_SET, 0, 1, $hEvent) Then ConsoleWrite('linha[' & @ScriptLineNumber & '] @error[' & @error & '] @extended[' & @extended & '] msg[' & _WinAPI_GetErrorMessage(@extended) & ']' & @LF) Exit EndIf AdlibRegister('_quit', 3500) While 1 If Not _WinAPI_WaitForSingleObject($hEvent, 0) Then ConsoleWrite('Change value!' & @LF) Beep(700, 100) Beep(700, 100) Beep(700, 200) If Not _WinAPI_RegNotifyChangeKeyValue($hKey, $REG_NOTIFY_CHANGE_LAST_SET, 0, 1, $hEvent) Then ExitLoop EndIf EndIf Sleep(500) test() WEnd Func test() Local Static $iTry = 0 If Not $iTry Then ;~ Local $hWrite = RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run', 'TEST_KEY', 'REG_SZ', 'Hello this is a test') Local $hWrite = RegWrite('HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'TEST_KEY', 'REG_SZ', 'Hello this is a test') ConsoleWrite('$hWrite[ ' & $hWrite & ' ]' & @LF) Sleep(2000) ;~ Local $hRemove = RegDelete ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run', 'TEST_KEY') Local $hRemove = RegDelete('HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'TEST_KEY') ConsoleWrite('$hRemove[ ' & $hRemove & ' ]' & @LF) $iTry = 1 EndIf EndFunc ;==>test Func _quit() AdlibUnRegister('_quit') Beep(700, 200) _WinAPI_CloseHandle($hEvent) _WinAPI_RegCloseKey($hKey) Exit EndFunc ;==>_quit
    1 point
×
×
  • Create New...