autoitaddicted Posted March 31, 2012 Share Posted March 31, 2012 I am using these codes: BlockInput(1) Run(@DesktopDir & "\autoit\" & "mu.exe", "") -> mu exe sleep(5000) Blockinput(0) blockinput(1) is working ok, but blockinput(0) is not effecting. how to remove effect of blockinput by running another autoit script or exe file ? Link to comment Share on other sites More sharing options...
Guest Posted March 31, 2012 Share Posted March 31, 2012 (edited) Have you tried using shellexecute() instead of run. blockinput(1) Run(@desktopdir & "autoit" & "my.exe") It probable will not fix your problem but shellexecute() is better for running programs than run(). As for block input I think you can just set scripts to undo another dirty work as in the real programming world it would clash horribly. sorry I cant help more. -- James Edited March 31, 2012 by Guest Link to comment Share on other sites More sharing options...
Rogue5099 Posted March 31, 2012 Share Posted March 31, 2012 ShellExecute will not work either. You must call BlockInput(0) from a script that is enabled from. You can always hit Ctrl+Alt+Del to escape BlockInput(1) anyways. My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
autoitaddicted Posted March 31, 2012 Author Share Posted March 31, 2012 (edited) i can't see how shellexecute related with the solution of that problem. and i literally didn't understand what are you trying to say with your second sentence. may be in a simple way, i need a solution like what ctrl+alt+del does to blockinput function. some kind of override. but that override should work in another autoit script. Edited March 31, 2012 by autoitaddicted Link to comment Share on other sites More sharing options...
Guest Posted March 31, 2012 Share Posted March 31, 2012 Sorry that does not make have anything t do with blockinput. Link to comment Share on other sites More sharing options...
Rogue5099 Posted March 31, 2012 Share Posted March 31, 2012 If you exit the script it will also remove BlockInput(1). Maybe set up parameters so you run mu.exe exit main script. From mu.exe call back main.exe with a parameter to start from. Just thinking outside the box! My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Guest Posted March 31, 2012 Share Posted March 31, 2012 (edited) 2nd script (will be run by no1)ProcessClose("1stscript.exe")sleep(5000)Local $PID = ProcessExists("1stscript.exe") ; Will return the PID or 0 if the process isn't found.If $PID Then ProcessClose($PID) Edited March 31, 2012 by Guest Link to comment Share on other sites More sharing options...
autoitaddicted Posted March 31, 2012 Author Share Posted March 31, 2012 i just need to disable input (blockinput) for 5 seconds not more not less for a specific process. sometimes, that process can fail, so i can't use blockinput(0) in the end of that specific process. because of that i need a different solution. if i use that kind of code from another script: blockinput(1) sleep(5000) blockinput(0) this also blocks the main script too, while blockinput active main script functions are blocked too. Link to comment Share on other sites More sharing options...
autoitaddicted Posted March 31, 2012 Author Share Posted March 31, 2012 2nd script (will be run by no1)ProcessClose("1stscript.exe")sleep(5000)Local $PID = ProcessExists("1stscript.exe") ; Will return the PID or 0 if the process isn't found.If $PID Then ProcessClose($PID)Not sure how this is help. Sorry, i couldn't see any connection with blockinput. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 31, 2012 Moderators Share Posted March 31, 2012 autoitaddicted,I am having difficulty understanding your problem. If you use Run to execute your "mu.exe" file, the script continues once the app is launched - so I see no reason why a "process" "failing" would affect anything that happens later. What are you running that requires BlockInput and the failure of which blocks the rest of the script from running? As this short snippet shows, Run does not halt the script:ConsoleWrite("Input blocked at " & @SEC & @CRLF) Run("notepad.exe", "") ConsoleWrite("Continuing" & @CRLF) Sleep(5000) ConsoleWrite("Input unblocked at " & @SEC & @CRLF)You see the "Continuing" appear immediately after Notepad opens and the second ConsoleWrite appears 5 secs later. So if you want help - more details on what exactly is going on in your script please. M23  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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
autoitaddicted Posted March 31, 2012 Author Share Posted March 31, 2012 _GUICtrlToolbar_ClickButton($hToolbar, 41061) This part is not working if there is another active blockinput from another script file. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 31, 2012 Moderators Share Posted March 31, 2012 autoitaddicted,Obvious question: can you not combine the 2 scripts? No more problem then. If not, have you thought about using some form of interscript communication so the second script can tell the first to unblock? You could use something as simple as an ini file, or just search for "+inter +script +communication" - there are many examples out there. My personal favourite is trancex's MailSlot. M23  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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
lark Posted March 31, 2012 Share Posted March 31, 2012 You could try something with adlibRegister in the main program. BlockInput(1) Run("program") AdlibRegister("checkProcess", 100) Func checkProcess() Local $PID = ProcessExists("program") If $PID Then ProcessClose($PID) BlockInput(0) AdlibUnRegister("checkProcess") EndIf EndFunc so this just keeps checking to see if the second program is finished, and if it is, then it ends the blockInput. Link to comment Share on other sites More sharing options...
martin Posted March 31, 2012 Share Posted March 31, 2012 You could do this- Run this after you have compiled mu.exe #include <winapi.au3> $gg = GUICreate("funnytitle+[]765");no need to show this window, it'as just so you can receive a message $WM = _WinAPI_RegisterWindowMessage("anotherfunnytitle+[]765"); get our own message number GUIRegisterMsg($WM, "blocks") msgbox(262144,$gg, $wm) BlockInput(1) sleep(9000);delay to show that block(1) is working Run("mu.exe", "") while 1 sleep(90) wend func blocks($hW,$Msg,$lp) if $lp = 0 Then BlockInput(0) ;exit Else Blockinput(1) EndIf EndFunc Do something like this in mu.exe #include <winapi.au3> #include <sendmessage.au3> $WH = WinGetHandle("funnytitle+[]765") ;MsgBox(262144,"handle = ",$WH,3) $WM = _WinAPI_RegisterWindowMessage("anotherfunnytitle+[]765") ;MsgBox(262144,"$WM = ", $wm,3) if $WH <> 0 then _SendMessage($WH,$WM,0) But based on your first post the obvious way to do it is blockinput(1) sleep(5000) blockinput(0) run("mu.exe") I assume though that the code you showed is not really what you want to do which is why I showed another possibility. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
autoitaddicted Posted April 1, 2012 Author Share Posted April 1, 2012 You could try something with adlibRegister in the main program. BlockInput(1) Run("program") AdlibRegister("checkProcess", 100) Func checkProcess() Local $PID = ProcessExists("program") If $PID Then ProcessClose($PID) BlockInput(0) AdlibUnRegister("checkProcess") EndIf EndFunc so this just keeps checking to see if the second program is finished, and if it is, then it ends the blockInput. works like a charm THANK YOU SO MUCH Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now