Posted: 11th Jun 2021 8:25
ok this was driving me crazy. i tried it with and without the quotes but i tested it with Open With and Send To (preference. saves a step).

using Open With and the CL contains Quotes. Send To does not. So, it was failing 1/2 the time and i couldn't see why. (If i would have paid attention, i would have noticed that the errors were different.. "couldn't find" vs "couldn't load").

meanwhile, this accounts for either one:
+ Code Snippet
#import_plugin FileExplore

F$ = FileExplore.GetCL()
F$ = GetStringToken(F$, "|", CountStringTokens(F$,"|") )
MSG$ = "Untrimmed"
If LEFT(F$,1) = CHR(34)
	F$= Trim(F$)
	MSG$ = "Trimmed"
EndIf

SetErrorMode(2)

SetWindowTitle( "ImgView" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 0 ) 

SetVirtualResolution( 1024, 768 ) 
SetOrientationAllowed( 1, 1, 1, 1 ) 
SetSyncRate( 30, 0 ) 
SetScissor( 0,0,0,0 ) 
UseNewDefaultFonts( 1 ) 

If LOWER(RIGHT(F$,3)) = "png" or LOWER(RIGHT(F$,3)) = "jpg"
	Fit(LoadSprite("raw:"+F$))
Else
	Message("Invalid Image")
	End
Endif
		
do
	Print(MSG$)
	Print(F$)
    If GetRawKeyState(27) then End
    Sync()
loop

Function Trim(This$)
	R$ = MID(This$,2,LEN(This$)-2)
EndFunction R$

Function Fit(Spr)
	SetSpriteSize(Spr,1024,-1)
	If GetSpriteHeight(Spr) > 768 then SetSpriteSize(Spr,-1,768)
	SetSpritePositionByOffset(Spr,512,388)
EndFunction 

what it doesn't do is account for more than 1 image at a time which i'll save for another day...

thanks, all!
Posted: 11th Jun 2021 20:05
I built a plugin to handle this for one of my many editors, it handles cmd, open with, drop on exe and drop on window both with multiple file support.

this small example will load images from CL or DnD
+ Code Snippet
#Import_Plugin CL as cl

SetErrorMode(2)
SetWindowTitle( "CL - Example" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 )
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 )
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 )



Function LoadSpriteFromImage(image as string, x, y)

	if GetFileExists(image)
		img = LoadImage(image)
		spr=CreateSprite(img)
		SetSpritePosition(spr, x, y)
	endif
	
EndFunction

// Enable file drop on the window
cl.SetDrop("CL - Example", 1)

// Command Line
if cl.Count()>0
	for i=0 to cl.Count()-1
		LoadSpriteFromImage( "raw:"+cl.Get(i), 10*i, 10*i)
    next
endif
	
do
	mouse_x = GetRawMouseX()
	mouse_y = GetRawMouseY()
	
	// File Drop
	if cl.DropCount()>0
		for i=0 to cl.DropCount()-1
			LoadSpriteFromImage( "raw:"+cl.DropGet(i) , mouse_x, mouse_y)
		next
		cl.DropClear() // important, clear the list or this will repeat
	endif
	
    Sync()
loop
Posted: 26th Jul 2021 23:22
Awesome. CL works. Thanks heaps