nacerbaaziz Posted July 24, 2017 Posted July 24, 2017 Hello How are you I have a question, please. I've created a window and i need when i run the script if it detect an other copy from the same script was runing the script close the first copy Automatically and run a new copy I want an example to understand it
Danp2 Posted July 24, 2017 Posted July 24, 2017 Look up _Singleton in the help file. Also, search the forum and you will likely find other suggested solutions. Latest Webdriver UDF Release Webdriver Wiki FAQs
nacerbaaziz Posted July 24, 2017 Author Posted July 24, 2017 i find _Singleton but i don't know how to close the first copy if exist please help me
Danp2 Posted July 24, 2017 Posted July 24, 2017 Look at ProcessList. Compare the PID to @AutoItPID and then use ProcessClose to close any other instances. Again, I'm sure you could find some full working examples if you put some effort into searching the forums. Latest Webdriver UDF Release Webdriver Wiki FAQs
nacerbaaziz Posted July 25, 2017 Author Posted July 25, 2017 so i've created a audio player and i need when the users open a audio file if the software find an other audio file was playing it will close the old and i don't know how to do that Please help me if there is any way to do this.
water Posted July 25, 2017 Posted July 25, 2017 Danp2 exactly described what to do. What have you tried so far? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
nacerbaaziz Posted July 25, 2017 Author Posted July 25, 2017 (edited) am sorry for this repitation Edited July 25, 2017 by nacerbaaziz
nacerbaaziz Posted July 25, 2017 Author Posted July 25, 2017 In fact, all my attempts were unsuccessful I apologize for bothering you all this time because of my poor understanding of this. If there is no inconvenience I want a simple example to explain to me I would be thankful to all of you Greetings to you, right you are a good peoples
Danp2 Posted July 25, 2017 Posted July 25, 2017 8 minutes ago, nacerbaaziz said: In fact, all my attempts were unsuccessful Show us what you tried in your failed attempts. Post your code. Latest Webdriver UDF Release Webdriver Wiki FAQs
Danp2 Posted July 25, 2017 Posted July 25, 2017 (edited) Here's some examples that you would have found if you tried searching the forums -- Edited July 25, 2017 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs
nacerbaaziz Posted July 25, 2017 Author Posted July 25, 2017 56 minutes ago, Danp2 said: Here's some examples that you would have found if you tried searching the forums -- where is it? thank you
Developers Jos Posted July 25, 2017 Developers Posted July 25, 2017 1 minute ago, nacerbaaziz said: where is it? Where is what? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
nacerbaaziz Posted July 25, 2017 Author Posted July 25, 2017 Hello I apologize very much for bothering you all But it's very important to me I will now try to explain in detail what I want to do and please help me with this 1. I designed an audio player called easy audio player The executable file name is easyAudioPlayer.exe Its task is to play audio files I have made this player the default in opening my audio files. 2 What I want is if you press an audio file if the program finds another file that is open in the same program, it will closes it and opens the file that was pressed This is exactly what I want please help By typing a simple example, Greetings to all of you and I repeat my apologies I apologize for my weak English
Danp2 Posted July 25, 2017 Posted July 25, 2017 You should stop apologizing about your English and instead apologize for your lack of effort in solving the issue for yourself. You've been given pointers on how to do it. Now how about you show some code showing where you've actually tried to solve it yourself instead of repeatedly asking for someone else to write the code for you. nacerbaaziz 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
nacerbaaziz Posted July 25, 2017 Author Posted July 25, 2017 (edited) I tried writing this function but it did not work Please correct the error if any Greetings Thank you very much Func check($exefile = @ScriptName, $HWND = $hGUI) Local $process = $exefile, $window = $HWND, $return Local $iPID = WinGetProcess($window) If @error Then Return -1 Local $aProcessList = ProcessList($process) If @error Then Return -1 For $i = 1 To $aProcessList[0][0] If Not $aProcessList[$i][1] = $iPID Then ProcessClose($aProcessList[$i][1]) EndIf Next Return 1 EndFunc ;==>check Edited July 25, 2017 by Jos
Developers Jos Posted July 25, 2017 Developers Posted July 25, 2017 Something like this? Func check($exefile) Local $OwnPID = @AutoItPID Local $aProcessList = ProcessList($exefile) If @error Then Return -1 For $i = 1 To $aProcessList[0][0] If Not $aProcessList[$i][1] = $OwnPID Then ProcessClose($aProcessList[$i][1]) EndIf Next Return 1 EndFunc ;==>check Jos Xandy 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
nacerbaaziz Posted July 25, 2017 Author Posted July 25, 2017 IS THE @AutoItPID WORK IF THE SCRIPT IS COMPILED?
Developers Jos Posted July 25, 2017 Developers Posted July 25, 2017 (edited) Have you tried? ps: Your capslock is switched on. Jos Edited July 25, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
nacerbaaziz Posted July 25, 2017 Author Posted July 25, 2017 Unfortunately my dear i tried it and did not work When I opened an audio file I worked plain when i opened the other file did not close the first and remained listening to the two file
Developers Jos Posted July 25, 2017 Developers Posted July 25, 2017 Show the whole script so we can compile and test it. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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