ScriptSpot home

Forum topic · General Scripting

Maxscript dotnet

By john · 2015-03-30

Description

Hi Guys,

I'm working on a script which uses a dotnet form for the UI. One of the elements is a ListView. When trying to get it to select one of the items I get an error. I'm basing a lot of it around:
http://scriptattack.com/snippets/snippets.html

Although I have to call functions like this:

Does anyone have an idea why it fails?

John

Comments (12)
john

Works

That works great for me, for now. I might want the index number at some point but not for now. Thank-you.

John

Reply to john
pixamoon

index

Sure :) To get index of first selected item:

lv_objects.SelectedItems.item[0].index

One important thing: dotNet arrays index starts from 0 (not like maxscript from 1)

Best,
Pixamoon

Reply to pixamoon
john

You little beauty! Perfect.

While you seem to be a bit of a dotnet genius. Don't suppose you know how to fix the padding on a dotnet webpage? (its a test image)

John

Reply to john
pixamoon

`

no no, I just had the same problems recently for my scripts... :p

I've never used dotnet webpage, but I'll take a look. It's nice to learn new things :)

Best,
Pixamoon

Reply to pixamoon
pixamoon

`

but do you need browser or you just want to add image / logo from the web to your script ?

Reply to pixamoon
john

Image

An picture box would do. But the url I have is very long for the image I want to download. The web browser doesn't have a problem with the length. Its just really annoying the padding thing!!

Reply to john
pixamoon

`

yes, I was thinking about download image and than use it.
Did you try download with dotnet ?

I tried a bit your browser code. Still no success to change padding but I tried
webbrowser_rollout.left = -15
webbrowser_rollout.top = -10

to move image left and up,
this is only temporary solution :(

Reply to pixamoon
pixamoon

download file

did you try this way to download:


url = "http://assets3.parliament.uk/iv/main-large//ImageVault/Images/id_7382/scope_0/ImageVaultHandler.aspx.jpg"
newFile = (getDir #temp) + "//" + "00_test.jpg"

fn DownloadFile url newFile = (
	wc=dotNetClass "System.Net.WebClient"
	sr=dotNetClass "System.IO.StreamReader"
	wcobj=(dotNetObject wc)
	stm=wcobj.DownloadFile url newFile
)
	
DownloadFile url newFile
shellLaunch newFile ""

It works here with your test image.

Reply to pixamoon
john

Wow

That's perfect!! I can just download all the thumbnails to the local drive and then reference them from there. Thanks-you so much. My UI will look loads better now. And quicker!

John

pixamoon

select in ListView

Hi,
Do you want to select by script one item/line of listView or get selected line/lines?

Like in http://www.scriptspot.com/3ds-max/scripts/bitmap-tracking-resizing
or http://www.scriptspot.com/3ds-max/scripts/library-track-relink

to get selecttion count:

lv_objects.selecteditems.count

to get first selected item:

lv_objects.SelectedItems.item[0].subitems.item[0].text

to select 1st on the list:

lv_objects.Items.item[0].selected = true

where lv_objects is dotnet ListView

Hope it helps
Pixamoon