Jump to content
ReAslan

Hel to program an AutoIt Script

Recommended Posts

ReAslan

Hello everyone I need urgent help .
Let me explain : I need a AutoIt script that automatically do three things :
1 ) If it detects that the program is closed open it .
2 ) If it detects that the program is open it does not do anything .
3 ) If it detects that the program is blocked closes and restarts .

The AutoIt script must be run in the background and automatically continue to do the three things described above .

I understand that I must act on tasklist which contains all the processes but are not expert in c++ language.

The script must be run on Windows 2000 .
Thanks in advance to all

Share this post


Link to post
Share on other sites
water

Stop posting the same "question" over and over again or your stay on this forum will be quite short.
Take a look at the forum rules and you will see what we expect from new users!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

ReAslan,

At last an AutoIt question - a bit better than your other 3 threads which I have now deleted. But still posted in the wrong section - I have moved it for you but I would ask you to be more careful in the future.  And a word to the wise, if you keep posting the same question again and again you might find reincarnation a little more difficult than did your namesake.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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
Starstar

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit
EndFunc   ;==>Terminate


While 1
if ProcessExists("progrm.exe") Then
Sleep(100)
Elseif not ProcessExists("progrm.exe") Then
ShellExecute(@DesktopDir&"\program.exe")
Else
Shutdown(2)
Endif
Wend

Try this one.......


Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites
Jos

 

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit
EndFunc   ;==>Terminate


While 1
   if ProcessExists("progrm.exe") Then
      Sleep(100)
   Elseif not ProcessExists("progrm.exe") Then
      ShellExecute(@DesktopDir&"\program.exe")
   Else
      Shutdown(2)
   Endif
Wend

 

Try this one.......

​Are you sure?

Why have the ElseIf test again the existence of a program?
Under what condition will you reach the Else condition?

Jos

 


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
SadBunny

What do you mean by 3, "the program is blocked"?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
argumentum

he can write a batch file. No need for a script. Do need to attend to the antivirus tho.

Share this post


Link to post
Share on other sites
argumentum

goto https://technet.microsoft.com/en-us/sysinternals/bb896682.aspx , get that and run this batch file:

@echo off
:start
pslist notepad
if errorlevel 0 if not errorlevel 1 goto IsRunning
if errorlevel 1 if not errorlevel 2 start /b notepad.exe

:exit
echo was not running, now is, keep checking in 4 sec.
ping 12.0.0.1 -w 1000 > nul
goto start
pause
exit

:IsRunning
echo yes, is running, keep checking in 4 sec.
ping 12.0.0.1 -w 1000 > nul
goto start
pause
exit

:end

tested in win 2000

Share this post


Link to post
Share on other sites
ReAslan
 

Hello everyone , Thanks for giving me the question moved in the right section and thank you for the answers .

argumentum tried the .bat file and I do not recognize the command " pslist " But I understood the meaning . However I can not correct the error of command pslist not recognized .

With locked program , I mean that the process is in the " not responding" and then it goes off and on again , or restart.

 

Is the operating system is Windows 2000 and would be nice to be a script is a .bat file c ++ / c

Edited by Jos
removed codebox around text to make it readable.

Share this post


Link to post
Share on other sites
SadBunny

PsList is part of the SysInternals tool suite. See https://technet.microsoft.com/en-us/sysinternals/bb896682.aspx

About the C/C++ you mentioned twice... You do realize you're on a forum for another language?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
argumentum

Andrea, I understand that at time one is in a desperate situation, but you are not very straight forward. A private message without new information does not aid your search nor gives you a more personalized attention. To test on a Win 2000 and give you something tested is really personalized. Unless you provide more information, I believe no one can give you better aid.

If you are not a "coder", then say it. You may then be properly directed. Maybe.

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

×