Cardbox > Forums > Cardbox Talk > "Start a VBScript when Cardbox launches"
Start a VBScript when Cardbox launches
Starting a script that runs continuously in the background whilst Cardbox runs, (and shuts down when Cardbox closed) |
Current user: [none] |
Posted By | Post |
---|---|
cristoayre | 6-Feb-2015 12:52 I have cobbled together some code that runs in a DO LOOP, and reads a folder. At present, it simply shows the files present in the folder**. But of course, VBScript doesn't pick up key presses to break out of the loop, so I added a line that stops the thing running when a grapic named "stop.JPG" appears in folder. (Must admit, when I renamed the file in folder, the program complained first time, but on next iteration, it stopped as expected) Now, to start this script, I ran it in IE, which is not the preferred way to do it. I know Cardbox has "Launch", but not sure how to start - of even if - this would run the VBS in background. (I tried a macro, but that didn't start the DO loop, and only ran once) As stated, I would LIKE to start and stop with Cardbox. I don't really want to have to start IE, then hunt for the script every time I want to start it up. Any ideas? Option Explicit Set objFolder = objFSO.GetFolder(objStartFolder) Sub CheckFolder() ** The script will eventually copy the picture out of "hot" and into "print", and append an entry to a text file. |
bert | 6-Feb-2015 13:35 -First: is you click on a .vbs and IE starts, there something wrong with you file association in Windows. Repair that! In my opinion it should be associated with C:\Windows\System32\WScript.exe |
cristoayre | 6-Feb-2015 19:20 No, it was the way I was doing it 'cos I knew IE had a built in VB engine, so I was typing the filename into the browser window to run it locally. I'll take a look at "Help" re starup macro. I've just spent the afternoon writing a script, and I found that with CMD, I can CD to the folder, and enter the filename. So I thought it might also be possible to write a .bat file to initiate cardbox.exe and then the vb script. (That made me wonder if I could type "exit" into macro to end the script/CMD) But will check out start macro first. (My complex new script - which I'm quite proud of - takes the image from "hot folder", puts a copy in Archive, resizes it down to fit an 5" x 7" portrait frame on A4 sheet and puts it in "Print" folder, puts another copy in "Thumbs" folder and reduces to 640px x360px and writes the filename to a text file before removing photo from "hot" folder. Was looking at PNG convert to 256 colours for thumbs ... but converting thumbs ended up than JPG, so I'll leave that aspect out) So I'm getting there! |
bert | 6-Feb-2015 20:59 I cannot exactly understand why you use Cardbox for these things. |