Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/24/2014 in Posts

  1. As I look through _WinAPI_* entries in the help file there are many without examples. It's quite a task for any one person to undertake, so I propose anyone who can be bothered every now and then, figure one out and post an example here. I'd suggest not using the help forum as that defeats the object. I'll go first with an easy one from near the top. EDIT: (regarding guinness' below post) If you wish your example to be considered for help file entry, please follow his instructions. If you don't care then don't worry, just the example will do however you like. EDIT2: The links below are to the examples, not the online help. EDIT3: If anyone wants to modify any examples to be help file worthy you are most welcome to. _WinAPI_ArrayToStruct _WinAPI_AbortPath >_WinAPI_AdjustWindowRectEx >_WinAPI_GetDefaultUserProfileDirectory >_WinAPI_DeleteFile >_WinAPI_GetAsyncKeyState >_WinAPI_GetCurrentDirectory >_WinAPI_GetDefaultPrinter >_WinAPI_GetDeviceCaps >_WinAPI_GetDriveType >_WinAPI_GetErrorMessage >_WinAPI_GetFileType >_WinAPI_GetGraphicsMode >_WinAPI_GetGuiResources >_WinAPI_GetPEType >_WinAPI_GetPolyFillMode >_WinAPI_GetPriorityClass >_WinAPI_GetProcessHandleCount >_WinAPI_GetProcessIoCounters >_WinAPI_GetProfilesDirectory >_WinAPI_GetROP2 >_WinAPI_GetStartupInfo >_WinAPI_GetStdHandle >_WinAPI_GetSystemDEPPolicy >_WinAPI_GetSystemInfo >_WinAPI_GetSystemMetrics >_WinAPI_GetSystemTimes >_WinAPI_GetSystemWow64Directory >_WinAPI_GetTempFileName >_WinAPI_GetVersionEx >_WinAPI_GetWindowDC >_WinAPI_GetWindowFileName >_WinAPI_GetWindowHeight >_WinAPI_GetWindowWidth >_WinAPI_GlobalMemoryStatus >_WinAPI_HiByte >_WinAPI_InflateRect >_WinAPI_IsChild >_WinAPI_IsClassName >_WinAPI_IsElevated >_WinAPI_LoByte >_WinAPI_OpenProcess
    1 point
  2. No. You can however pseudo embed internet explorer, you'll find a script for that in example forum.
    1 point
  3. Or else using $UDS_ARROWKEYS #include <GUIConstantsEx.au3> #include <UpdownConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput(100, 10, 10, 200, 20) GUICtrlCreateUpdown($cInput, $UDS_ARROWKEYS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd [EDIT] I kept leaving in the DLL stuff...
    1 point
  4. mrider

    IpToLong and LongToIP

    I'm not necessarily advocating against using the DLL, but the algorithm for converting to a number and back to an address isn't particularly complicated... Func IpToInt($addr) If Not IsArray($addr) Then ConsoleWriteError("IpToInt: $addr was not an array" & @LF) Return SetError(-1, 0, 0) EndIf If Not UBound($addr) == 4 Then ConsoleWriteError("IpToInt: $addr was a " & UBound($addr) & " element array" & @LF) Return SetError(-1, 0, 0) EndIf Local $ret = 0 $ret += BitShift($addr[0], -24) $ret += BitShift($addr[1], -16) $ret += BitShift($addr[2], -8) $ret += $addr[3] Return $ret EndFunc Func IntToIp($addr) If Not IsInt($addr) Then ConsoleWriteError("IntToIp: " & $addr & " is not an integer" & @LF) Return SetError(-1, 0, 0) EndIf Local $ret[4] $ret[0] = BitShift($addr, 24) $ret[0] = BitAND($ret[0], 0xFF) $ret[1] = BitShift($addr, 16) $ret[1] = BitAND($ret[1], 0xFF) $ret[2] = BitShift($addr, 8) $ret[2] = BitAND($ret[2], 0xFF) $ret[3] = BitAND($addr, 0xFF) Return $ret EndFunc
    1 point
  5. The only way to accomplish this is with a code signing cert. You can go with Verisign ($499 a year) or Comodo ($179 a year). But there is no way to just programmatically force it to register it as a known entity (that is, in essence, what it is designed to prevent).
    1 point
  6. Here is a modified version of the code you posted. #include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 355, 202, 192, 124) $Input1 = GUICtrlCreateInput("Enter # of seconds to wait..", 48, 16, 225, 21) $Button1 = GUICtrlCreateButton("Button1", 80, 64, 161, 81) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ;Here i want to pop up my msg after the duration i want how !! $t = GUICtrlRead($Input1) Sleep($t * 1000 ) MsgBox(0, $t, "This dialog popped up after " & $t & " seconds") EndSwitch WEnd
    1 point
  7. This might not be the best approach, but it works (i'm sure there are many ways of doing it - that's the magic of autoit): #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $timer, $tdiff, $t, $timeron = 0 ;add some global variables for ease of tracking $Form1 = GUICreate("Form1", 355, 202, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 48, 16, 225, 21) $Button1 = GUICtrlCreateButton("Button1", 80, 64, 161, 81) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ;Here i want to pop up my msg after the duration i want how !! $t = GUICtrlRead($Input1) $timeron = 1 ;set $timeron to 1 so that we can start checking timer elapsed time in the While loop below $timer = TimerInit() ;initiate a timer and assign to $timer variable EndSwitch If $timeron = 1 Then ;if $timeron is 1 then we can start checking the elapsed timer time $tdiff = TimerDiff($timer) ;$tdiff = time in milliseconds that has passed since we started our timer above using TimerInit() If $tdiff >= 2000 Then ;if the timer reaches 2000 milliseconds (2 seconds) or more then we pop up a message box - we can even report how much time has passed since we started the timer by adding $tdiff to the MsgBox MsgBox(0,'','Your text was: ' & $t & @CRLF & @CRLF & 'This message popped up after ' & Round($tdiff/1000, 2) & ' seconds.') ;pop up the message $timeron = 0 ;set $timeron to 0 so that we stop checking for timer until we start it again by clicking the button :) EndIf EndIf WEnd Edit: Whoops I didn't notice you wanted to get seconds value from the input, so here is a modified script that does that. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $timer, $tdiff, $t, $timeron = 0 ;add some global variables for ease of tracking $Form1 = GUICreate("Form1", 355, 202, 192, 124) $Input1 = GUICtrlCreateInput("Enter duration in seconds here", 48, 16, 225, 21) $Button1 = GUICtrlCreateButton("Button1", 80, 64, 161, 81) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ;Here i want to pop up my msg after the duration i want how !! $t = GUICtrlRead($Input1) $timeron = 1 ;set $timeron to 1 so that we can start checking timer elapsed time in the While loop below $timer = TimerInit() ;initiate a timer and assign to $timer variable EndSwitch If $timeron = 1 Then ;if $timeron is 1 then we can start checking the elapsed timer time $tdiff = TimerDiff($timer) ;$tdiff = time in milliseconds that has passed since we started our timer above using TimerInit() If $tdiff >= $t * 1000 Then ;if the timer reaches set time in seconds or more then we pop up a message box - we can even report how much time has passed since we started the timer by adding $tdiff to the MsgBox MsgBox(0,'','You set timer to: ' & $t & ' seconds.' & @CRLF & @CRLF & 'This message popped up after ' & Round($tdiff/1000, 0) & ' seconds.') ;pop up the message $timeron = 0 ;set $timeron to 0 so that we stop checking for timer until we start it again by clicking the button :) EndIf EndIf WEnd The difference between my script and the one posted below by somdcomputerguy is that with my script you can have other things happening at the same time. e.g. have another button that you can click and get a different message, whilst the timer is running (or not). See Example below: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $timer, $tdiff, $t, $timeron = 0 ;add some global variables for ease of tracking $Form1 = GUICreate("Form1", 355, 202, 192, 124) $Input1 = GUICtrlCreateInput("Enter duration in seconds here", 48, 16, 225, 21) $Button1 = GUICtrlCreateButton("Button1", 80, 64, 100, 50) $Button2 = GUICtrlCreateButton("Button2", 80, 124, 100, 50) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ;Here i want to pop up my msg after the duration i want how !! $t = GUICtrlRead($Input1) $timeron = 1 ;set $timeron to 1 so that we can start checking timer elapsed time in the While loop below $timer = TimerInit() ;initiate a timer and assign to $timer variable Case $Button2 If $timeron = 1 Then MsgBox(0,'','You pressed Button2 whilst time was ON') Else MsgBox(0,'','You pressed Button2 whilst time was OFF') EndIf EndSwitch If $timeron = 1 Then ;if $timeron is 1 then we can start checking the elapsed timer time $tdiff = TimerDiff($timer) ;$tdiff = time in milliseconds that has passed since we started our timer above using TimerInit() If $tdiff >= $t * 1000 Then ;if the timer reaches set time in seconds or more then we pop up a message box - we can even report how much time has passed since we started the timer by adding $tdiff to the MsgBox MsgBox(0,'','You set timer to: ' & $t & ' seconds.' & @CRLF & @CRLF & 'This message popped up after ' & Round($tdiff/1000, 0) & ' seconds.') ;pop up the message $timeron = 0 ;set $timeron to 0 so that we stop checking for timer until we start it again by clicking the button :) EndIf EndIf WEnd With somdcomputerguy's script even if you have a second button that pops up another message box it will only pop after the first message box is gone (i.e. each button's action will be queued and will fire only after the first one is done). I guess it all comes down to how you want to handle this for your particular application - I prefer to be able to execute concurrent action to provide a seamless user experience, but I can see where Sleep(x) can come in handy.
    1 point
  8. Have you read the help file for GUICtrlCreateCombo? The example script shows how items are added to the combo box.
    1 point
  9. I think the Language Reference - User Functions section in the Help file could explain it better than I could. http://www.autoitscript.com/autoit3/docs/intro/lang_functions.htm Kudos to you for wanting to learn more about AutoIt!
    1 point
  10. _WinAPI_OpenProcess _WinAPI_GetGuiResources
    1 point
  11. llewxam

    Data Protector

    That's an odd response. You made a few suggestions, I tried what you said in order to better my code, I disliked it and said so and why. If that hurts your feelings then you need to grow a tougher skin. You are undoubtedly a better programmer than I am, which is exactly why I tried some of the programmatic improvements you suggested. If you have some actual, beneficial reasoning why I should continue to practice some of these ideas I would love to hear them, in all seriousness. What good is it for me to continue to post code if it is poorly written? Folks like you can (and DO) teach me a lot. So leave the childish bullshit behind and realize that I was trying out what you said, failed to see why it is important, and look forward to getting some helpful explanations why I need to change my ways. Ian
    1 point
  12. Thanks, this is very useful. I made a few tweaks to add the following functions: Support for the guide button (the one in the center of the xbox 360 controller) Created function to turn off the controller Created function to check if a controller is connected or not _XInput.au3
    1 point
  13. There must be a proper way to do this with just IE.au3 but I'm having little luck, and the mht isn't nearly as complete as I had hoped it would be. Does this error on you? #include <IE.au3> $oIE = _IEAttach("SAP BusinessObjects") $oIE.document.parentWindow.execScript('var hplus = getHeaderPlusFrame();if (hplus) {hplus.onBtnListingClick();}',"javascript")
    1 point
×
×
  • Create New...