Using AGS for a christmas surprise at work, I wonder if I can make AGS open a pdf file for the user?
I'm looking for a command that does something like opening the PDF file in the background, then quitting AGS so the PDF file is open and visible to the user when AGS closes.
Is this possible? I believe the function File.Open might not be what I'm looking for...?
No, AGS takes some care in that respect. File.Open opens raw text/data, and you CAN run another AGS game from within another AGS game. PDF, though, is not possible.
Thank you for the quick answer. Good to know that road's closed.
Somebody once posted a small shell plugin that would allow you to run Windows commands from inside AGS.
https://www.dropbox.com/s/oskhhwrytwtfg1p/ags_shell.dll?dl=0
I don't remember what the AGSScript command was though.
Edit:
found it, it's
int ShellExecute(const string operation, const string file, const string parameters, ShowCommand showCommand = SW_SHOW);
Wow, thats really something.
I got it and added it to AGS, also right-clicked and chose "use this plugin". But I'm unsure how to use the command.
Edited by mod: Please don't quote the whole previous post.
Try this:
ShellExecute("", "F:\\letters\\letter.pdf", "");
(and don't quote the entire previous post)
Alternatively you can try the Lua plugin, since I'm 110% sure that Lua has libraries to interface with the OS.
Thank you for helping with the ShellExecute command. Sorry for the quote.
Oh wait, one more thing...
Can I specify the location of the PDF file I want to open relative to the game directory?
Rather than opening the letter.pdf at "c:\\letters\\letter.pdf", I'd like to do something like simply asking AGS to open "letter.pdf" in the same directory as the game files. This would allow me to bring the game with me on a memory stick without needing to edit what location the game should look for the pdf at.
Just remove the path.
ShellExecute("", "letter.pdf", "");
I tried that and it didn't work.
Then I tried it again and it worked. I should have just tried it twice before asking :-[
Thank you again.
Success, my collegaues love it :-D
Thank you for your help.
Hi everyone :)
Quote from: Ghost on Sat 14/11/2015 17:46:23
you CAN run another AGS game from within another AGS game
Great! I was actualy looking to run a AGS game within another AGS game (like when you play Maniac Mansion within Day Of The Tentacle). Could someone tell me how to do it? Thanks a lot :)
PS: I've tried to execute an EXE file with the AGS Shell plugin:
ShellExecute("", ".\\OtherGame\\Game.exe", "");
I also tried with or without the EXE extension. Tried also
ShellExecute("", ""start .\\OtherGame\\Game.exe", ""); or going to the other game folder with "cd OtherGame" - but nothing worked (maybe I did something wrong :/)
Any help would be very welcomed :)
PPS: Perhaps I should have create a new thread? If so, feel free to tell me :)
There's a special command for that: RunAGSGame().
Note that the game should have the same basic settings as the main game (color depth and resolution, mostly), since the engine part of the first .exe will simply read the data part of the second one.
More details can be found in the manual entry for the command.
This is the kind of thnig that makes me go all fanboy just like Syndrome. This is so COOL (laugh)
Great! Thanks Khris for your help :) Just what I needed :)
About the limitation of sharing common files (audio.vox, speech.vox, ...), I've tried changing the file names ("audio.vox" goes "audiovox.001" for instance, and the other one goes "audiovox.002"). Then, in AGS, using the SchellExecute command to change the files names before launching the other game.
I've tried :
ShellExecute("", "rename audiovox.001 audio.vox", "");
ShellExecute("rename", "audiovox.001 audio.vox", "");
ShellExecute("rename", "audiovox.001", "audio.vox");
But the file name doesn't change :-\
I don't wanna bother about this. It is actualy just curiosity - and I realise how I just suck with using ShellExecute function.
Anyway, any clue how to change a file name with ShellExecute?
Thanks so much! :)
The first version you tried should work but you probably have to do this:
ShellExecute("", "rename audio.vox audio.vox.001", ""); // move first game's file out of the way first
ShellExecute("", "rename audio.vox.002 audio.vox", ""); // this should work now
since my guess is Windows won't let you rename file A to the current name of an existing file B.
Thanks again Khris :)
Wait, one more :cheesy:
Can I insert a hyperlink into AGS?
I mean, can I make AGS open default browser and find a certain webpage?
Fun fact: that's why the plugin was written in the first place, afaik.
ShellExecute("", "http://google.com", "");
This engine is the coolest (laugh)
Thank you, Khris, you're always there to help me out of little fixes like this. I really appreciate it.
Hm, doesn't work for me. Dunno what I'm doing wrong.
I can make simple commands work, like the Display command, so it's not the GUI not being clickable or something like that, but the ShellExecute command wont work for me (wtf)