Forum

Author Topic: Run script from batch file  (Read 2740 times)

magic

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Run script from batch file
« on: July 30, 2018, 01:51:44 PM »
Hi all ,
How we can run a script from bat file ? I've tried few combination and nothing works , my photoscan start my project is charged, but there is no action after, script does not want run how can I charge it ??
Code: [Select]
cd "c:\Program Files\Agisoft\PhotoScan Pro"
photoscan F:\TEST_PHOTOSCAN\toto2.psx
photoscan F:\piotrwork\ps_network\network_combine_test.py
What I have to add over here to start my script ???
« Last Edit: July 30, 2018, 04:25:18 PM by magic »

Paulo

  • Hero Member
  • *****
  • Posts: 1303
    • View Profile
Re: Run script from batch file
« Reply #1 on: July 30, 2018, 08:13:21 PM »
magic,

I think the correct syntax would be:

cd "c:\Program Files\Agisoft\PhotoScan Pro"
photoscan F:\TEST_PHOTOSCAN\toto2.psx -r F:\piotrwork\ps_network\network_combine_test.py

Best Regards,
Paul Pelletier,
Surveyor

magic

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Run script from batch file
« Reply #2 on: July 31, 2018, 10:05:55 AM »
I've tried this combination and does not work,
Photoscan is on, my project is charged but script still not run
Have no idea how to run it I've tried whole day yesterday ...

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Run script from batch file
« Reply #3 on: July 31, 2018, 03:52:00 PM »
Hello magic,

If you want to pass the path to the project as an argument to the script, like:
Code: [Select]
photoscan.exe -r script.py "D:/project.psx"Then a good option might be accessing the arguments in the script itself:


Code: [Select]
import sys
path = sys.argv[1]
doc = PhotoScan.Document()
doc.open(path)
Best regards,
Alexey Pasumansky,
Agisoft LLC

magic

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Run script from batch file
« Reply #4 on: August 01, 2018, 05:19:07 PM »
I've added as You said and works well
Thank You Alexey