Jump to content

Run commandline parameters on a script that is already running


Chris86
 Share

Recommended Posts

Can you please give us some more details about what you want to achive?

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

no, it's not possible.

what you are talking about is called IPC (Inter Process Communication). google it or search the forum, there are plenty of means to implement IPC depending on your specific scenario.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

I have a script that needs to be controlled with only two commandline parameters that is ran by a IP-phone software.

So i have to be able to control this script with two commandline parameters; the first command gives the script a phone number and the second tells the script that the phone call was hung up. And im going to have some other functions in this script that is controlled by traymenu.

Is this possible to have in one script or do i need to have two?

Link to comment
Share on other sites

Can you post the script so we can see what you already have coded.

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

To add to what water said, what application are you using?

One option would be to close the running process and open again by passing the commandline parameters or search for WM_COPYDATA, if the application you're using can interact with this message. No idea!

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

considering the missing information, yap, that's IPC allright.

if both scripts are at your control, it's easy. but if one is an external program, you need 2 scripts:

program calls script A telling it to start monitoring the call

script A monitors the call, and also monitors an IPC channel (and also monitors the GUI for tray menu activity, as you say)

---

program calls script B telling it the call has ended

script B sends script A a message via IPC, that the call has ended

the IPC channel, in this case, can be as simple as a flag file: script B creates a file by a specific name, and script A looping a FileExists() check on that file, and if that file exists, then script A does what it needs to do when the call has ended.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Chris86,

from the replies you got so far you can see that we need more information to help you.

Tell us the application you try to automate, post the script you've coded so far etc. etc.

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

considering the missing information, yap, that's IPC allright.

if both scripts are at your control, it's easy. but if one is an external program, you need 2 scripts:

program calls script A telling it to start monitoring the call

script A monitors the call, and also monitors an IPC channel (and also monitors the GUI for tray menu activity, as you say)

---

program calls script B telling it the call has ended

script B sends script A a message via IPC, that the call has ended

the IPC channel, in this case, can be as simple as a flag file: script B creates a file by a specific name, and script A looping a FileExists() check on that file, and if that file exists, then script A does what it needs to do when the call has ended.

Since i cannot do what i planed i will try this thanks :)

Link to comment
Share on other sites

What i do is check if the script is already running and in that case write the parameters into a ini file and then exit.

In the main idle loop of my script i keep checking the ini for new input and execute it if anything is found.

Same effect diffrent execution :-)

hope this helps

Link to comment
Share on other sites

i was bored.

script A:

#include <Misc.au3>

Global Const $sFlagFile=@TempDir&'\FlagFile.txt'    ; this is identical in both scripts

If _Singleton('Script_A',1)=0 Then
    MsgBox(0,'Script_A','Hey! Can''t you see I''m busy?  ',5)
    Exit
EndIf

While True
    ; check for flag
    If FileExists($sFlagFile) Then
        MsgBox(0,'Script_A','ok, ok, I''m stopping...  ',5)
        FileDelete($sFlagFile)
        Exit
    EndIf

    ; chek user activity in tray menu
    ; ** add your code here

    ; do real stuff
    ; ** add your code here

WEnd

script B:

Global Const $sFlagFile=@TempDir&'\FlagFile.txt'    ; this is identical in both scripts

If ProcessExists('Script_A.exe') Then
    If FileExists($sFlagFile) Then
        MsgBox(0,'Script_B','Hey, I already asked Script A to stop. There must be something wronf with it.  ',5)
    Else
        MsgBox(0,'Script_B','I will stop Script_A now.  ',5)
        FileWriteLine($sFlagFile,'if this file exists, it means Script_B is trying to stop Script_A.  ')
    EndIf
Else
    MsgBox(0,'Script_B','Hey, I you need to start Script_A before I can stop it.  ',5)
    Exit
EndIf

compile both scripts to exe. now you behave like your IP phone application: call script A to start, then call script B to stop script A.

bonus: see what happens if you call script A twice, or if you call script B when script A is not running.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

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