The following bit of code, which requires the win32api, simulates a mouse click using Python under the Windows OS.
import win32api, win32con
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
click(100, 100) # simulate mouse click at 100px, 100px
Here is some example code to connect to an FTP server and run the commands that follow.
@echo on %windir%\system32\ftp.exe -n -s:"%~f0" server.com goto done user myusername mypassword cd /home/directory/public_html ls -al quit :done pause
The key to this working are the following:
The -n switch allows you to not be prompted for a username upon connection.
The -s:”%~f0″ says to use the rest of the file as the commands to execute
The goto command is not a valid FTP command, so the FTP server ignores it.
So you have the script using the Windows FTP utility to connect to a server and a routine running your commands. You can even extend off of this.
20
Python Print Screen and Save Image in Windows
0 Comments | Posted by Spechal in Python, Windows
So you need to do a “Print Screen” and save the image in the clipboard huh? I had that exact need too. Let me save you a few hours of trouble and tell you that the win32clipboard does not yet have the ability to return the contents of the clipboard when the contents are BITMAP, despite the CF_BITMAP constant.
How do you do it then? I was wondering the same thing. Behold, PIL. PIL, the Python Image Library, saved me from a massive headache.
Here is the code to take a screen shot and save it. You will need the win32api and PIL libraries.
import win32api, win32con, ImageGrab
win32api.keybd_event(win32con.VK_SNAPSHOT, 1)
im = ImageGrab.grabclipboard()
im.save("screenshot.jpg", "JPEG")
Now wasn’t that easy!
There is an interesting article over at BillShrink.com about how your Internet Service Provider is likely to be ripping you off or even invading your privacy.
It’s tough to watch TV for more than ten minutes without being begged to switch Internet Service Providers. Indeed, competition for your ISP dollars is so fierce that we often see back to back commercials for different companies that provide nearly identical services. And if you believe the marketing, every ISP offers “blazing fast” speeds, “award-winning” customer service and just about everything short of eternal youth for “only $39.95 per month.” Naturally, such high and mighty promises are cause for some skepticism about what you actually receive. Today we shine the spotlight on 9 ways ISPs do and have screwed customers over, in spite of their bold claims and hefty fees.
Read the full article at http://www.billshrink.com/blog/9-ways-isps-screw-you/
It was only a matter of time before someone capitalized on President Obama calling Kanye West a Douche.
#
# Abstract Random Snow Art
# Copyright 2009 Travis Crowder
# travis.crowder@spechal.com
# Published under the MIT License
#
import pygame, sys, random
from pygame.color import THECOLORS
pygame.init()
screen = pygame.display.set_mode([640,480])
screen.fill([0,0,0])
for i in range(1, 2500):
top = random.randint(2, 478)
left = random.randint(2, 638)
color_name = random.choice(THECOLORS.keys())
color = THECOLORS[color_name]
pygame.draw.rect(screen, color, [left, top, 1, 1], 1)
pygame.display.flip()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
#
# Abstract Random Box Art
# Copyright 2009 Travis Crowder
# travis.crowder@spechal.com
# Published under the MIT License
#
import pygame, sys, random
from pygame.color import THECOLORS
pygame.init()
screen = pygame.display.set_mode([640,480])
screen.fill([0,0,0])
for i in range(1, 100):
width = random.randint(0, 250)
height = random.randint(0, 250)
top = random.randint(5, 435)
left = random.randint(5, 375)
color_name = random.choice(THECOLORS.keys())
color = THECOLORS[color_name]
line_width = random.randint(1,3)
pygame.draw.rect(screen, color, [left, top, width, height], line_width)
pygame.display.flip()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
17
Google Operating System: Chrome OS
0 Comments | Posted by Spechal in Google, Operating Systems
Google and it’s record breaking industrial complex within the search engine world, has broken many barriers by creating interesting new products which fans go mad about. They first exploded with the search engine in 1998, and since then have not only become a giant worldwide in just indexing, but a well oiled machine in the software world as well.
Google has broken walls and created a foundation with it’s innovations, allowing itself to not only become number one in the search category, but one of the best email services available, with Gmail. They since developed “Gears”, which is an “active” production wheel of services that keep Google products adapting to your operating system.
Some knew this was a prequel to the future, and their beliefs were proven true when Google unveiled the mighty Google Chrome browser, which has become a powerhouse in competing with the number one ranked Mozilla Firefox, and the original Internet Explorer from Microsoft.
Google did not stop there. Google for the last year, have been implementing “Android” Google based “mobile operating systems” into cell phones, and have claimed a huge amount of market share in the ever growing handheld/mobile industry. Google had claimed it’s throne as the “king of kings” in the online and multimedia categories.
Google though, had been planning something greater, the highly anticipated Google operating system for personal computers, which has still yet to reach the markets. It promised a linux-based engine, which would of course slaughter Microsoft Windows in performance. That day of reckoning is near, where as next week the Google OS will finally be revealed. Google busts out yet again, with a new force, but none are sure of how compatible it will be.
None the less, this new OS, will be another breakthrough for the powerhouse ran by Eric Schmidt, which many expect to be a huge success. Although there are doubters, many claim that drivers necessary for a smooth running platform OS will not be available immediately. Only time will tell.
The code-named “Chrome OS” is slated for the first public release next week, even though some analysts claim it will be pushed back. The future succession of the OS is yet to be seen, as Linux based operating systems and open source platforms have been available for a very long time, free of charge, and have yet to hold a firm grip upon the market.
Microsoft dominates, clearly in the world of operating systems, but, another brand of competition, let alone a financial giant such as Google, could prove to be a challenge for Microsoft. We shall all see soon.
By:
xxxOBSCENExxx
November 13th, 2009
extratorrent.com
#
# Convert Fahrenheit to Centigrade
# Copyright 2009 Travis Crowder
# travis.crowder@spechal.com
# Published under the MIT License
#
degrees = input("Enter the temperature in Fahrenheit to convert: ");
print degrees, "Fahrenheit is", (degrees - 32.0) * 5/9, "Centigrade"
#
# Guessing Game
# Copyright 2009 Travis Crowder
# travis.crowder@spechal.com
# Published under the MIT License
#
import random
secret = random.randint(1,100)
guess = 0
guesses = 0
print "Guess the secret number between 1 and 100!"
while guess != secret:
guesses = guesses + 1
guess = input("Enter your guess: ")
if guess > secret:
print "Your guess is too high. Try again!"
elif guess < secret:
print "Your guess is too low. Try again!"
else:
print "You guessed the secret in", guesses, "guesses! It was", secret

