Controlling another application

Hi Everyone

If I wanted to implement a helper app for another program that would make hidden menu items available easily, is that possible? I know you can do it with applescript and xcode IE you trigger an applescript with a button that for instance tells microsoft word to save. Is there a better way with xojo ?

Thanks

Hi Damon

Look at putting this code into your originating app somewhere

Dim f As FolderItem
Dim sPassed As String
f = GetFolderItem("MyApp2.exe") //need proper location of built app
sPassed = " /"+ TextArea1.text  // or something like sPassed=" /Switch1" 
// the " /" is just the separator as system.command returns full path of MyApp2 which you need to strip out
F.launch sPassed

In MyApp2 you’d need the lines (as an example - passing text from a textarea in originating app to TextArea1 in MyApp2)


  Dim I As Integer
  Dim s,s1 As String
  s="/"
  #if not DebugBuild then 
    if InStr(System.CommandLine,s)<>0  then
      i= InStr(System.CommandLine,s)
      S1=Mid(System.CommandLine,i+1,Len(System.CommandLine)-I+1)
      TextArea1.text=s1
    Else
      msgbox "Invalid Parameters Passed"
      quit
    end if
  #endif
  Window1.show

I’m sure the gurus can do better than this but it works for what I use it for.

Firstly… thanks for taking the time, and i’m going to play with that as it looks very interesting. It looks like that a setup for two self built apps however is it ?

I was wondering if this is possible with another commercial app . So id like to trigger buried key commands / keyboard shortcuts in another app (say logic or protools audio apps) from one i build in xojo. You can do it with xcode and applescript pretty easily but its a bit lumpy, and generally im finding xojo easier to get my head round. I wonder if you can say for instance trigger an applescript easily in xojo ? Ive looked in docs and forums but came up blank.

I only use windows I’m afraid. But with the ExportToExcel or ExportToWord OLE commands sending information from your app to excel and word is relatively straight forward. For instance in my app I create of a lot of bar/line/pie charts and well and customer product usage population maps. Sometimes I wish to pass the information to excel for “polishing up” or write report in Word as that is an industry standard. So controlling those is ok ish. I suppose if you know the command line structure of your receiving app then controlling it as above would (in theory) work ok. Hope it helps

PS yes you’re right that code is for two self built apps but the principle should (in theory) be ok…it’s going to depend on your receiving app

Mmm… yep. I guess the app would need to be set up for it which I think is a no goer. Maybe I should have just asked if its possib;e to run applescripts as I know I can get that to work. Cheers NG P