Jump to content

Mouse click help


Recommended Posts

HI all

I have been working at this for a little while (days) and although I am new to programing, I have made some progress ... although I seem to have hit the end of my meager abilities - or rather lack of ability.

Essentially, I am trying to write a script that will start a program and have it run for a few minutes pause the program, open a splash window - ALL THAT I HAVE DONE - NOW THE HARD PART

I then need AutoIt to wait for a mouse click. There isn't a message box involved, not buttons, doesn't matter where the cursor is - or even if there is one -

the mouse click is the "OK to continue" signal so to speak. Click the mouse and the loop repeats ... seems simple enough ... however I can not find out how to do what I am looking for

ANy help would be grreatly appreciated

TIA

Mike

Link to comment
Share on other sites

HI all

I have been working at this for a little while (days) and although I am new to programing, I have made some progress ... although I seem to have hit the end of my meager abilities - or rather lack of ability.

Essentially, I am trying to write a script that will start a program and have it run for a few minutes pause the program, open a splash window - ALL THAT I HAVE DONE - NOW THE HARD PART

I then need AutoIt to wait for a mouse click.  There isn't a message box involved, not buttons, doesn't matter where the cursor is - or even if there is one -

the mouse click is the "OK to continue" signal so to speak.  Click the mouse and the loop repeats ... seems simple enough ... however I can not find out how to do what I am looking for

ANy help would be grreatly appreciated

TIA

Mike

<{POST_SNAPBACK}>

You have posted this question before...

http://www.autoitscript.com/forum/index.ph...t=0entry80254

...and Burrup was kind enough to give you an answer...

Did that suggestion not work? Did you lose track of the post and never see Burrup's answer? Just curious as to what happened?

@Burrup (or anyone),

In case you join this thread - do you know if the "is pressed" UDF will detect mouse clicks... just as an alternative to the GUI solutions already offered in the outer post/thread.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I see you :(. Yep, it does. I believe its '01' for a left mouse click. Let me just dig up the rest of them :(.

Edit:

01 Left mouse button

02 Right mouse button

04 Middle mouse button

05 Windows 2000/XP: X1 mouse button

06 Windows 2000/XP: X2 mouse button

Edited by Burrup

qq

Link to comment
Share on other sites

@Burrup,

Thanks! I could not find the post that I was looking for via search.

@Cumberland Mike,

Burrup has provided a 3rd way to do what you asked about.

I finally found the post http://www.autoitscript.com/forum/index.ph...517entry63517

Let us know if you need help incorporating it into your script.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

You have posted this question before...

<snip ...>

Did that suggestion not work? Did you lose track of the post and never see Burrup's answer? Just curious as to what happened?

I apologize for that. I could not get the ideas Burrup passed along to work ... I took that to mean that I was not clear enough in explaining what I wanted ... and since threads move along the board so fast here I thought it would be best served to start a new thread with a clearer explanation. I certainly was at fault in not acknowledging Burrups input, it was an oversight.

I will try to get these new suggestions to work and post back here.

Thanks to all

Mike

Link to comment
Share on other sites

Ok ... I tried the Is_Pressed code and I am definately not getting something.... which doesn't surprise me I suppose. Here is what I have:

------------------------------------------------------------

run ("C:\Program Files\CyberLink\PowerDVD\PowerDVD.exe")

WinWaitActive("PowerDVD")

; "Enter" will start the movie - let it run for 2 secs

Send ( "{ENTER}" )

Sleep (2000)

; "space" will pause the movie

Send ( "{SPACE}" )

; here I want to wait for the mouseclick then start the movie again ("ENTER")

If _IsPressed('01') Then

Send ( "{ENTER}" )

EndIf

Func _IsPressed($HexKey)

Local $AR

$HexKey = '0x' & $HexKey

$AR = DllCall("user32","int","GetAsyncKeyState","int",$HexKey)

If NOT @Error And BitAND($AR[0],0x8000) = 0x8000 Then Return 1

Return 0

EndFunc

---------------------------------------------------

Then I want it to loop back to where it will time the seconds running ... then pause and wait for the click ... etc etc.....

So ... I can not find Is_Pressed help in AutoIt help, and I am sure that there are variables I need to set. I put the "Send ( {ENTER} )" in ...

If someone could take a look at what I wrote and guide me I would appreciate it.

Thanks to all again

Mike

Link to comment
Share on other sites

I usually stay with a topic for a couple days to see if any one has replied, often it takes many people that long :(.

The _IsPressed() function is a UDF and is not included in AutoIt 3, thats why its not in the help file. The only problem I can see with your code is a loop missing. I think this is what you wanted...

Run ("C:\Program Files\CyberLink\PowerDVD\PowerDVD.exe")
WinWaitActive("PowerDVD")

Send ( "{ENTER}" )

While 1
   Sleep (2000)
   Send ( "{SPACE}" )
   If _IsPressed('01') Then
      Send ( "{ENTER}" )
   EndIf
Wend

Func _IsPressed($HexKey)
   Local $AR
   $HexKey = '0x' & $HexKey
   $AR = DllCall("user32","int","GetAsyncKeyState","int",$HexKey)
   If NOT @Error And BitAND($AR[0],0x8000) = 0x8000 Then Return 1
   Return 0
EndFunc

qq

Link to comment
Share on other sites

@Mike,

Sorry - I did not mean to come across the way that I did... I was just curious as to why some people "double post" on one topic so soon. Now I know your reason. Thanks for the education and for tolerating my questions. BTW, you probably already know that adding a reply to your original post would have bumped it up to the top of the forum and given people two ways to read your request on the same page.

Only some User Defined Functions (UDFs) are included in the AutoIt software distribution and documentation. Many other UDFs can be found thru-out the forum.

[Thanks to the forum software's "Preview Post" button/feature, I see that Burrup posted a reply while I was composing this reply... we differ on what we think you want... so, my suggested code will look different. ...and yes, I started this reply about 10PM and it is now 2AM - what can I say, I'm slow.]

try this:

AutoItSetOption ("SendKeyDelay", 1) ;(milliseconds)

AutoItSetOption ("WinWaitDelay", 1) ;(milliseconds)

AutoItSetOption ("WinTitleMatchMode", 2)
;1-from the start, 2-any substring, 3-exact match

AutoItSetOption ("TrayIconDebug", 1) ;0-off

Run("C:\Program Files\CyberLink\PowerDVD\PowerDVD.exe")

While 1

  ; it is just me - I like these three lines of code
   WinWait("PowerDVD")
   WinActivate("PowerDVD")
   WinWaitActive("PowerDVD")

  ; "Enter" will start the movie - let it run for 2 secs
   Send("{ENTER}")
   Sleep(2000)

  ; "space" will pause the movie
   Send("{SPACE}")
   
  ; this part waits for the left mouse click and then continues the script
   While 1
      Sleep(1)
      If _IsPressed('01') Then ExitLoop
   WEnd

WEnd


Func _IsPressed($HexKey)
   Local $AR
   $HexKey = '0x' & $HexKey
   $AR = DllCall("user32","int","GetAsyncKeyState","int",$HexKey)
   If NOT @Error And BitAND($AR[0],0x8000) = 0x8000 Then Return 1
   Return 0
EndFunc

...and the script will "wait" for you to click the mouse - BUT -

coding like that *might* miss the mouse click if it happens during the 1 millisecond sleep. That sleep line was added to save the CPU loading. If the click is missed, you just click again. If you do not care about the CPU load - remove that sleep line and the CPU will be at or near 100%.

@ those that know more than I,

(and that would be quite a few in this forum) Could the manual mouse click be missed due to a 1 millisecond sleep line as shown in the code above or would a "normal/manual" left mouse click always produce an event longer than 1 millisecond and thus would never be missed by that "sleeping loop"? Just for fun, I tested the loop with a 1 second sleep and had fun seeing if I could just happen to click in between the sleeps. Hey, my first game, think that it will sell?

Also, have I steered Mike down the wrong path? I think that this UDF is easier to explain to a person new to AutoIt3, but Burrup's GUI solutions might not require a sleep line to reduce the CPU load and may never miss a click. (I can think of more things to question than I have time to test out - GUI users probably know this answer w/o testing the exact code.)

@Mike,

If you hang around the forum for long, you will see that I try and code exacty what was asked for and then I might suggest a different method of accomplishing the same task. Remember, all I have to go on is what I think that you want to do. I'm still not sure that I have the entire picture as you will see in my statements/questions below. My code above is what I think you asked for... "now for what I think that you need" , he said arrogantly :-)

You said,

"I then need AutoIt to wait for a mouse click.

There isn't a message box involved, ..."

Did you mean that there is not a message box from the DVD software or did you mean that you were playing the movie full screened and could not tolerate a message box from AutoIt (which would pause the script and wait for a mouse click on the OK button - but might cover part of the movie)? It might help if I had a clue as to why you want to pause a movie every 2 seconds... and maybe why "continue on click".

If you can tolerate a msgbox from AutoIt, then replace this section of code:

While 1
      Sleep(1)
      If _IsPressed('01') Then ExitLoop
   WEnd

...with this one line:

MsgBox(0,"AutoIt","Select OK to Continue.")

...and remove the _IsPressed UDF function.

Yet another option is to continue by pressing a Hotkey - see the help file...

Hope this helps - don't hesitate to restate your task to be scripted if I did not code what you need.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I'll be back!!

<{POST_SNAPBACK}>

The last suggestion from herewasplato seems to be doing whatr I need it to do. THanks so much. NOw ...

I need a way to exit the script. I have tried to simply add:

If _IsPressed('24') Then Exit

to exit the script with the home key in two places, once during the DVD run portion and once during the DVD pause. The instance during the pause works ... the other does not. I thought I would be OK with this since the UDF is already defined for another _ISPressed function that works perfectly.

The error I am getting is Line 44 "WEnd statement with no matching While" - but I seem to have 2 while's and 2 WEnd's .... ?

What I have so far is here

Any help would be appreciated.

Again ... thanks so much. I will repost other questions as they arise!

Mike

Edited by Cumberland Mike
Link to comment
Share on other sites

The error I am getting is Line 44 "WEnd statement with no matching While" - but I seem to have 2 while's and 2 WEnd's .... ?

<{POST_SNAPBACK}>

Even though the error msg mentions While/WEnd, the problem might be with this code:
If _IsPressed('24') Then 
       WinKill ("PowerDVD")
it should be:
If _IsPressed('24') Then 
       WinKill ("PowerDVD")
EndIf
or
If _IsPressed('24') Then WinKill ("PowerDVD")
I really should not make "single line If statements" for those new to AutoIt.

From the help file:

---If <expression> Then statement

---Remarks

---This version of the If statement is used to execute a single statement without the overhead of an EndIf.

Add the "EndIf" - or - make it all on one line - or - remove it. See below.

There are several little things that we need to address.

The HotKeySet within AutoIt will do what you are doing with _IsPressed('24'). For this script we would "set" the HotKey near the top and AutoIt will "watch for" that key... look at the example in the help file.

I would suggest that you remove both _IsPressed('24') parts and move toward code something like this:

AutoItSetOption ("SendKeyDelay", 1);(milliseconds)
AutoItSetOption ("WinWaitDelay", 1);(milliseconds)
AutoItSetOption ("WinTitleMatchMode", 2)
AutoItSetOption ("TrayIconDebug", 1);0-off

HotKeySet("{HOME}","Terminate")

; start the DVD player full screened
Run("C:\Program Files\CyberLink\PowerDVD\PowerDVD.exe","",@SW_MAXIMIZE)

; if the app window is not up in 3 minutes - WinWait returns 0
; if the app window comes up before then - the script continues
If WinWait("PowerDVD","",180) = 0 Then
  ;
  ; optional msgbox here
  ;
EndIf


; main loop
While 1
   Check_Window()
   Send("{ENTER}"); "Enter" will start the movie - let it run for 5 secs


  ; this loop replaces the larger sleep line and allows the script
  ; to keep checking to see if the user has closed the DVD player
   $timer = TimerInit()
   Do
      If WinExists("PowerDVD","") = 0 Then Terminate()
      Sleep(1)
   Until (TimerDiff($timer) > 5000)


   Check_Window()
   Send("{SPACE}")  ; "space" will pause the movie

   
  ; this part waits for the left mouse click and then continues the script
   While 1
      Sleep(1)
      If _IsPressed('01') Then ExitLoop
      If WinExists("PowerDVD","") = 0 Then Terminate()
   WEnd
WEnd

Func _IsPressed($HexKey)
   Local $AR
   $HexKey = '0x' & $HexKey
   $AR = DllCall("user32","int","GetAsyncKeyState","int",$HexKey)
   If NOT @Error And BitAND($AR[0],0x8000) = 0x8000 Then Return 1
   Return 0
EndFunc 

Func Check_Window()
  ; always want to be sure that the window exists and
  ; is active before sending keys to it and
  ; offer to exit if the user has closed the DVD player
   If WinExists("PowerDVD","") = 0 Then Terminate(); win exist or exit
   WinActivate("PowerDVD"); try to activate win
   If WinWaitActive("PowerDVD","",1) = 0 Then
     ; window failed to activate - what would you like to do - exit?
   EndIf
EndFunc 

Func Terminate()
  ;we can add a msgbox here confirming the desire to exit
  ;and depending on the answer - exit or return to the main loop
   Exit
EndFunc

If the DVD player is closed - the script should exit.

If the Home key is pressed - the script should exit.

I assume the the Home key is not a button that the person watching the movie would have access to.

I would try WinClose and if that fails WinKill - either or both could be included inside of the "Terminate" function.

You mentioned a splashscreen?

later

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Even though the error msg mentions While/WEnd, the problem might be with this

<snip>

You mentioned a splashscreen?

later

<{POST_SNAPBACK}>

Thanks for the reply. First off is there a way to learn this stuff ... a programming for dummies kind of thing or does it simply take training and time? Seems to me that when I see your code and think about it for a while it starts to make sense ... but I can't seem to get from here to there on my own....

As for a splashscreen I was thinking of having an animated gif pop-up while the DVD is paused showinga hand hitting a button - to prompt my son to do the same. The DVD pauses .... animated gif pops up ... Brett hits the button ... pop-up goes away ... dvd window still on top & maximized ... movie starts ... back into loop.

I haven't played with this yet myself ... actually starting some construction on my home to give my sone his own handicapped accassable area...

I also changed waiting for a left click of the mouse to waiting for an "ENTER" signal ... and then set my sons button to deliver that input. That is working a lot beter ... much more predicatble and snmooth ... but it also illustrates how I need to learn to thinkabout this programing stuff ... the DVD program is looking for an ENTER ... and instead I was giving it a mouse click and changing that to ENTER with programing... kind of crazy I think now ... if the DVD is looking for an ENTER - why not give it one!! WOrks great

THanks for all your time!

Just curious - where are you from. We are in CUmberland, northeast corner of Rhode ISland..

Thanks agin

Mike

Link to comment
Share on other sites

You are welcome.

I'm sure that others in the forum can suggest things that you could read - perhaps even online - but I ain't never had no book learnin' (and it shows in my code).

As far as getting from here to there on your own, just give it time. "Making sense" out of code in this forum is a good way to learn - I won't hold mine up as exemplary, but I will say that my code is usually simple - as I am simple-minded :-)

You said that you moved from "click to continue" to the enter key.

Did you do so using a hotkey/function or did you just change:

If _IsPressed('01') Then ExitLoop

to

If _IsPressed('0D') Then ExitLoop

?

The "IsPressed function" passes the key (or click) on to the application that is "in focus" at the time. The hotkeys are trapped by AutoIt and the application will not see that key unless you want it to. Also, AutoIt "watches for" hotkeys throughout the script. The "IsPressed function" is being "watched for" only during the loop that contians it. [There is also a way to have AutoIt "watch for" the "IsPressed function" throughout the script via the Adlib function... though I have had very little experience with that function.]

Take some time.

Think thru your options.

Read the help file on hotkeys and Adlib.

Think about what your DVD software (SW) will do if someone presses enter, enter, enter...

Can you live without the "home" key while the script is running? Remember, AutoIt is not going to let you send the "home" key to any application while this script is running - unless you change the code to let it do so.

======

The suggestions that follow are for certain types of humans:

Now that you have a script in your head (i.e. you know what you want a script to do and you know a bit about the code that might do it) read thru the entire help file. Remember, you do not have to understand each function - or even have a clue how you could ever make use of it - just read it. Then someday, you will think, "I remember something about a function that will do.....???" [Then you will madly search the help file, never find the function and throw your computer out of the window... or better yet, post your inquiry to this forum - starting off with the fact that you have read and searched the help file.]

Other humans do not learn as described above. Reading stuff that they do not understand will only frustrate and discourage them - and they quit.

If you do not already know the type of human that you are - try reading the help file and find out :-) :-) :-)

======

If you think that you will be using AutoIt for other scripts, you might want to visit this web page:

http://www.autoitscript.com/autoit3/scite/

...If you have not already done so...

Where I be from?

[Edit: answer removed so I can hide :-)]

Clear as mud?

Edited per someone's suggestion.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

You said that you moved from "click to continue" to the enter key.

Did you do so using a hotkey/function or did you just change:

If _IsPressed('01') Then ExitLoop

to

If _IsPressed('0D') Then ExitLoop

I just changed the '01 to an '0D' ... seems to be working great. Interesting about the _IsPressed only watching while in the loop versus te hotkeys ... but right now I think that it is OK for that function. To exit the program I will need to use a hotkey so it watches for it the whole time.

Hopefully over this weekend - and maybe right now - I will get to experiment a bit with your latest suggestions. As always - thanks again.

I have cousins in Texas ... they love it .... they're in Dallas actually, which sounds like a great place if you can see past thier football team :( ... actually I think they live in a place called Highland Park .... of course having more money than God himself must help.

Thanks again

Mike

Link to comment
Share on other sites

Hi again

Well I learned a lot.. thank you. I played with the code added things ... just for the sake of adding things mostly ... but anyway here is a working version.

AutoItSetOption ("SendKeyDelay", 1);(milliseconds)
AutoItSetOption ("WinWaitDelay", 1);(milliseconds)
AutoItSetOption ("WinTitleMatchMode", 2)
AutoItSetOption ("TrayIconDebug", 1);0-off

HotKeySet("{HOME}","Terminate")

WinMinimizeAll()

;install files for splash & picture
  FileInstall("C:\work\logo.jpg", @TempDir & "\logo.jpg");source must be literal string
  FileInstall("C:\work\mission.wav", @TempDir & "\mission.wav") 
  FileInstall("C:\work\button.jpg", @TempDir & "\button.jpg")
  FileInstall("C:\work\unusual.wav", @TempDir & "\unusual.wav")

;Welcome splash screens
   SoundSetWaveVolume(100)
   SplashImageOn ( "", "c:\work\logo.jpg" ,600 ,400,-1, -1, 1)
   SoundPlay ( "c:\Work\mission.wav")
   Sleep(5500)
   SplashOff()
   Sleep(1000)

;Message box to continue
   MsgBox(262176, "Overview", "This program will automatically start the DVD program and movie." & @crlf & @crlf & "After a chosen number of seconds, the movie will automatically pause. To restart the movie" & @crlf & "it will be necessary to activate the input switch configured to send an ENTER signal." & @crlf & @crlf & "To exit the program and close the DVD player hit the HOME key at any time.")


;ask for number of seconds for movie to run
 While 1
    Sleep(500)
    $secs = InputBox("Timing", "Enter the number of seconds you would like the movie to run for before pausing and waiting for user input." & @crlf & @crlf & "The default is 90 seconds." & @crlf & @crlf & "Selecting CANCEL will exit the program", "90", " M3",400,200,-1,-1,30)
    $milisecs = $secs*1000
    If @ERROR = 1 Then Terminate()
    $ans = MsgBox(1, "Confirmation", "The DVD will run for " & $secs & " seconds." & @crlf & @crlf & "Select OK to continue or CANCEL to change the number of seconds")
    If $ans = 1 Then ExitLoop
 WEnd

; start the DVD player full screened
   Run("C:\Program Files\CyberLink\PowerDVD\PowerDVD.exe","",@SW_MAXIMIZE)

; if the app window is not up in 60 seconds - WinWait returns 0
; if the app window comes up before then - the script continues
   If WinWait("PowerDVD","",60) = 0 Then
     MsgBox(48, "Utter Failure", "DVD application has failed to start.  Script will be terminated")
     WinKill("PowerDVD")
     Terminate() 
    ;
    ; optional msgbox here
    ;
   EndIf


; main loop
While 1
   Check_Window()
   Send("{ENTER}"); "Enter" will start the movie - let it run for $secs


 ; this loop replaces the larger sleep line and allows the script
 ; to keep checking to see if the user has closed the DVD player
   $timer = TimerInit()
   Do
      If WinExists("PowerDVD","") = 0 Then Terminate()
      Sleep(1)
   Until (TimerDiff($timer) > $milisecs)
   Check_Window()
   Send("{SPACE}") ; "space" will pause the movie

  ;Calls a picture of the button to hit to activate the movie again
  SplashImageOn ( "", "c:/work/button.jpg" ,550,400,-1, -1, 1)
   
   
 ; this part waits for the left mouse click and then continues the script
   While 1
      Sleep(1)
      If _IsPressed('0D') Then ExitLoop
      If WinExists("PowerDVD","") = 0 Then Terminate()
   WEnd

  SplashOff()
WEnd

Func _IsPressed($HexKey)
   Local $AR
   $HexKey = '0x' & $HexKey
   $AR = DllCall("user32","int","GetAsyncKeyState","int",$HexKey)
   If NOT @Error And BitAND($AR[0],0x8000) = 0x8000 Then Return 1
   Return 0
EndFunc 

Func Check_Window()
 ; always want to be sure that the window exists and
 ; is active before sending keys to it and
 ; offer to exit if the user has closed the DVD player
   If WinExists("PowerDVD","") = 0 Then Terminate(); win exist or exit
   WinActivate("PowerDVD"); try to activate win
   If WinWaitActive("PowerDVD","",1) = 0 Then
    ; window failed to activate - what would you like to do - exit?
   EndIf
EndFunc 

Func Terminate()
 ;we can add a msgbox here confirming the desire to exit
 ;and depending on the answer - exit or return to the main loop
   If WinExists("PowerDVD","") = 1 Then WinKill("PowerDVD")
   SoundSetWaveVolume(100)
   SoundPlay("c:\Work\unusual.wav",1)
   sleep(1000)
   WinMinimizeAllUndo ( )
   Exit
EndFunc

We are working with my sone to teach him to use it and we are very encouraged - Thanks again to all who helped.

More questions though ....

Is it possible to query the registry (?) to determine the default DVD program (for example) on a computer? I am thinking that I could further automate the process, and pass the script out to people, if AutoIT could find the program in question by itself. Can you please get me pointed towards the correct info?

Can I use the FileInstall to install something like Acrobat Reader, or a PowerPoint viewer if I needed to display one of those types of files?? ... or is there a limit on what can be installed?

There was a suggestion to develop my own GUI for a more customized message box ... where can I learn the basics of doing this? I'm finding it a bit confusing....

Thanks again

Mike

Link to comment
Share on other sites

Looks great. Good additions.

I like the WinMinimizeAll() and the "undo" upon terminate.

Just a few comments:

Minor - There is no need to do a file install each time you run the script.

You might want to look into

If FileExists(some file here) = 0 Then FileInstall......

If the file is still in the temp directory - then just use it.

(However, if you fear that someone might replace the file in the temp folder with something that you had not intended to play/show, you could perform more checks than mentioned above or just install it each time like your current code does.)

Major - You are not "using" the file from the location that you "installed" it to.

I think that your first complied/distributed copy might fail due to this.

FileInstall("C:\work\mission.wav", @TempDir & "\mission.wav") 
......
SoundPlay ( "c:\Work\mission.wav")
Sleep(5500)
Also, you might consider using the flag of "1" for SoundPlay instead of the sleep statement that you have.

1 = wait until sound has finished

Really minor thing - You might want to use "_" for things like the long msgbox. Mostly for your ease in coding.

MsgBox(262176, "Overview", "text here" & @CRLF &_
                           "text here" & @CRLF &_
                           "text here" & @CRLF &_
                           "text here")
Related comment - I've never had the need for GUI - but before GUI was an option, I wrote some scripts that had "Overview" info like yours. I used SplashTextOn where I could select fonts and window positions. I used a simple "OK" msgbox to pause the script to allow the user to read the "Overview". If you use GUI, SplashTextOn or for your input box size, you might want to consider using code that will adjust for different screen resolutions.

(@DesktopWidth-400)/2, (@DesktopHeight-200)/2)

caveat - "-400" and "-200" are just examples

If SplashTextOn is not to your liking the perhaps others can suggest a place to start learing GUI - I do not know where to point you for that.

hardly worth pointing out: milisecs is spelled millisecs

As far as giving this code to others and attempting to locate the DVD software that they might be using: If you want the script to launch the default DVD software for all installations, then you might consider code that will use an INI file. Make one script for "setup" and one for "running". The setup script would ask the user for the path to the DVD software and the keys needed to start/pause the DVD software.

Some people use different DVD software for different DVD file formats. They would need a way to "setup" your other script to use the software desired. Also, some computers are setup to play the DVD as soon as it is loaded into the drive. What happens if someone already has the DVD software running when they launch your script. Does the DVD software reuse an existing window or might some software open another window - then you have mulitple window titles do deal with. When your script issues a WinActivate("PowerDVD"), which window will it activate if there is more than one window with that title. All things to think about.

Another problem that I do not have a solution for: what window tittle to use in the "Win" lines of code? You could have the user start the DVD software and tell you what part of the title is there during all movies, but that would be messy. There is a WinGetTitle function, but I'm not sure how to make use of it in this case. Maybe others in the forum have a solution to this issue. One-size-fits-all is hard to code for.

You can install Acrobat Reader or a PowerPoint viewer via FileInstall, but I would not be happy if you did so on my system since I already have software for both of those functions. Others in the forum might be able to point you to something within the regisrty to allow you to check and see if there is a default handler for the PDF, PPT, ... extensions, I cannot. Also, this would make your tiny script huge. Each person downloading your script would be downloading the 20 meg Acrobat Reader even if they did not need it. (Yes, there are other ways to have the script offer to install Acrobat Reader without using FileInstall, but that is for another post.)

I've not poured over each line, but if it works as written, then great.

If you are using the SciTe editor, then look under the Tools menu for SyntaxCheck and Tidy.

got to run

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Looks great. Good additions.

<snip>

got to run

<{POST_SNAPBACK}>

Thanks for the reply .... I was greatly appreciated. There are certainly a lot of things I need to learn to think about ... thats for sure! Some of that stuff never even occurred to me. Thanks for all the info. I will let you know about any progress I make.

I haven't started with SciTe yet - but may do so tonight.

Thanks again,

Mike

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...