27 constrain to square accident


blob._x=posx+-random(Math.sqrt(number_of_items)*5);
blob._y=posy+-random(Math.sqrt(number_of_items)*5);

26 WSH

okay so WSH, looks like :

Set objShell = WScript.CreateObject(”WScript.Shell”)
objShell.Run “Notepad.exe”
Do Until Success = True

Success = objShell.AppActivate(”Notepad”)
Wscript.Sleep 1000
Loop
objShell.SendKeys “This is a test.”

execution

in your command line
cscript name_of_script.vbs

good script repository / tutorials

Rob van der Woude Scripting Example Pages

http://www.robvanderwoude.com/wsh.html

http://www.iopus.com/guides/wsh.htm

http://www.winscripter.com/WSH/default.aspx

A book, which I havent got yet
http://people.freenet.de/gborn/WSHBazaar/WSHBazaar.htm

official msdn pages related to WSH

must revisit the windows annoyances book for more.

25 test

I was having problems modifying binary files. (namely uncompressed swfs for an IMEI verification thing)

dimitre suggested a workaround which involved rewriting a new file from the contents of an old one.. I decided to persist a bit longer.

taken from the php manual on fseek.

if you’re using fseek() to write data to a file, remember to open the file in “r+” mode, example:

24 Teleo Phys Comp Dial

what a confusing to set up system.
what a retarded site they have too.
Their examples arent specific about the setup. and this is not for newbies like theyd make you think..though having said that it didnt take that long to figure it out in all honesty. A bank holiday evening..

Teleo

import com.makingthings.*;

var ain:TMioAin = new TMioAin( 0 );
// the number between brackets refers to the analog input
// TMioAin is the multiple analogue input device which is connected to my usb module
// TIntroAin might be the one you are using..

//tPiece is the name of the movieclip
tPiece.onEnterFrame = function()
{
var v:Number = ain.getValue();
tPiece._rotation += v - 16;
trace(v);
}

and then I found

flash_class_library.htm#samples

23 debugging

not a bad way to highlight php code during debugging sessions.


highlight_file(__FILE__);

22 Mobile processing 2

import processing.phone.*;

mp2 is out, if you dont include the line above in your processing scripts,
it wont work, wont give an error message.. zilch.. nada..

its sometimes the simple things.

21 remote_receive_1001




remote_receive_1001

Originally uploaded by Iman.

I experimented with A on sending a mono image via a webcam trained on a monitor one pixel at a time.

The camera was on my PC, looking at A’s processing based monocolour nokia graphic image transmitter. Getting the frame rates right took three attempts. here flash was doing 2 frames a second and A’s machine was outputting a pixel every 500 ms which is half a second. (or two pixels a second.)

but an awful lot of testing on my end to make sure it recognises black and white and the getting the logic right the first time round.

19 Lights On Lights Off

Okay I need to turn scroll lock or caps lock or num lock on and off from a flash application using Zinc, I didnt see a function in Zinc, did I miss it? is there something for it in flash as?

So Im thinking if I go down the Zinc route Im going to need to extend it using Kernel32.DLL as a custom extension to Zinc..

this dose of bad manual writing doesnt help much either

“Because the SetKeyboardState function alters the input state of the calling thread and not the global input state of the system, an application cannot use SetKeyboardState to set the NUM LOCK, CAPS LOCK, or SCROLL LOCK indicator lights on the keyboard. ”

what the hell is that supposed to mean and what is the alternative.

—- found solution 26 oct 06
Set WshShell = CreateObject( “WScript.Shell” )
counter = 0
While counter < 18
WshShell.SendKeys "{NUMLOCK}"
WScript.Sleep 200
WshShell.SendKeys "{NUMLOCK}"
WshShell.SendKeys "{CAPSLOCK}"
WScript.Sleep 200
WshShell.SendKeys "{CAPSLOCK}"
WshShell.SendKeys "{SCROLLLOCK}"
WScript.Sleep 200
WshShell.SendKeys "{SCROLLLOCK}"
WshShell.SendKeys "{CAPSLOCK}"
WScript.Sleep 200
WshShell.SendKeys "{CAPSLOCK}"
counter = counter + 1
WEnd

17 GreasyScript

For the Chromeless(web page free) implementation of GlitchBrowser, I thought of using Greasemonkey. Im not hugely familiar with javascript, but I thought Id give it a go.

First of all it should be a lot clearer in diveintogreasemonkey that the filename has to have . user before the .js

eg. ‘glitchbrowser.user.js’

without .user thing the tools menu wont let you install the script. simple as that!

secondly here is the code which currently works ONLY with absolute img src’s

// greasemonkey initialisation lines

var allimg, thisimg,tempvar;
allimg = document.getElementsByTagName(’img’);
//above get all img tags and puts them in an array.

//we want to change each img tag’s src one by one

for (var i = 0; i < allimg.length; i++) {
thisimg = allimg[i];

// oka I dont know how to prepend so Im using a temp variable to hold the original img src
tempvar=thisimg.src;

//*To implement later: make sure its absolute* - if not absolute already with http in src prepend full domain!

//below construct new img src with gbrowser thing in front of it.. append original img src

thisimg.src='http://glitchbrowser.com/url2img.php?url='+thisimg.src;

}

16 cURL and Die

Last week I bought a dodgy ebook on cURL a few hours before a session. just to make sure I could answer any question that would crop up regarding curl. But no-one got that far.

talking of dodgy sites.. this Easy Control and Rack Designer allows serial communication over TCP/IP .. via a server metaphor.. which means you could effectively get PHP to talk to serial devices. limited use to me right now.. but who knows.

Entries