Objectinfo "procedures" Not Working

Hello Everybody,

Jim, when you sent me your file, I was so sure it worked that I didn’t even try it. I copied and pasted the code into my working file (PanX Test Pilot), made some cosmetic changes to field names, added a new form with Start button, and ran it. When it all worked, except for the procedure text, I thought that the original problem still existed.

However, I did it all again, taking extra care this time. And now it’s working fine. Apparently, my original cosmetic changes cut into bone and sinew. But, “All’s Well That Ends Well”.

Many thanks to all who contributed to this thread. Jim, your snippet of code is brilliant. I had never even heard of a looparray.

Vic

A slight clariication on the objectinfo( function. I stated earlier that a form window (any form window) must be the frontmost when using this function. But I didn’t mention that this form window must not only be the frontmost Panorama window, it must be the frontmost window in any application. So if you have a scanning code using objectinfo( that takes a while to run, you cannot bring another application forward while that procedure is running. If you do, the objectinfo( function will fail. It doesn’t generate an error or stop the program, but it will not return the information extracted from the objects.

Jim, thanks for this great snippet.

I added this to the “Code” block of the “Scan” button … lets me select whatever database I’d like to scan.
(Just be sure NOT to select the database that contains the “Scan” button … :wink: An exercise for the reader would be to remove (or gray out) the current database’s popup menu item. :slightly_smiling_face: )

local fileChoice
PopupClick "Cancel"+¶+"(-"+¶+Info("Files"),Array(Info("Files"),1,¶),fileChoice

If "Cancel" = fileChoice Or "" = fileChoice
	Return
Endif

let scanBase = fileChoice // "Untitled" // substitute the name of the open database you want to scan

[... jim's original code follows ...]

Enjoy.

– Mark

I don’t think anything terrible would happen if you did select that database – it wouldn’t be like Inception or anything.

Here is what I came up with:

let fileMenu=""
arrayfilter info("files"),fileMenu,cr(),?(import()=info(“databasename”),"",import())
fileMenu=arraystrip(fileMenu,cr())
fileMenu=menu("Files")+
    menuitem("Cancel")+
    menuseparator()+
    menuitem(info("databasename"),"ENABLED",false())+
    arraymenuitems(fileMenu)
let fileChoice=""
popupclick fileMenu,"",fileChoice
message fileChoice

You can move the disabled file name above or below the other file names as wanted.

I refined the above code to include highlighting the first file in the list that is not the current database. I also used arraydeletevalue( instead of the original arrayfilter and arraystrip to remove the current database name from the fileMenu list.:

let fileMenu=""
fileMenu=arraydeletevalue(info("files"), info(“databasename”), cr())
fileMenu=menu("Files")+
    menuitem("Cancel")+
    menuseparator()+
    menuitem(info("databasename"),"ENABLED",false())+
    arraymenuitems(fileMenu)
let fileChoice=""
popupclick fileMenu,arrayfirst(arraydeletevalue(info("files"),
    info(“databasename”),cr()),cr()),fileChoice
message fileChoice
1 Like

Nice, Gary! Thanks! :slight_smile: