Jump to content

HotKeySet in Help File is Broke?


Go to solution Solved by Melba23,

Recommended Posts

Hi,

  been searching for a way to Pause a HotKeySet and it would seem that the Help File has one beautifully prepared.

But it turns out that Pause does not stop the HotKeySet from working.

  Anyone know why? And/Or how to fix it?

Thanks,

Bill

Link to post
Share on other sites

The example script doesn't pause the HotKeySet but the script itself by executing a Sleep statement until the Pause key is pressed again.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

What do you mean by "pause a hotkeyset"? The example in the Help file is showing how to pause a script using the Pause button in a hotkeyset statement, and it pauses the script as written.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

Yo,   Thats sort of what I said....

Any way to actually pause a HKS (cause the script not to react to input) ?

 

What do you mean by "pause a hotkeyset"? The example in the Help file is showing how to pause a script using the Pause button in a hotkeyset statement, and it pauses the script as written.

 If you Pause the script you can still use the scripts functions. Not really a pause IMO

Edited by billo
Link to post
Share on other sites
  • Moderators
  • Solution

billo,

Are you talking about the example script for HotKeySet itself? :huh:

If so, then the TogglePause function is not designed to "pause" the other HotKeys (obviously the HotKey to toggle the pause must remain active. If you wanted to prevent the Shift-Alt-d HotKey from working when the script was paused then you need to set/unset the HotKey like this: :)

#include <MsgBoxConstants.au3>

; Press Esc to terminate script, Pause/Break to "pause"

Global $fPaused = False

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d

While 1
    Sleep(100)
WEnd

Func TogglePause()
    $fPaused = Not $fPaused
    If $fPaused Then
        HotKeySet("+!d") ; Unset HotKey <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Else
        HotKeySet("+!d", "ShowMessage") ; Set HotKey <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndIf
    While $fPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
EndFunc   ;==>ShowMessage
M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

Please explain, in detail, what you want to do. Because right now, I'm still not understanding what pause a hotkeyset means in your thoughts, because it makes no sense in mine.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

li'l help ? :-)  could not find on the fly

ERROR: can't open include file <MsgBoxConstants.au3

A download link would be sweet

 

Nevermind...it works without it.

Thanks Melba !!!

Edited by billo
Link to post
Share on other sites

 

Please explain, in detail, what you want to do. Because right now, I'm still not understanding what pause a hotkeyset means in your thoughts, because it makes no sense in mine.

If you test the HKS from the helpfile there are three functions:

TogglePause, Exit and Pop up message

Normally it should be assumable that pausing would cause the script itself to stop receiving commands or FUNCtioning.

But if you push <pause> the popup function still works.

Link to post
Share on other sites

MsgBoxConstants.au3 is only the AutoIt beta and not the stable. We decided it would be best to place MsgBox() constants from Constants.au3 to a new include file. Though it's still included in Constants.au3 for backwards compatibility.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By water
      ATTENTION! THIS IS STILL WORK IN PROGRESS!
      This is the modified version of MrCreatoR's "Simple Library Docs Generator".
      It allows to create CHM help files that look like the AutoIt help file.
      In additon this CHM files can then be used with Advanced.Help.
      This a very early alpha version - so it is miles away from being perfect. It's just something for you to play with.
      The documentation is in the making and will be published as soon as possible.
       
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    • By seadoggie01
      I went to go edit my Au3Check parameters today, opened the SciTE4AutoIt3 helpfile to review the options, and could only find this:
      #AutoIt3Wrapper_Au3Check_Parameters= ;Au3Check parameters...see SciTE4AutoIt3 Helpfile for options Am I missing them elsewhere in the helpfile, or is this a circular reference?  (My helpfile was last updated in the history on 23-3-2021)
    • By water
      Due to corona I have a  lot of spare time at the moment. So I started to create a "real" help file fo the AD UDF (MS Active Directory).
      This help file should look/work like the AutoIt help file.

      Attached you find the first beta of the AD help file.
       
      Done so far:
      Similar functions have been assigned to a group (example: mail, mailbox and Exchange related functions have been assigned to the "EMail" group) Content, Search and Index tabs work Formatting is similar to the AutoIt help file Introduction page ToDo:
      Fill index tab Use folder icons Set the correct font size for the TOC Enhance the CSS to fully match the formatting of the AutoIt help file Create a documentation so you can create CHM files for other homegrown UDFs Create pages for the chapters - return an error message at the moment Upgrade to the latest version of Microsoft HTML Workshop Seems 1.3 is the latest What do you think?
      Is something still missing on the ToDo-list?
      Comments please
      AD.chm
    • By mannworks00
      Hey all,
      I know this code has been attempted before as a GUI app, and it would not copy text properly. Here is an updated version of the Google Search Shortcut  Script from: Google Search Shortcut Script
      #Region #AutoIt3Wrapper_Outfile=shortcuts.exe #EndRegion #include <Clipboard.au3> Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) HotKeySet("{F1}", "_googleit") TraySetToolTip("Right click to exit") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "_exit") While 1 Sleep(20) WEnd #cs _googleit() Source User: ViciousXUSMC https://www.autoitscript.com/forum/topic/177446-google-search-shortcut-script/?do=findComment&comment=1273519 #ce Source Func _googleit() Opt("WinTitleMatchMode", 2) ;Set Title Match To "Any Part of String" $sOldClip = ClipGet() ;Save Current Clipboard Send("^c") ;Copy Selected Text to Clipboard *before losing focus of current window WinActivate("Google Chrome", "") ; activate chrome ShellExecute("https://www.google.at/search?q=" & URLEncode(_ClipBoard_GetData())) ;Navigate to search ClipPut($sOldClip) ;Restore Old Clipboard Opt("WinTitleMatchMode", 1) ; Sets back to default EndFunc ;==>_googleit ;URL encoding is critical when doing string search queries via URL. #cs URLEncode Source User: Dhilip89 - UnicodeURL UDF https://www.autoitscript.com/forum/topic/46894-unicodeurl-udf/ #ce Func URLEncode($UnicodeURL) $UnicodeBinary = StringToBinary($UnicodeURL, 4) $UnicodeBinary2 = StringReplace($UnicodeBinary, '0x', '', 1) $UnicodeBinaryLength = StringLen($UnicodeBinary2) Local $EncodedString For $i = 1 To $UnicodeBinaryLength Step 2 $UnicodeBinaryChar = StringMid($UnicodeBinary2, $i, 2) If StringInStr("$-_.+!*'(),;/?:@=&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", BinaryToString('0x' & $UnicodeBinaryChar, 4)) Then $EncodedString &= BinaryToString('0x' & $UnicodeBinaryChar) Else $EncodedString &= '%' & $UnicodeBinaryChar EndIf Next Return $EncodedString EndFunc ;==>URLEncode Func _exit() $result = MsgBox(1, "Shortcuts", "Do you wish to exit Shortcuts?", 0) If $result == 1 Then Exit EndFunc ;==>_exit  
       
      shortcuts.au3
      shortcuts.exe
    • By nacerbaaziz
      Hello
      Can we pause and resume the download in the InetGet function?
      If is possible, what is the solution please?
      I used this code To manage the download

      #include <INet.au3> func _downloader($name, $linc, $filepath, $RTLF = false, $link = false) global $downloader = GUICreate("downloader", 400, 200, -1, -1, $WS_CLIPCHILDREn, $RTLF, $link) global $path = $filePath $labelTxt = GUICtrlCreateLabel("downloading " & $name, 50, 10, 200, 20) global $labelTxt0 = GUICtrlCreateLabel("downloaded size 0 MB " & "OF 0 MB", 50, 60, 300, 20) global $Progress = "" global $sText = ""     For $i = 1 To Random(5, 20, 1) ; Return an integer between 5 and 20 to determine the length of the string.         $sText &= Chr(Random(65, 122, 1)) ; Return an integer between 65 and 122 which represent the ASCII characters between a (lower-case) to Z (upper-case). next global $labelTxt2 = GUICtrlCreateInput("0%", 50, 80, 50, 20) _GUICtrlEdit_SetReadOnly(-1, true) GUIStartGroup("") global $beep = GUICtrlCreateCheckBox("use the progress beep notification", 150, 120, 200, 20) GUIStartGroup("") $button = GUICtrlCreateButton("Cancel', 130, 150, 180, 25, 0x01) $iIndex = 0 global $Target global $url GUIStartGroup("") global $Progress = GUICtrlCreateProgress(50, 90, 150, 20) global $Target = $filepath global $url = $linc global $path = $filepath global $hDownloadNo = _RSMWare_GetData($url, $Target) global $status = false AdlibRegister("SetProgress") global $onprogress = false, $curent = false GUISetState(@sw_Show) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $button $asc = MsgBox(4132,"exit download?","if you click yes the downloading will be cancel, do you want to cancel it ?") if $asc = 6 then AdlibUnRegister("SetProgress") GUIDelete() If $hDownloadNo <> 0 Then InetClose($hDownloadNo) exitLoop endIf EndSwitch if $status = -1 then $status = 0 $hDownloadNo = _RSMWare_GetData($url, $Target) $onprogress = false $curent = false elseIf $Status = 1 then $status = $path GUIDelete() AdlibUnRegister("SetProgress") exitLoop endIf WEnd return $status endFunc Func _RSMWare_GetData($url, $Target) Local $hDownload = InetGet($url, $Target, 1, 1) Return $hDownload EndFunc ;==>_RSMWare_GetData Func SetProgress() Local $state If $hDownloadNo <> 0 Then $state = InetGetInfo($hDownloadNo) If @error = 0 Then $infor = "downloaded size " & Round(Execute(InetGetInfo($hDownloadNo, $INET_DOWNLOADREAD) / 1048576), 2) & " MB of " & Round(Execute(InetGetInfo($hDownloadNo, $INET_DOWNLOADSIZE) / 1048576), 2) & " MB " $onprogress = Round(Ceiling(($state[0] / $state[1]) * 100)) if not (InetGetInfo($hDownloadNo, $INET_DOWNLOADSIZE) = 0) then if $onProgress <= 0 then $onProgress = 0 GUICtrlSetData($Progress, $onProgress) GUICtrlSetData($labelTxt0, $infor) GUICtrlSetData($labelTxt2, $onProgress & "%") if _isChecked($beep) then if $onprogress > $curent then beep((100 + $onprogress * 20), 100) $curent = $onprogress endIf endIf endIf If $state[2] Then If $state[3] Then InetClose($hDownloadNo) $status = 1 else InetClose($hDownloadNo) $status = -1 endIf endIf EndIf endIf EndFunc ;==>SetProgress
×
×
  • Create New...