externes Programm versteckt oder minimiert starten

MAC OSX spezifisches Forum
Beiträge, die plattformübergreifend sind, gehören ins 'Allgemein'-Forum.
IB-Software
Beiträge: 57
Registriert: 29.08.2004 11:05
Computerausstattung: Windows 11
Wohnort: Berlin
Kontaktdaten:

externes Programm versteckt oder minimiert starten

Beitrag von IB-Software »

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

Jemand eine Idee? - Danke im Voraus. :)
PureBasic 5.73/6.04 Beta 2; Windows 11 Pro 64
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 GHz 16GB; NVIDIA GeForce RTX 3060 16GB
ccode_new
Beiträge: 1214
Registriert: 27.11.2016 18:13
Wohnort: Erzgebirge

Re: externes Programm versteckt oder minimiert starten

Beitrag von ccode_new »

Hallo IB-Software!

Hier einmal ein paar Beispiele:
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: Alles auswählen

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

Code: Alles auswählen

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.
Betriebssysteme: div. Windows, Linux, Unix - Systeme

no Keyboard, press any key
no mouse, you need a cat
IB-Software
Beiträge: 57
Registriert: 29.08.2004 11:05
Computerausstattung: Windows 11
Wohnort: Berlin
Kontaktdaten:

Re: externes Programm versteckt oder minimiert starten

Beitrag von IB-Software »

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

Ingo
PureBasic 5.73/6.04 Beta 2; Windows 11 Pro 64
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 GHz 16GB; NVIDIA GeForce RTX 3060 16GB
ccode_new
Beiträge: 1214
Registriert: 27.11.2016 18:13
Wohnort: Erzgebirge

Re: externes Programm versteckt oder minimiert starten

Beitrag von ccode_new »

Das hier könnte dich auch weiterbringen:

Code: Alles auswählen

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 !
Betriebssysteme: div. Windows, Linux, Unix - Systeme

no Keyboard, press any key
no mouse, you need a cat
Antworten