Jump to content



Photo

Looking for a function


  • Please log in to reply
3 replies to this topic

#1 ondrajka

ondrajka

    Seeker

  • Active Members
  • 17 posts

Posted 01 June 2009 - 01:06 PM

I've tried help and the forums but don't quite know what I'm looking for so it's hard to search.

Looking for something similar to If ProcessExists ("whatever.exe") Then $a=1

Only for a script i.e. If ScriptExists ("scriptname.au3") Then $a=1

I can't use ProcessExists because all au3 have the same process name.





#2 Jos

Jos

    oh joy ...

  • Developers
  • 21,049 posts

Posted 01 June 2009 - 01:13 PM

Not sure why different scripts have the same EXE name but you could use a unique name with _Singleton() in each script you run and then test for that sOccurenceName in your script.

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#3 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 01 June 2009 - 01:21 PM

You should compile your scripts to exe :)
*GERMAN* Posted Image [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

#4 rajeshontheweb

rajeshontheweb

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 382 posts

Posted 01 June 2009 - 02:07 PM

check this out!

AutoIt         
#include <process.au3> #include <_WinAPI_GetCommandLine.au3> ; got this from this forum here... #region example ConsoleWrite(_IsScriptRunning(@ScriptName)) #endregion Func _IsScriptRunning($ScriptName)     Local $retVal = -1     $AutoITProcesses = _GetAutoitScripts()         If $AutoITProcesses[0][0] > 0 Then         For $i = 0 to $AutoITProcesses[0][0]             If StringInStr($AutoITProcesses[$i][1],$ScriptName) Then $retVal = 1             Next     Else         $retVal = 2         SetExtended("Autoit Process Not Found Running?")     EndIf             Return $retVal EndFunc Func _GetAutoitScripts()     ; Script Name only not full path please. Local $AutoItEXE = _ProcessGetName(@AutoItPID) Local $ProcessList = ProcessList() Local $procAutoIT[1][3] For $i = 0 to $ProcessList[0][0]     If $ProcessList[$i][0] = $AutoItEXE Then         ReDim $procAutoIT[Ubound($procAutoIT)+1][3]             $procAutoIT[Ubound($procAutoIT)-1][0] = $ProcessList[$i][1]             $procAutoIT[Ubound($procAutoIT)-1][1] = _WinAPI_GetCommandLineFromPID($ProcessList[$i][1]) ;~          $procAutoIT[$i][2] =         EndIf     Next     $procAutoIT[0][0] = UBound($procAutoIT)-1     Return $procAutoIT EndFunc

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users