- C++ Script for USB scheduling
- Posted by Xx Ice xX on January 12th, 2006
It was "Bob I" who gave me the idea to schedule a usb start. He said use
autoit to design a script that would open the device manager, walk down the
tree and then enable one of the USB Root Hubs, (so my ipod would start
charging when it was enabled). If i could write a script to enable the root
hub, and disable the root hub, i could schedule this with the task scheduler
to start and stop when i wanted.
Unfortunatly i have no idea how to use C++ coding. Is the script to do wat i
want something hard or what? Could some body either point me in a direction
or write a script if its not hard?
Any help, alternatives, or advice much appriciated
Thanks heaps
Ice
- Posted by Pegasus \(MVP\) on January 12th, 2006
Have you considered following Bob's suggestion of using
AutoIt? It uses its own commands, not C++, which are
basically a bunch of keyboard & mouse commands.
"Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
> It was "Bob I" who gave me the idea to schedule a usb start. He said use
> autoit to design a script that would open the device manager, walk down
the
> tree and then enable one of the USB Root Hubs, (so my ipod would start
> charging when it was enabled). If i could write a script to enable the
root
> hub, and disable the root hub, i could schedule this with the task
scheduler
> to start and stop when i wanted.
>
> Unfortunatly i have no idea how to use C++ coding. Is the script to do wat
i
> want something hard or what? Could some body either point me in a
direction
> or write a script if its not hard?
> Any help, alternatives, or advice much appriciated
> Thanks heaps
> Ice
- Posted by Xx Ice xX on January 12th, 2006
Autoit the program is not a GUI. the script is written in notepad and then
compiled with autoit, to RUN the windows GUI. Its not a gui itself. If anyone
knows the commands to do what my first post sed that would be great. Thanks
Ice
"Pegasus (MVP)" wrote:
> Have you considered following Bob's suggestion of using
> AutoIt? It uses its own commands, not C++, which are
> basically a bunch of keyboard & mouse commands.
>
>
> "Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
> news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
> > It was "Bob I" who gave me the idea to schedule a usb start. He said use
> > autoit to design a script that would open the device manager, walk down
> the
> > tree and then enable one of the USB Root Hubs, (so my ipod would start
> > charging when it was enabled). If i could write a script to enable the
> root
> > hub, and disable the root hub, i could schedule this with the task
> scheduler
> > to start and stop when i wanted.
> >
> > Unfortunatly i have no idea how to use C++ coding. Is the script to do wat
> i
> > want something hard or what? Could some body either point me in a
> direction
> > or write a script if its not hard?
> > Any help, alternatives, or advice much appriciated
> > Thanks heaps
> > Ice
>
>
>
- Posted by Pegasus \(MVP\) on January 12th, 2006
AutoIt interprets the commands you that place into its command
files. It therefore allows you to automate more or less everything
that you would normally do manually, such as manipulate your
iPod device. It will happily work in a GUI environment. Here is
what you would do:
1. Create the AutoIt script to perform your tasks.
2. Test the script.
3. Invoke the script at the desired time, using the Task Scheduler.
"Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
news:E077F199-DACF-4429-A8AF-E88AD71B3724@microsoft.com...
> Autoit the program is not a GUI. the script is written in notepad and then
> compiled with autoit, to RUN the windows GUI. Its not a gui itself. If
anyone
> knows the commands to do what my first post sed that would be great.
Thanks
> Ice
>
> "Pegasus (MVP)" wrote:
>
> > Have you considered following Bob's suggestion of using
> > AutoIt? It uses its own commands, not C++, which are
> > basically a bunch of keyboard & mouse commands.
> >
> >
> > "Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
> > news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
> > > It was "Bob I" who gave me the idea to schedule a usb start. He said
use
> > > autoit to design a script that would open the device manager, walk
down
> > the
> > > tree and then enable one of the USB Root Hubs, (so my ipod would start
> > > charging when it was enabled). If i could write a script to enable the
> > root
> > > hub, and disable the root hub, i could schedule this with the task
> > scheduler
> > > to start and stop when i wanted.
> > >
> > > Unfortunatly i have no idea how to use C++ coding. Is the script to do
wat
> > i
> > > want something hard or what? Could some body either point me in a
> > direction
> > > or write a script if its not hard?
> > > Any help, alternatives, or advice much appriciated
> > > Thanks heaps
> > > Ice
> >
> >
> >
- Posted by Bob I on January 12th, 2006
I got bored, here is the script for whacking the USB. Replace the
"Send("d")" with an "Send("e")" and remove the"Send("y")" to turn it
back on. Paste the stuff between the "******" lines into notepad and
save as a ".au3" file.
***************************
;
; AutoIt Version: 3.0
; Language: English
; Platform: XP
; Author: birelan
;
; Script Function: Opens/runs Device Manager disables a USB hub then quits.
; Run Device Manager
Send("#r")
WinWaitActive("Run")
Send("devmgmt.msc{Enter}")
WinWaitActive("Device Manager")
Send("!v")
Send("e")
Send("{Tab}u")
; Adjust the number of "u's" to hit the correct hub
Send("{RIGHT}uu")
Send("{APPSKEY}")
Send("d")
Send("y")
; Pause to allow you to see the effect
Sleep(2500)
; Now quit by pressing Alt-f and then x (File menu -> Exit)
Send("!f")
Send("x")
; Now wait for Device manager to close before continuing
WinWaitClose("Device Manager")
; Finished!
*****************************
Xx Ice xX wrote:
> Autoit the program is not a GUI. the script is written in notepad and then
> compiled with autoit, to RUN the windows GUI. Its not a gui itself. If anyone
> knows the commands to do what my first post sed that would be great. Thanks
> Ice
>
> "Pegasus (MVP)" wrote:
>
>
>>Have you considered following Bob's suggestion of using
>>AutoIt? It uses its own commands, not C++, which are
>>basically a bunch of keyboard & mouse commands.
>>
>>
>>"Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
>>news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
>>
>>>It was "Bob I" who gave me the idea to schedule a usb start. He said use
>>>autoit to design a script that would open the device manager, walk down
>>
>>the
>>
>>>tree and then enable one of the USB Root Hubs, (so my ipod would start
>>>charging when it was enabled). If i could write a script to enable the
>>
>>root
>>
>>>hub, and disable the root hub, i could schedule this with the task
>>
>>scheduler
>>
>>>to start and stop when i wanted.
>>>
>>>Unfortunatly i have no idea how to use C++ coding. Is the script to do wat
>>
>>i
>>
>>>want something hard or what? Could some body either point me in a
>>
>>direction
>>
>>>or write a script if its not hard?
>>>Any help, alternatives, or advice much appriciated
>>>Thanks heaps
>>>Ice
>>
>>
>>
- Posted by Xx Ice xX on January 12th, 2006
Holy crap Bob I thanks heaps!!!
So the script to turn the root hub OFF is what youve got there, and the
script to turn the root hub ON is what youve got there, except I replace
Send("d") with Send("e") and remove Send("y") correct?
And ill experiment with the number of U's to hit the right hub. Wow thanks
heaps for your time with that. I woulda been stuck lol. You dont know any
tutorials that would help me along with that sorta stuff do you?
Thanks heaps!
Ice
"Bob I" wrote:
> I got bored, here is the script for whacking the USB. Replace the
> "Send("d")" with an "Send("e")" and remove the"Send("y")" to turn it
> back on. Paste the stuff between the "******" lines into notepad and
> save as a ".au3" file.
>
> ***************************
> ;
> ; AutoIt Version: 3.0
> ; Language: English
> ; Platform: XP
> ; Author: birelan
> ;
> ; Script Function: Opens/runs Device Manager disables a USB hub then quits.
> ; Run Device Manager
> Send("#r")
> WinWaitActive("Run")
> Send("devmgmt.msc{Enter}")
> WinWaitActive("Device Manager")
> Send("!v")
> Send("e")
> Send("{Tab}u")
> ; Adjust the number of "u's" to hit the correct hub
> Send("{RIGHT}uu")
> Send("{APPSKEY}")
> Send("d")
> Send("y")
> ; Pause to allow you to see the effect
> Sleep(2500)
> ; Now quit by pressing Alt-f and then x (File menu -> Exit)
> Send("!f")
> Send("x")
> ; Now wait for Device manager to close before continuing
> WinWaitClose("Device Manager")
> ; Finished!
>
> *****************************
>
> Xx Ice xX wrote:
>
> > Autoit the program is not a GUI. the script is written in notepad and then
> > compiled with autoit, to RUN the windows GUI. Its not a gui itself. If anyone
> > knows the commands to do what my first post sed that would be great. Thanks
> > Ice
> >
> > "Pegasus (MVP)" wrote:
> >
> >
> >>Have you considered following Bob's suggestion of using
> >>AutoIt? It uses its own commands, not C++, which are
> >>basically a bunch of keyboard & mouse commands.
> >>
> >>
> >>"Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
> >>news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
> >>
> >>>It was "Bob I" who gave me the idea to schedule a usb start. He said use
> >>>autoit to design a script that would open the device manager, walk down
> >>
> >>the
> >>
> >>>tree and then enable one of the USB Root Hubs, (so my ipod would start
> >>>charging when it was enabled). If i could write a script to enable the
> >>
> >>root
> >>
> >>>hub, and disable the root hub, i could schedule this with the task
> >>
> >>scheduler
> >>
> >>>to start and stop when i wanted.
> >>>
> >>>Unfortunatly i have no idea how to use C++ coding. Is the script to do wat
> >>
> >>i
> >>
> >>>want something hard or what? Could some body either point me in a
> >>
> >>direction
> >>
> >>>or write a script if its not hard?
> >>>Any help, alternatives, or advice much appriciated
> >>>Thanks heaps
> >>>Ice
> >>
> >>
> >>
>
>
- Posted by Xx Ice xX on January 13th, 2006
Bob I ur a talented feller ill give you that. The OFF Script works like a
dream every time without fail. How ever the On script (When ive changed d to
e and remove send("y") Walks one to far in the list and enables an already
enabled root hub.
From changing things around my guess is it does not recognise the disabled
root hub as one it can change. Like when its disabled its not physically
there you know?
How do i alter it so it enables the disabled one.
Thanks heaps for your help
Ice
"Bob I" wrote:
> I got bored, here is the script for whacking the USB. Replace the
> "Send("d")" with an "Send("e")" and remove the"Send("y")" to turn it
> back on. Paste the stuff between the "******" lines into notepad and
> save as a ".au3" file.
>
> ***************************
> ;
> ; AutoIt Version: 3.0
> ; Language: English
> ; Platform: XP
> ; Author: birelan
> ;
> ; Script Function: Opens/runs Device Manager disables a USB hub then quits.
> ; Run Device Manager
> Send("#r")
> WinWaitActive("Run")
> Send("devmgmt.msc{Enter}")
> WinWaitActive("Device Manager")
> Send("!v")
> Send("e")
> Send("{Tab}u")
> ; Adjust the number of "u's" to hit the correct hub
> Send("{RIGHT}uu")
> Send("{APPSKEY}")
> Send("d")
> Send("y")
> ; Pause to allow you to see the effect
> Sleep(2500)
> ; Now quit by pressing Alt-f and then x (File menu -> Exit)
> Send("!f")
> Send("x")
> ; Now wait for Device manager to close before continuing
> WinWaitClose("Device Manager")
> ; Finished!
>
> *****************************
>
> Xx Ice xX wrote:
>
> > Autoit the program is not a GUI. the script is written in notepad and then
> > compiled with autoit, to RUN the windows GUI. Its not a gui itself. If anyone
> > knows the commands to do what my first post sed that would be great. Thanks
> > Ice
> >
> > "Pegasus (MVP)" wrote:
> >
> >
> >>Have you considered following Bob's suggestion of using
> >>AutoIt? It uses its own commands, not C++, which are
> >>basically a bunch of keyboard & mouse commands.
> >>
> >>
> >>"Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
> >>news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
> >>
> >>>It was "Bob I" who gave me the idea to schedule a usb start. He said use
> >>>autoit to design a script that would open the device manager, walk down
> >>
> >>the
> >>
> >>>tree and then enable one of the USB Root Hubs, (so my ipod would start
> >>>charging when it was enabled). If i could write a script to enable the
> >>
> >>root
> >>
> >>>hub, and disable the root hub, i could schedule this with the task
> >>
> >>scheduler
> >>
> >>>to start and stop when i wanted.
> >>>
> >>>Unfortunatly i have no idea how to use C++ coding. Is the script to do wat
> >>
> >>i
> >>
> >>>want something hard or what? Could some body either point me in a
> >>
> >>direction
> >>
> >>>or write a script if its not hard?
> >>>Any help, alternatives, or advice much appriciated
> >>>Thanks heaps
> >>>Ice
> >>
> >>
> >>
>
>
- Posted by Xx Ice xX on January 13th, 2006
lol nvm i jst removed a 'u'. It confused me cuz the first script needed 1 u
and the second needed none. Thanks heaps for all your help sorry im such a
newb lol
Thanks
Ice
"Bob I" wrote:
> I got bored, here is the script for whacking the USB. Replace the
> "Send("d")" with an "Send("e")" and remove the"Send("y")" to turn it
> back on. Paste the stuff between the "******" lines into notepad and
> save as a ".au3" file.
>
> ***************************
> ;
> ; AutoIt Version: 3.0
> ; Language: English
> ; Platform: XP
> ; Author: birelan
> ;
> ; Script Function: Opens/runs Device Manager disables a USB hub then quits.
> ; Run Device Manager
> Send("#r")
> WinWaitActive("Run")
> Send("devmgmt.msc{Enter}")
> WinWaitActive("Device Manager")
> Send("!v")
> Send("e")
> Send("{Tab}u")
> ; Adjust the number of "u's" to hit the correct hub
> Send("{RIGHT}uu")
> Send("{APPSKEY}")
> Send("d")
> Send("y")
> ; Pause to allow you to see the effect
> Sleep(2500)
> ; Now quit by pressing Alt-f and then x (File menu -> Exit)
> Send("!f")
> Send("x")
> ; Now wait for Device manager to close before continuing
> WinWaitClose("Device Manager")
> ; Finished!
>
> *****************************
>
> Xx Ice xX wrote:
>
> > Autoit the program is not a GUI. the script is written in notepad and then
> > compiled with autoit, to RUN the windows GUI. Its not a gui itself. If anyone
> > knows the commands to do what my first post sed that would be great. Thanks
> > Ice
> >
> > "Pegasus (MVP)" wrote:
> >
> >
> >>Have you considered following Bob's suggestion of using
> >>AutoIt? It uses its own commands, not C++, which are
> >>basically a bunch of keyboard & mouse commands.
> >>
> >>
> >>"Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
> >>news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
> >>
> >>>It was "Bob I" who gave me the idea to schedule a usb start. He said use
> >>>autoit to design a script that would open the device manager, walk down
> >>
> >>the
> >>
> >>>tree and then enable one of the USB Root Hubs, (so my ipod would start
> >>>charging when it was enabled). If i could write a script to enable the
> >>
> >>root
> >>
> >>>hub, and disable the root hub, i could schedule this with the task
> >>
> >>scheduler
> >>
> >>>to start and stop when i wanted.
> >>>
> >>>Unfortunatly i have no idea how to use C++ coding. Is the script to do wat
> >>
> >>i
> >>
> >>>want something hard or what? Could some body either point me in a
> >>
> >>direction
> >>
> >>>or write a script if its not hard?
> >>>Any help, alternatives, or advice much appriciated
> >>>Thanks heaps
> >>>Ice
> >>
> >>
> >>
>
>
- Posted by Bob I on January 13th, 2006
Sorry, no tutorials, just the documentation that came with AutoIt and
poking around in Windows.
Xx Ice xX wrote:
> Holy crap Bob I thanks heaps!!!
> So the script to turn the root hub OFF is what youve got there, and the
> script to turn the root hub ON is what youve got there, except I replace
> Send("d") with Send("e") and remove Send("y") correct?
>
> And ill experiment with the number of U's to hit the right hub. Wow thanks
> heaps for your time with that. I woulda been stuck lol. You dont know any
> tutorials that would help me along with that sorta stuff do you?
> Thanks heaps!
> Ice
>
> "Bob I" wrote:
>
>
>>I got bored, here is the script for whacking the USB. Replace the
>>"Send("d")" with an "Send("e")" and remove the"Send("y")" to turn it
>>back on. Paste the stuff between the "******" lines into notepad and
>>save as a ".au3" file.
>>
>>***************************
>>;
>>; AutoIt Version: 3.0
>>; Language: English
>>; Platform: XP
>>; Author: birelan
>>;
>>; Script Function: Opens/runs Device Manager disables a USB hub then quits.
>>; Run Device Manager
>>Send("#r")
>>WinWaitActive("Run")
>>Send("devmgmt.msc{Enter}")
>>WinWaitActive("Device Manager")
>>Send("!v")
>>Send("e")
>>Send("{Tab}u")
>>; Adjust the number of "u's" to hit the correct hub
>>Send("{RIGHT}uu")
>>Send("{APPSKEY}")
>>Send("d")
>>Send("y")
>>; Pause to allow you to see the effect
>>Sleep(2500)
>>; Now quit by pressing Alt-f and then x (File menu -> Exit)
>>Send("!f")
>>Send("x")
>>; Now wait for Device manager to close before continuing
>>WinWaitClose("Device Manager")
>>; Finished!
>>
>>*****************************
>>
>>Xx Ice xX wrote:
>>
>>
>>>Autoit the program is not a GUI. the script is written in notepad and then
>>>compiled with autoit, to RUN the windows GUI. Its not a gui itself. If anyone
>>>knows the commands to do what my first post sed that would be great. Thanks
>>>Ice
>>>
>>>"Pegasus (MVP)" wrote:
>>>
>>>
>>>
>>>>Have you considered following Bob's suggestion of using
>>>>AutoIt? It uses its own commands, not C++, which are
>>>>basically a bunch of keyboard & mouse commands.
>>>>
>>>>
>>>>"Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
>>>>news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
>>>>
>>>>
>>>>>It was "Bob I" who gave me the idea to schedule a usb start. He said use
>>>>>autoit to design a script that would open the device manager, walk down
>>>>
>>>>the
>>>>
>>>>
>>>>>tree and then enable one of the USB Root Hubs, (so my ipod would start
>>>>>charging when it was enabled). If i could write a script to enable the
>>>>
>>>>root
>>>>
>>>>
>>>>>hub, and disable the root hub, i could schedule this with the task
>>>>
>>>>scheduler
>>>>
>>>>
>>>>>to start and stop when i wanted.
>>>>>
>>>>>Unfortunatly i have no idea how to use C++ coding. Is the script to do wat
>>>>
>>>>i
>>>>
>>>>
>>>>>want something hard or what? Could some body either point me in a
>>>>
>>>>direction
>>>>
>>>>
>>>>>or write a script if its not hard?
>>>>>Any help, alternatives, or advice much appriciated
>>>>>Thanks heaps
>>>>>Ice
>>>>
>>>>
>>>>
>>
- Posted by Bob I on January 13th, 2006
You're welcome, glad to hear it's working as expected.
Xx Ice xX wrote:
> lol nvm i jst removed a 'u'. It confused me cuz the first script needed 1 u
> and the second needed none. Thanks heaps for all your help sorry im such a
> newb lol
> Thanks
> Ice
>
> "Bob I" wrote:
>
>
>>I got bored, here is the script for whacking the USB. Replace the
>>"Send("d")" with an "Send("e")" and remove the"Send("y")" to turn it
>>back on. Paste the stuff between the "******" lines into notepad and
>>save as a ".au3" file.
>>
>>***************************
>>;
>>; AutoIt Version: 3.0
>>; Language: English
>>; Platform: XP
>>; Author: birelan
>>;
>>; Script Function: Opens/runs Device Manager disables a USB hub then quits.
>>; Run Device Manager
>>Send("#r")
>>WinWaitActive("Run")
>>Send("devmgmt.msc{Enter}")
>>WinWaitActive("Device Manager")
>>Send("!v")
>>Send("e")
>>Send("{Tab}u")
>>; Adjust the number of "u's" to hit the correct hub
>>Send("{RIGHT}uu")
>>Send("{APPSKEY}")
>>Send("d")
>>Send("y")
>>; Pause to allow you to see the effect
>>Sleep(2500)
>>; Now quit by pressing Alt-f and then x (File menu -> Exit)
>>Send("!f")
>>Send("x")
>>; Now wait for Device manager to close before continuing
>>WinWaitClose("Device Manager")
>>; Finished!
>>
>>*****************************
>>
>>Xx Ice xX wrote:
>>
>>
>>>Autoit the program is not a GUI. the script is written in notepad and then
>>>compiled with autoit, to RUN the windows GUI. Its not a gui itself. If anyone
>>>knows the commands to do what my first post sed that would be great. Thanks
>>>Ice
>>>
>>>"Pegasus (MVP)" wrote:
>>>
>>>
>>>
>>>>Have you considered following Bob's suggestion of using
>>>>AutoIt? It uses its own commands, not C++, which are
>>>>basically a bunch of keyboard & mouse commands.
>>>>
>>>>
>>>>"Xx Ice xX" <XxIcexX@discussions.microsoft.com> wrote in message
>>>>news:55AFBF4B-E49B-4C54-8FAC-0B52547D5226@microsoft.com...
>>>>
>>>>
>>>>>It was "Bob I" who gave me the idea to schedule a usb start. He said use
>>>>>autoit to design a script that would open the device manager, walk down
>>>>
>>>>the
>>>>
>>>>
>>>>>tree and then enable one of the USB Root Hubs, (so my ipod would start
>>>>>charging when it was enabled). If i could write a script to enable the
>>>>
>>>>root
>>>>
>>>>
>>>>>hub, and disable the root hub, i could schedule this with the task
>>>>
>>>>scheduler
>>>>
>>>>
>>>>>to start and stop when i wanted.
>>>>>
>>>>>Unfortunatly i have no idea how to use C++ coding. Is the script to do wat
>>>>
>>>>i
>>>>
>>>>
>>>>>want something hard or what? Could some body either point me in a
>>>>
>>>>direction
>>>>
>>>>
>>>>>or write a script if its not hard?
>>>>>Any help, alternatives, or advice much appriciated
>>>>>Thanks heaps
>>>>>Ice
>>>>
>>>>
>>>>
>>