Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. I just got a new mouse that has macro functionality, and i wanted to make something simmilar for my keyboard. Thing is, _WinAPI_SetKeyboardState gives me an error i cannot seem to fix. Please ask me if you have any questions, also here is the code: #include <WinAPISys.au3> #include <Array.au3> #include <File.au3> #include <GUIConstantsEx.au3> HotKeySet('{ESC}', 'Close') Global $bRecording = False Global $bStop = False Func Close() $bStop = True EndFunc ;==>Close $hGUI = GUICreate('Input recorder', 500, 200) $idStartRecording = GUICtrlCreateButton('Start recording', 80, 100) $idStopRecording = GUICtrlCreateButton('Run macro', 320, 100) GUISetState() Global $aArray[11][2] $hTimer = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idStartRecording $bStop = False GUICtrlSetData($idStartRecording, 'Running...') $hFile = FileOpen(@ScriptDir & '\Macro' & @YEAR & '.' & @MON & '.' & @MDAY & '-' & @HOUR & '.' & @MIN & '.' & @SEC & '.macro', 1) While $bStop = False ;$hTimer = TimerInit() For $i = 0 To 10 If $i <> 0 Then Do Sleep(10) $a = _WinAPI_GetKeyboardStateMod() Until _ArrayToString($a, '') <> $aArray[$i - 1][0] or $bStop = True ;ConsoleWrite(_ArrayToString($a, '') & ' ' & $aArray[$i - 1][0]) Else $a = _WinAPI_GetKeyboardStateMod() EndIf $aArray[$i][0] = _ArrayToString($a, '') $aArray[$i][1] = Round(TimerDiff($hTimer), 1) $hTimer = TimerInit() Next _FileWriteFromArray($hFile, $aArray, Default, Default, @CRLF) for $iO = 0 to 10 $aArray[$iO][0] = '' $aArray[$iO][1] = '' Next ;ConsoleWrite(@error) WEnd _FileWriteFromArray($hFile, $aArray, Default, Default, @CRLF) GUICtrlSetData($idStartRecording, 'Start recording') Case $idStopRecording $bStop = False $hFile = FileOpen(FileOpenDialog('Select macro file', @ScriptDir, 'Macro files (*.macro)', 1 + 2)) GUICtrlSetData($idStopRecording, 'Running...') $sFileContent = FileRead($hFile) ;ConsoleWrite($sFileContent&@CRLF&@CRLF&@CRLF) $aWholeFile = StringSplit($sFileContent, @LF) ;_ArrayDisplay($aWholeFile) For $i = 1 To $aWholeFile[0] - 1 ;ConsoleWrite(Mod($i,2)) if $bStop = True Then ExitLoop If $aWholeFile[$i] <> @CR Then If Mod($i,2) = 1 Then ConsoleWrite('Array ' & $aWholeFile[$i]) $aCharPresses = StringSplit($aWholeFile[$i], '') _WinAPI_SetKeyboardState($aCharPresses) Else ConsoleWrite('Sleep ' & $aWholeFile[$i]) Sleep(Int($aWholeFile[$i])) EndIf EndIf Next GUICtrlSetData($idStopRecording, 'Run macro') EndSwitch WEnd Func _WinAPI_GetKeyboardStateMod() Local $aDllRet, $lpKeyState = DllStructCreate("byte[256]") $aDllRet = DllCall("User32.dll", "int", "GetKeyboardState", "ptr", DllStructGetPtr($lpKeyState)) Local $aReturn[256] For $i = 1 To 256 $aReturn[$i - 1] = DllStructGetData($lpKeyState, 1, $i) Next Return $aReturn EndFunc ;==>_WinAPI_GetKeyboardStateMod
  3. Your last $iRet, as you noted, returns the number of bytes read. After that, you need to get the received data from the buffer. Add another line such as: $iRet = DllStructGetData($tBinData, 1) I hope that works; I'm kinda sketchy on structs, myself. Alan
  4. Hi all, I am trying to automate some tasks in a powerpoint addin named office timeline. It's free to install and use in basic mode if you want to try (https://www.officetimeline.com/). I managed to open it from autoit with keyboard shortcuts but once opened I dont know which objects I can use to interact with it as the Window info gives me no control: >>>> Window <<<< Title: Office Timeline Class: HwndWrapper[Otl.Addin.vsto|vstolocal;VSTA_Main;94563982-e478-4c06-b35a-f2be728f72cc] Position: 29, 64 Size: 1220, 640 Style: 0x16080000 ExStyle: 0x00080000 Handle: 0x0002066E >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 1037, 651 Cursor ID: 0 Color: 0xF1F1F1 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< >>>> Hidden Text <<<< Example addin window here: I suspect the objects exist anyway (new, import, recent file 1, 2...) , how do I find them? I could use mouseclicks for some features but I'd rather have more robust code. Thanks
  5. As an example run MsgBox(0, "", @LogonDomain) to get the name of the domain you are currently logged in.
  6. Have you tried all three? Are you getting errors? Have you then looked at the running process in Task Manager to see what user account it is running under? Which works for you?
  7. Hi i have been running into a few issue with a simple "RunAs" prefix. In the help it lists: RunAs ( "username", "domain", "password", logon_flag, "program" [, "workingdir" [, show_flag [, opt_flag]]] ) if i make those into variables like: Global $Domain = "Domain.net" OR "Domain" OR "Domain\" Global $UserName = "ITtest" Global $Password = "Password" Do i include the ".net" at the end for my domain? Or do i use a "domain\" Ect. I'm new to the forms and not sure the best way to go about posting this.
  8. @geoffrey6767 We do not permit payware promotions - one would think you could figure this out with all the other promotions that have been immediately removed from this thread.
  9. Alternatively use AdlibRegister for example: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiConstants.au3> #include <MsgBoxConstants.au3> Global $bPing = False, $iCounter = 0, $Title = "Back Online? v1 by Dan" HotKeySet("{ESC}", "_Terminate") GUICreate($Title,300,200) $sCenter = WinGetClientSize($Title) GUICtrlCreateLabel("Back Online?",0,10, $sCenter[0],50,$SS_CENTER) GUICtrlSetFont (-1,20) GUICtrlCreateLabel("Enter The IP Address To Monitor", 0, 60, $sCenter[0],-1,$SS_CENTER) GUICtrlSetFont (-1,12) Global $sIPAddr = GUICtrlCreateInput("",70, 90, $sCenter[0]/2,30,$ES_CENTER) $sStartPing = GUICtrlCreateButton("Monitor",70,125,$sCenter[0] / 2,25,$SS_CENTER) GUICtrlCreateLabel("Waiting IP...", 120, 175,60) GUISetState(@SW_SHOW) AdlibRegister("_Ping") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $sStartPing If GUICtrlRead($sIPAddr) == "" Then MsgBox(64,$Title,"Yeet says hi!") GUICtrlSetData($sStartPing, "Monitor") $bPing = False Else GUICtrlSetData($sStartPing, "Monitoring...") $bPing = True EndIf EndSwitch WEnd Func _Ping() If $bPing = False Then Return If Ping(GUICtrlRead($sIPAddr), 50) Then _Success();$ipaddr) Else $iCounter +=1 if $iCounter > 10 Then MsgBox(64,$Title,"I dont think its coming back?"&@CRLF&"Ill Close") ; use ie_create http://localhost/backon.php?status=Offline&ip=$ipaddr Exit EndIf GUICtrlSetData(-1,"Attempt "&$iCounter) EndIf EndFunc Func _Terminate() Exit EndFunc Func _Success() MsgBox(64,$Title,"Its back up,"&@CRLF&"Ive sent you a notification") ; use ie_create http://localhost/backon.php?status=Backup&ip=$ipaddr Exit EndFunc
  10. I like what you are doing even if I haven't need it. But surely is a god-sent when is needed. So thank you for working on it
  11. Today
  12. You're all heroes, truly! Thanks a lot! I got this to work, so I'll build from that example to implement what I need in my code. Thanks, @Danyfirex! And of course, a lot of gratitude as well for @Earthshine and @water and @TheXman for getting this discussion going! 😍
  13. Melba23, I like your UDF a lot - it is very useful to me 😁 I encounter a small issue, maybe you can help me out... If I use a column with auto-drop-down, like to type any other text which is _not_ in the drop down list and press enter the input will be discarded (= blank list view item). If I repeat it works... Here is a reproducer (- please use "Col-3" to test): #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GUIListViewEx.au3" Local $hGUI = GUICreate("TEST", 500, 500) Local $cLV = GUICtrlCreateListView("Col-0|Col-1|Col-2|Col-3", 10, 10, 420, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_FULLROWSELECT) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth($cLV, $i, 100) Next Global $aLVArray[6][4] For $i = 0 To 5 $sData = $i & "-0" $aLVArray[$i][0] = $sData For $j = 1 To 3 $sData &= "|" & $j $aLVArray[$i][$j] = "" & $j Next GUICtrlCreateListViewItem($sData, $cLV) Next $iLVIndex = _GUIListViewEx_Init($cLV, $aLVArray) _GUIListViewEx_SetEditStatus($iLVIndex, 3, 2, "||1|2|3|4|5|6", 2) _GUIListViewEx_MsgRegister() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIListViewEx_EventMonitor() WEnd I guess it has something to do with the auto-complete behavior... Any change to work around to store the input at the fist time?
  14. Nope, still shows as \\dfsroot\site\RetailApps for the ProviderName.
  15. You might like to use Opt("GUIOnEventMode", 1) GUICtrlSetOnEvent ..... to trap your GUI events and run functions when they are clicked. This frees you from constantly checking for them in a while / case loop. There are some good examples on the GUICtrlSetOnEvent help page. I'm sure there are appropriate use cases for both methods, but I find I always use this method to write GUIs in AutoIt.
  16. yeah, that should do it! i was thinking along those lines after looking at the VBA example
  17. Because the forum changes the content, I can do nothing. Delete the bracket at the end of the line and enter it again. Is it hard to do?
  18. Edited: Browser sent info twice 😤. Saludos
  19. Hello. my two cents... #include <MsgBoxConstants.au3> Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") ;Register AutoIt Error handler Global $oObject = ObjCreate("JustRemotePhone.RemotePhoneService.ApplicationFactory") ;Create Main object ConsoleWrite("-oObject: " & IsObj($oObject) & @CRLF) Global $oApplication = $oObject.CreateApplication("AutoIt Client") ;Create Application If Not IsObj($oApplication) Then Exit MsgBox($MB_ICONERROR, "Error", "Unable to Create 'Remote Phone Call' Instance") EndIf Global $sNumber = InputBox("Add a number to be Called", "Phone Number", "") If Not $sNumber Then Exit MsgBox($MB_ICONINFORMATION, "Error", "Phone Number is Emtpy Script will Exit.") $oApplication.BeginConnect(True) ;Begin Connection ;You probably will need to grant accest to the application at this point. Global $oPhone = $oApplication.Phone ;Create Phone Object ConsoleWrite("-oPhone: " & IsObj($oPhone) & @CRLF) ;Call $oPhone.Call($sNumber) $oApplication.BeginDisconnect() ;End Connection ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc PD: Can't load syntaxhighlighter Cuz My Connection is too slow. So I'll update it later. Saludos
  20. so you can still run and install it. they are just informing you that they can't verify the publisher, and if you want to trust them.
  21. Also look at this Wiki page: https://www.autoitscript.com/wiki/Interrupting_a_running_function
  22. Problem Found BmpSearch.au3" (46) : ==> Variable must be of type "Object".: Local $iRowInc = ($tSizeSource.X - $tSizeFind.X) * 4 Local $iRowInc = ($tSizeSource.X - $tSizeFind^ ERROR BmpSearch downloaded from
  23. In a fresh windows 10, I tried to Dl the studio with that edge thingi MS is so proud of and got this. So it seems that MS don't see the studio as a virus. Cheers /Rex
  24. Yeah, I can connect the ApplicationFactory-object as well, without any issues, but this ApplicationFactory-object is mentioned nowhere in RemotePhone's API. So, I contacted them to see what possibilities there are to get this to work. If I find out more, I'll post it here... Greetings!
  25. I am quite confident (but it remains untested on my part) that some of the Win32_ WMI class could answer your question. Look at Win32_MappedLogicalDisk or Win32_LogicalDisk or some other class in that category. You may find what you need.
  1. Load more activity
  • Create New...