Jump to content
Sign in to follow this  
singcang

Set Hotkey Stop and Start while loop

Recommended Posts

Hello, I have read a lot of topic about this , but still not work on my code :( sorry, i'm newbie. I want Set Hotkey Stop ( F4)  and Start ( F5) while loop , this is my code :

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>

#Region ### START Koda GUI section ### Form=
$Auto = GUICreate("xxxxxx", 626, 282, 203, 114)
Global $link1 = GUICtrlCreateLabel("xxx link", 16, 16, 96, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $linkinput = GUICtrlCreateInput("", 144, 16, 473, 21)
Global $Start = GUICtrlCreateButton("Start", 432, 104, 161, 41)
GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
Global $Exit = GUICtrlCreateButton("Exit", 432, 160, 161, 41)
GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
$Label1 = GUICtrlCreateLabel(" xxx v1.0", 232, 216, 186, 17)
$Label2 = GUICtrlCreateLabel("xxx", 16, 112, 121, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $numberofplayinput = GUICtrlCreateInput("", 147, 112, 89, 21)
Global $StatusBar1 = _GUICtrlStatusBar_Create($Auto)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 33)
Global $link2 = GUICtrlCreateLabel("xxx link 2", 16, 60, 110, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $linkinput2 = GUICtrlCreateInput("", 142, 57, 473, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

         Case $Start
            $SaveLinkFromUser = GUICtrlRead($linkinput) 
            StartChrome()

         Case $Exit
            Exit 0

    EndSwitch
 WEnd

Func StartChrome()
 ;my code

 While $number 

    $number -= 1


 ;my code


WEnd

 EndFunc

Thanks all !

Edited by singcang

Share this post


Link to post
Share on other sites

There are a couple ways of doing it, but the way i would do it, would be by having _ispressed and conditions in the main loop.


Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
On 7/17/2018 at 6:11 AM, careca said:

There are a couple ways of doing it, but the phenq results i would do it, would be by having _ispressed and conditions in the main loop.

Can you elaborate by any chance please, Careca? It looks like this would be useful for me too.

Edited by Herford

Share this post


Link to post
Share on other sites
10 hours ago, careca said:

There are a couple ways of doing it, but the way i would do it, would be by having _ispressed and conditions in the main loop.

this is code follow your reply , press F4 or F5 but nothing happend :sweating:

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <Misc.au3>


#Region ### START Koda GUI section ### Form=
$Auto = GUICreate("xxx", 626, 282, 203, 114)
Global $link1 = GUICtrlCreateLabel("xxx", 16, 16, 96, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $linkinput = GUICtrlCreateInput("", 144, 16, 473, 21)
Global $Start = GUICtrlCreateButton("Start", 432, 104, 161, 41)
GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
Global $Exit = GUICtrlCreateButton("Exit", 432, 160, 161, 41)
GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
$Label1 = GUICtrlCreateLabel("xxx", 232, 216, 186, 17)
$Label2 = GUICtrlCreateLabel("xxx", 16, 112, 121, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $numberofplayinput = GUICtrlCreateInput("", 147, 112, 89, 21)
Global $StatusBar1 = _GUICtrlStatusBar_Create($Auto)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 33)
Global $link2 = GUICtrlCreateLabel("xxx", 16, 60, 110, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $linkinput2 = GUICtrlCreateInput("", 142, 57, 473, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

         Case $Start
            $SaveLinkFromUser = GUICtrlRead($linkinput)
            StartChrome()

         Case $Exit
            Exit

    EndSwitch
 WEnd

Func StartChrome()
 ShellExecute("chrome.exe",$SaveLinkFromUser, "--start-maximized") 
 Sleep(6000)

$number = GUICtrlRead($numberofplayinput)
Global $hDLL = DllOpen("user32.dll")

 While $number

       $number -= 1

If _IsPressed("73", $hDLL) Then

; my code 

        While _IsPressed("73", $hDLL)
            Sleep(250)
        WEnd

    ElseIf _IsPressed("74", $hDLL) Then
        MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The F5 Key was pressed, therefore we will close the application.")
        ExitLoop
    EndIf
    Sleep(250)

WEnd

DllClose($hDLL)




 EndFunc

 

Share this post


Link to post
Share on other sites

singcang,

Please do not bump your own threads within 24 hours.

Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare.  You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online - so please be patient.

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

 

Share this post


Link to post
Share on other sites
15 hours ago, singcang said:

Hello, I have read a lot of topic about this , but still not work on my code :( sorry, i'm newbie. I want Set Hotkey Stop ( F4)  and Start ( F5) while loop , this is my code :

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>

#Region ### START Koda GUI section ### Form=
$Auto = GUICreate("xxxxxx", 626, 282, 203, 114)
Global $link1 = GUICtrlCreateLabel("xxx link", 16, 16, 96, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $linkinput = GUICtrlCreateInput("", 144, 16, 473, 21)
Global $Start = GUICtrlCreateButton("Start", 432, 104, 161, 41)
GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
Global $Exit = GUICtrlCreateButton("Exit", 432, 160, 161, 41)
GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
$Label1 = GUICtrlCreateLabel(" xxx v1.0", 232, 216, 186, 17)
$Label2 = GUICtrlCreateLabel("xxx", 16, 112, 121, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $numberofplayinput = GUICtrlCreateInput("", 147, 112, 89, 21)
Global $StatusBar1 = _GUICtrlStatusBar_Create($Auto)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 33)
Global $link2 = GUICtrlCreateLabel("xxx link 2", 16, 60, 110, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
Global $linkinput2 = GUICtrlCreateInput("", 142, 57, 473, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

         Case $Start
            $SaveLinkFromUser = GUICtrlRead($linkinput) 
            StartChrome()

         Case $Exit
            Exit 0

    EndSwitch
 WEnd

Func StartChrome()
 ;my code

 While $number 

    $number -= 1


 ;my code


WEnd

 EndFunc

Thanks all !

HotKeySet("f4",namefunc)

HotKeySet("f5",_ExitLoop)


Func _ExitLoop()
  ExitLoop
EndFunc

Try this, ando tell me

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...