Wednesday, December 8, 2021

#1 2021-11-23 10:14:08 am

slashdot
Member
Registered: 2003-11-13
Posts: 306

finder - check if processing is running (not finding process)

on is_running(appName)
    tell application "System Events" to (name of processes) contains appName
end is_running

set safRunning to is_running("Safari")

set safRunning to is_running("JDownloader2")



This is working for Safari but not Jdownloader2. 


Question
Is there a way to find out what the actual process name might be??
-- I've tried activity monitor to see and the item there still doesn't work.

Last edited by slashdot (2021-11-23 10:20:47 am)

Offline

 

#2 2021-11-23 02:17:47 pm

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 1147

Re: finder - check if processing is running (not finding process)

slashdot wrote:

Question
Is there a way to find out what the actual process name might be??
-- I've tried activity monitor to see and the item there still doesn't work.



With JDownloader2 running, I would run the following script in Script Editor and look at the result.

Applescript:

use framework "Foundation"
tell application "System Events" to set openApps to name of every process
set theArray to current application's NSArray's arrayWithArray:openApps
set theArray to theArray's sortedArrayUsingSelector:"localizedStandardCompare:"
set theString to theArray's componentsJoinedByString:linefeed
theString as text

Last edited by peavine (2021-11-23 06:13:12 pm)


2018 Mac mini - macOS Monterey - Script Debugger 8

Online

 

#3 2021-11-24 04:24:44 pm

slashdot
Member
Registered: 2003-11-13
Posts: 306

Re: finder - check if processing is running (not finding process)

@peavine - unfortunately, I don't see any jdownloader listed there with the code provided.

Offline

 

#4 2021-11-24 04:28:01 pm

slashdot
Member
Registered: 2003-11-13
Posts: 306

Re: finder - check if processing is running (not finding process)

KniazidisR wrote:



To do this, just write a do shell script with your utility (and save this minimal script as an application with the same name). After that, all you need to do is check the running property of this application.



So wouldn't the utility time out and it would require to run two apps instead of just find it the original app is running?

Offline

 

#5 2021-11-25 01:35:41 am

technomorph
Member
Registered: 2017-12-14
Posts: 219

Re: finder - check if processing is running (not finding process)

Use NSWorkspace’s sharedWorkspace()’s runningApplications

https://developer.apple.com/documentati … guage=objc

Offline

 

#6 2021-11-25 04:25:50 am

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2182

Re: finder - check if processing is running (not finding process)

slashdot wrote:

So wouldn't the utility time out and it would require to run two apps instead of just find it the original app is running?


Ignore my previous post as it was wrong. I suggest you a completely different approach now.

1) Create a subfolder "JDownloader2downloads" in your Downloads folder.

2) In the "Add New Links" window of the application for the location of the destination folder, specify the Posix path to this subfolder. As I checked, the application remembers this change.

3) Now, to check the download state, you just need to check the busy status of every file of this folder.

Last edited by KniazidisR (2021-11-25 09:00:05 am)


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

#7 2021-12-02 10:38:12 am

slashdot
Member
Registered: 2003-11-13
Posts: 306

Re: finder - check if processing is running (not finding process)

KniazidisR wrote:
slashdot wrote:

So wouldn't the utility time out and it would require to run two apps instead of just find it the original app is running?


Ignore my previous post as it was wrong. I suggest you a completely different approach now.

1) Create a subfolder "JDownloader2downloads" in your Downloads folder.

2) In the "Add New Links" window of the application for the location of the destination folder, specify the Posix path to this subfolder. As I checked, the application remembers this change.

3) Now, to check the download state, you just need to check the busy status of every file of this folder.



Unfortunately, this is trying to find out download state.  I'm trying to find out only if the application is running or not.  Since I'm trying to setup the corresponding state where I can  execute additional commands if the app isn't running or is running.

Offline

 

#8 2021-12-02 10:44:21 am

slashdot
Member
Registered: 2003-11-13
Posts: 306

Re: finder - check if processing is running (not finding process)

on is_running(appName)
    tell application "System Events" to (name of processes) contains appName
end is_running

set safRunning to is_running("JavaApplicationStub")



Not exactly the desired accuracy I desire but works.

Does anyone have a better solution?

Offline

 

#9 2021-12-02 10:59:53 am

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2182

Re: finder - check if processing is running (not finding process)

I thought you needed to check the download state. With checking the running state of applications, everything is much easier.

Applescript:


running of application id "org.jdownloader.launcher"

Last edited by KniazidisR (2021-12-02 11:00:22 am)


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)