Ask Your Question
0

open and close programs from macro

asked 2017-09-10 19:22:57 +0200

Neil-B gravatar image

updated 2017-09-10 20:35:14 +0200

Hi All,

I am writing a macro attached to a spread sheet, the basic function is that I enter information relating to a document I need to scan, it looks in the default folder for the scanner say /home/scan/ when it sees a file it renames this based on the information supplied in the form, All good so far.

What I want is for the macro to open simple-scan when it runs, I have done this with the line below

Shell("/usr/bin/simple-scan",0)

My problem is closing simple-scan from the macro

I have tryed this below

shell("kill simple-scan")

shell("kill /usr/bin/simple-scan")

which to be fare doesn't work in terminal either it gives this

bash: kill: simple-scan: arguments must be process or job IDs

next I tried

kill_simple = shell("pgrep simple-scan")

to get the prosses number with the hope of using something like this

kill_simple = shell("pgrep simple-scan")

shell("kill + kill_simple")

but kill_simple always comes up with a value of Zero

Any Ideas anyone

Regards Neil

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-09-10 19:49:14 +0200

librebel gravatar image

Hello @Neil-B,

you could try "pidof simple-scan" to get the process ID of the running simple-scan process,

HTH, lib

edit flag offensive delete link more

Comments

Hi Thanks for your quick answer, I tried 'pid = shell("pifof simple_scan") but pid has a value of zero. pidof simple_scan in terminal gives me say "1234" for instance, now if I try 'shell("kill 1234")' that works, somthing in the middle not working I had thought about writing a bash script to do the job but I would sooner get this working if I can

Neil

Neil-B gravatar imageNeil-B ( 2017-09-10 21:24:23 +0200 )edit

please try with pkill: Shell( "pkill simple-scan" )

librebel gravatar imagelibrebel ( 2017-09-10 21:54:08 +0200 )edit

Hello again, Yes that worked very well, with me trying this over and over I had about 15 simple_scans running at once and they all shut down for me. thank you very much for your help

Neil

Neil-B gravatar imageNeil-B ( 2017-09-10 22:56:03 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-09-10 19:22:57 +0200

Seen: 132 times

Last updated: Sep 10 '17