| 688 | self.name = val |
| 689 | |
| 690 | def open(self, url, new=0, autoraise=True): |
| 691 | sys.audit("webbrowser.open", url) |
| 692 | if self.name == 'default': |
| 693 | script = 'open location "%s"' % url.replace('"', '%22') # opens in default browser |
| 694 | else: |
| 695 | script = f''' |
| 696 | tell application "%s" |
| 697 | activate |
| 698 | open location "%s" |
| 699 | end |
| 700 | '''%(self.name, url.replace('"', '%22')) |
| 701 | |
| 702 | osapipe = os.popen("osascript", "w") |
| 703 | if osapipe is None: |
| 704 | return False |
| 705 | |
| 706 | osapipe.write(script) |
| 707 | rc = osapipe.close() |
| 708 | return not rc |
| 709 | |
| 710 | |
| 711 | def main(): |