PureBoard
http://forums.purebasic.com/german/

externes Programm versteckt oder minimiert starten
http://forums.purebasic.com/german/viewtopic.php?f=28&t=31718
Seite 1 von 1

Autor:  IB-Software [ 08.11.2019 10:50 ]
Betreff des Beitrags:  externes Programm versteckt oder minimiert starten

Ich will ein externes Programm versteckt oder minimiert starten:
Mit:
Zitat:
RunProgram ("open", Chr(34) + "/System/Applications/App Store.app" + Chr(34),"", #PB_Program_Hide)

funktioniert das leider nicht.

Jemand eine Idee? - Danke im Voraus. :)

Autor:  ccode_new [ 08.11.2019 13:47 ]
Betreff des Beitrags:  Re: externes Programm versteckt oder minimiert starten

Hallo IB-Software!

Hier einmal ein paar Beispiele:

Zitat:
Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-s <partial SDK name>][-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
Help: Open opens files from a shell.
By default, opens each file using the default application for that file.
If the file is in the form of a URL, the file will be opened as a URL.
Options:
-a Opens with the specified application.
-b Opens with the specified application bundle identifier.
-e Opens with TextEdit.
-t Opens with default text editor.
-f Reads input from standard input and opens with TextEdit.
-F --fresh Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
-R, --reveal Selects in the Finder instead of opening.
-W, --wait-apps Blocks until the used applications are closed (even if they were already running).
--args All remaining arguments are passed in argv to the application's main() function instead of opened.
-n, --new Open a new instance of the application even if one is already running.
-j, --hide Launches the app hidden.
-g, --background Does not bring the application to the foreground.
-h, --header Searches header file locations for headers matching the given filenames, and opens them.
-s For -h, the SDK to use; if supplied, only SDKs whose names contain the argument value are searched.
Otherwise the highest versioned SDK in each platform is used.


Code:
RunProgram("open", ~"-a \"App Store\"","")


Code:
Procedure.s AppleScript(Script.s)
  Protected retVal.s, strVal, numItems, i
  Protected aScript = CocoaMessage(0, CocoaMessage(0, CocoaMessage(0, 0, "NSAppleScript alloc"), "initWithSource:$", @Script), "autorelease")
  Protected eventDesc = CocoaMessage(0, aScript, "executeAndReturnError:", #nil)
  If eventDesc
    numItems = CocoaMessage(0, eventDesc, "numberOfItems")
    If numItems
      For i = 1 To numItems
        strVal = CocoaMessage(0, CocoaMessage(0, eventDesc, "descriptorAtIndex:", i), "stringValue")
        If strVal
          retVal + PeekS(CocoaMessage(0, strVal, "UTF8String"), -1, #PB_UTF8)
          If i <> numItems : retVal + #LF$ : EndIf
        EndIf
      Next
    Else
      strVal = CocoaMessage(0, eventDesc, "stringValue")
      If strVal : retVal = PeekS(CocoaMessage(0, strVal, "UTF8String"), -1, #PB_UTF8) : EndIf
    EndIf
  EndIf
  ProcedureReturn retVal
EndProcedure

AppleScript(~"activate application \"App Store\"")


Anbei:
alt + n + (irgendeine Taste) = ~
shift + alt + 7 = \

-> Wichtig! : Dieses Zeichen: " (Anführungszeichen) ist wichtig bei Namen mit einem Leerzeichen.

Autor:  IB-Software [ 08.11.2019 18:08 ]
Betreff des Beitrags:  Re: externes Programm versteckt oder minimiert starten

Vielen Dank. Das war es, was ich gesucht hatte.

Ingo

Autor:  ccode_new [ 08.11.2019 18:28 ]
Betreff des Beitrags:  Re: externes Programm versteckt oder minimiert starten

Das hier könnte dich auch weiterbringen:

Code:
Procedure.s AppleScript(Script.s)
  Protected retVal.s, strVal, numItems, i
  Protected aScript = CocoaMessage(0, CocoaMessage(0, CocoaMessage(0, 0, "NSAppleScript alloc"), "initWithSource:$", @Script), "autorelease")
  Protected eventDesc = CocoaMessage(0, aScript, "executeAndReturnError:", #nil)
  If eventDesc
    numItems = CocoaMessage(0, eventDesc, "numberOfItems")
    If numItems
      For i = 1 To numItems
        strVal = CocoaMessage(0, CocoaMessage(0, eventDesc, "descriptorAtIndex:", i), "stringValue")
        If strVal
          retVal + PeekS(CocoaMessage(0, strVal, "UTF8String"), -1, #PB_UTF8)
          If i <> numItems : retVal + #LF$ : EndIf
        EndIf
      Next
    Else
      strVal = CocoaMessage(0, eventDesc, "stringValue")
      If strVal : retVal = PeekS(CocoaMessage(0, strVal, "UTF8String"), -1, #PB_UTF8) : EndIf
    EndIf
  EndIf
  ProcedureReturn retVal
EndProcedure

AppleScript(~"tell application \"System Events\" to tell process \"App Store\" to set visible to false")


-> Das Ganze benötigt erweiterte Rechte !

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/