Jump to content

Hel to program an AutoIt Script


Recommended Posts

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

Link to comment
Share on other sites

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 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

 

Link to comment
Share on other sites

  • Moderators

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

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 comment
Share on other sites

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."

Link to comment
Share on other sites

  • Developers

 

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

 

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.
  :)

Link to comment
Share on other sites

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

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

 

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.
Link to comment
Share on other sites

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.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
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
 Share

×
×
  • Create New...