PDA

View Full Version : Shelllaunch issue


displaced
05-07-2008, 08:27 PM
Hi,

Ive been using a script to open bitmaps that are used on a selected object for a while now.

I've just upgraded to 2008 and cant get the scrip to work now....

the path that gets created will work as a run command in windows

so here goes




shelllaunch "C:\Program Files\Autodesk\3ds Max 2008\Photoshop.exe.lnk" "image (file://\leeds33dMapsJobsKent).bmp"





I was hoping that someone could test this out for me....as its driving me mad.....

the shelllaunch returns a true value when executed but doesnt load photoshop. but it does work if you direct it to the actually photoshop file and not the shortcut in the root of max.

(you have to have a shortcut in the root of max to you copy of photoshop)


Cheers

LoneRobot
05-08-2008, 08:45 AM
Hi Colin,

you could try pointing directly to the photoshop executable but pass an "open" argument with it - bear in mind this is an example for a standard material with a diffuse map.

if selection.count == 1 do
(
bitmappath = $.material.diffusemap.filename
shelllaunch "C:\Program Files (x86)\Adobe\Adobe Photoshop CS2\Photoshop.exe" ("/open " + bitmappath)
)

displaced
05-08-2008, 09:10 AM
Yes thanks for that.....thats my current work around.


The problem is this script gets distributed across a network so i need the shortcut to work as it needs to be in the same place for every user.....so all they have to do is create the shortcut and not edit the script.

Its frustrating because I'ts just stop working....

cheers

displaced
05-08-2008, 11:16 AM
Ive sorted it. in a around about method.


Im now reading in the path of photoshop from a txt file which is in the root of Max.

Kinda the same thing but slightly different.



file = getfilenamepath "$max"
file += "pslocation.txt"
o = openfile file mode:"rt"
seek o #eof
maxlen=filepos o
seek o 0

global filelocation = readline o
close o


for t in theTextures do shelllaunch filelocation ("/open " + t)

davestewart
05-08-2008, 11:59 AM
Im now reading in the path of photoshop from a txt file which is in the root of Max.

Sounds like a bit of a faff if everyone has to create a text file for themselves. Using the max ini file would be much cleaner.

(I couldn't resist having a tinker...)

function editBitmap bmp =
(
local ps = getIniSetting (getMAXIniFile()) "photoshop" "path"
if ps == "" do
(
local ps = getOpenFileName caption:"Please locate Photoshop.exe" filename:"c:/program files/Photoshop.exe" types:"Executable Files(*.exe)|*.exe"
if ps != undefined do setINISetting (getMAXIniFile()) "photoshop" "path" ps
)
if ps != undefined AND doesFileExist ps then
(
--format "Opening: \"%\" in Photoshop...\n" bmp
shellLaunch ps bmp
)
else
(
delINISetting (getMAXIniFile()) "photoshop" "path"
messagebox "Photoshop could not be found"
)
)

editBitmap "c:\\temp\\image.bmp"

displaced
05-08-2008, 07:03 PM
davestewart you are a genius.


That methods is so much better than what i was using.....cheers !


I had to mod it for my code but it works a treat..



if ps == "" do
(
local ps = getOpenFileName caption:"Please locate Photoshop.exe" filename:"c:/program files/Photoshop.exe" types:"Executable Files(*.exe)|*.exe"
if ps != undefined do setINISetting (getMAXIniFile()) "photoshop" "path" ps
)

for t in theTextures do (
if ps != undefined AND doesFileExist ps then
(
shelllaunch ps ("/open " + t)
print ps
print t
)
else
(
delINISetting (getMAXIniFile()) "photoshop" "path"
messagebox "Photoshop could not be found"
)
)




Sorry for posting code all the time but i like to post solutions as well as problems.

I hate it when im stuck and i search this forum and find someone having the same issues as me and then they post " oh Ive sorted it" without posting any solution.

Cheers for you input.

CGTalk Moderation
05-08-2008, 07:03 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.