Jump to content

Using Splashtexton and Controlsettext in exe


Recommended Posts

I hate when that happens, had a whole thing typed out, forgot to copy it and accidently clicked on a link. Ok to try this again.

I am using a compiled splashtxt box in some of my vbscripts (see below for au3 code). This only uses the splashtexton command and will flash everytime I call it, which is no issue for my uses. Now, one of our network admins is looking at using it in conjucntion with a login script, displaying the status of mapped drives. What I am trying to find out is this, is it possible to call my exe with my window settings and text. then the next time call it with only the message text and in that instance, instead of using splashtexton use ControlSetText.

Below is my au3 file and vbscript command to call the exe.

Any help would be appriciated.

Mike

WshShell.Run "SplashText.exe ""This is the Title"" ""Testing SplashText"" " & "300 150 50 50 16 -1 -1"

;splash.au3 precomplie

AutoItSetOption("TrayIconHide", 1);1 = Hide Icon

winclose("Splashtext1");close other progress bar and show this one

AutoItWinSetTitle ("Splashtext1")

If $CmdLine[0]>0 Then

$title= $CmdLine[1]

$message= $CmdLine[2]

$wide = $CmdLine[3]

$high = $CmdLine[4]

$xpos = $CmdLine[5]

$ypos = $CmdLine[6]

$opt = $CmdLine[7]

$fsize = $CmdLine[8]

$fweight = $CmdLine[9]

$message2 = StringReplace($message, "^", @LF)

SplashTextOn($title, $message2, $wide, $high, $xpos, $ypos, $opt, "", $fsize, $fweight)

While 1

Sleep(5000)

wend

EndIf

Link to comment
Share on other sites

  • Developers

This function will display a splashWindow and update it after it is shown...

;=================================================
; Show Splash screen or update its content
;=================================================
Func ShowMenu($msg)
   $W_Title="Title......"
   If WinExists($W_Title) Then
      ControlSetText($W_Title,"","Static1",$msg)
   Else
      SplashTextOn($W_Title,$msg,500,350,1,1,6,"Courier",10,600)
   EndIf
   Return 0
EndFunc

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks, just what I was looking for. now I am having trouble getting the exe to close. Could you check out what I have and let me know what I am doing wrong.

Thanks,

Mike

;splash.au3 precomplie

AutoItSetOption("TrayIconHide", 1);1 = Hide Icon

AutoItWinSetTitle ("Splashtext1")

If $cmdline[0]=0 then

Splashoff()

;winclose("Splashtext1");close other progress bar and show this one

ElseIf $CMDline[0]=2 then

$title= $CmdLine[1]

$message= $CmdLine[2]

ControlSetText($title,"","Static1",$message)

ElseIf $CmdLine[0]>0 Then

$title= $CmdLine[1]

$message= $CmdLine[2]

$wide = $CmdLine[3]

$high = $CmdLine[4]

$xpos = $CmdLine[5]

$ypos = $CmdLine[6]

$opt = $CmdLine[7]

$fsize = $CmdLine[8]

$fweight = $CmdLine[9]

$message2 = StringReplace($message, "^", @LF)

SplashTextOn($title, $message2, $wide, $high, $xpos, $ypos, $opt, "", $fsize, $fweight)

While 1

Sleep(5000)

wend

EndIf

Link to comment
Share on other sites

  • Developers

Thanks, just what I was looking for.  now I am having trouble getting the exe to close.  Could you check out what I have and let me know what I am doing wrong.

Thanks,

Mike

<{POST_SNAPBACK}>

Heres your code after running Tidy.... have a look at the end.... theres a While1... Wend loop.... :ph34r:

;splash.au3 precomplie
AutoItSetOption("TrayIconHide", 1);1 = Hide Icon

AutoItWinSetTitle("Splashtext1") 

If $CMDLINE[0] = 0 Then
   SplashOff()
  ;winclose("Splashtext1");close other progress bar and show this one
ElseIf $CMDLINE[0] = 2 Then
   $TITLE = $CMDLINE[1]
   $MESSAGE = $CMDLINE[2]
   ControlSetText($TITLE, "", "Static1", $MESSAGE)
ElseIf $CMDLINE[0] > 0 Then
   $TITLE = $CMDLINE[1]
   $MESSAGE = $CMDLINE[2]
   $WIDE = $CMDLINE[3]
   $HIGH = $CMDLINE[4]
   $XPOS = $CMDLINE[5]
   $YPOS = $CMDLINE[6]
   $OPT = $CMDLINE[7]
   $FSIZE = $CMDLINE[8]
   $FWEIGHT = $CMDLINE[9]
   $MESSAGE2 = StringReplace($MESSAGE, "^", @LF) 
   SplashTextOn($TITLE, $MESSAGE2, $WIDE, $HIGH, $XPOS, $YPOS, $OPT, "", $FSIZE, $FWEIGHT)
   While 1
      Sleep(5000)
   Wend
EndIf
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I wish that I would remember to add comments when I am working on things to remember why I did something. I took out the while/wend and the splash window would just flash on the screen. Will need to find out why that is happening.

But, I am still having the problem of getting the window to close. Wouldn't splashoff close the splashtext window? I decided to try this:

If $CMDLINE[0]= 0 Then

MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)

The message box does pop up so I know that this part is working, I just can't seem to get the window to close.
Link to comment
Share on other sites

  • Developers

I wish that I would remember to add comments when I am working on things to remember why I did something.  I took out the while/wend and the splash window would just flash on the screen.  Will need to find out why that is happening.

But, I am still having the problem of getting the window to close.  Wouldn't splashoff close the splashtext window?  I decided to try this:

The message box does pop up so I know that this part is working, I just can't seem to get the window to close.

<{POST_SNAPBACK}>

I get the impressiopn you are trying to close a splash window of another script.

The script will not close a SplashWindow of another script or script instance. It can only close its own splashwindow with SplashOff.

You could try the normal Win??? commands and see if that works...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I get the impressiopn you are trying to close a splash window of another script.

No, I am trying to close the splash window that I opened originally. Before I started to make the changes to add in controlsettext I had the WinClose command at the top, this worked perfectly when I called the exe with no commandline. Once I made the change, I had to remove that line to allow for the controlsettext command to work. I am now trying to get the splashtext window that I open to close. I can probably just kill the process but am not sure that this is the best way to go.

Thanks again for your help,

Mike

Link to comment
Share on other sites

So far I have tried, Winclose("splashtext1"), Winkill("splashtext1"), Splashoff(), and ProcessClose("splashtest.exe"). The processclose method has been the only sucessful way to close the splash window. Since that works I guess I will be going with it. But I am just wondering why the other methods did not work.

Thanks for all your help,

Mike

Link to comment
Share on other sites

  • Developers

So far I have tried, Winclose("splashtext1"), Winkill("splashtext1"), Splashoff(), and ProcessClose("splashtest.exe").  The processclose method has been the only sucessful way to close the splash window.  Since that works I guess I will be going with it.  But I am just wondering why the other methods did not work.

Thanks for all your help,

Mike

<{POST_SNAPBACK}>

Mike, could you post your script so we can see whats happening.

Normally when you start the splashwindow in your script you also must me able to close it with SplashOff()...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Sorry for taking so long to replay, and thanks for the assistance on the script, this is what I have.

Here is the command line that I use in VBscript to call the compiled autoIT script.

WshShell.Run "SplashText.exe ""This is the Title"" ""Testing SplashText"" " & "300 150 50 50 16 -1 -1"

Subsequent calls to update window with no flash:

WshShell.Run "SplashText.exe ""This is the Title"" ""Testing SplashText"" "

Here is the AutoIT script.

;splash.au3 precomplie

AutoItSetOption("TrayIconHide", 1);1 = Hide Icon

AutoItWinSetTitle ("Splashtext1")

If $cmdline[0]=0 then

;Below you can see what I tried to close the window.

   ProcessClose("splashtest.exe")

;  Splashoff()

;  winclose("Splashtext1");close other progress bar and show this one

ElseIf $CMDline[0]=2 then

   $title= $CmdLine[1]

   $message= $CmdLine[2]

   ControlSetText($title,"","Static1",$message)

ElseIf $CmdLine[0]>0 Then

   $title= $CmdLine[1]

   $message= $CmdLine[2]

   $wide = $CmdLine[3]

   $high = $CmdLine[4]

   $xpos = $CmdLine[5]

   $ypos = $CmdLine[6]

   $opt = $CmdLine[7]

   $fsize = $CmdLine[8]

   $fweight = $CmdLine[9]

   $message2 = StringReplace($message, "^", @LF)

   SplashTextOn($title, $message2, $wide, $high, $xpos, $ypos, $opt, "", $fsize, $fweight)

While 1

   Sleep(5000)

wend

EndIf

Edited by mbouchard
Link to comment
Share on other sites

  • Developers

Sorry for taking so long to replay, and thanks for the assistance on the script, this is what I have.

Here is the command line that I use in VBscript to call the compiled autoIT script.

Here is the AutoIT script.

<{POST_SNAPBACK}>

Try this version..

The window will close when you just specify the windowtitle without any parameter... (see below test autoit script...

;splashtest.au3 precomplie
AutoItSetOption("TrayIconHide", 1);1 = Hide Icon

If $cmdline[0]=1 then
  ; close the window
   $title= $CmdLine[1]
   WinClose($title)
ElseIf $CMDline[0]=2 then
   $title= $CmdLine[1]
   $message= $CmdLine[2]
   ControlSetText($title,"","Static1", $message)
ElseIf $CmdLine[0]>0 Then
   $title= $CmdLine[1]
   $message= $CmdLine[2]
   $wide = $CmdLine[3]
   $high = $CmdLine[4]
   $xpos = $CmdLine[5]
   $ypos = $CmdLine[6]
   $opt = $CmdLine[7]
   $fsize = $CmdLine[8]
   $fweight = $CmdLine[9]
   $message2 = StringReplace($message, "^", @LF) 
   SplashTextOn($title, $message2, $wide, $high, $xpos, $ypos, $opt, "", $fsize, $fweight)
   $s_title = $title
  ; loop till window is closed
   While WinExists($title)
      Sleep(50)
   wend
EndIf

run("SplashTest.exe ""This is the Title"" ""Testing SplashText1"" 300 150 50 50 16 -1 -1")
sleep(2000)
run("SplashTest.exe ""This is the Title"" ""Testing SplashText2""")
sleep(2000)
run("SplashTest.exe ""This is the Title""")

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

JDeB,

Thank you for your assistance on this, it is now working for me. I do have a couple questions though.

1) what is this code used for?

$s_title = $title

2) Why didn't splashoff() work? I thought that close an open window was what it was supposed to do.

3) Is there any way to programatically retrieve the window title?

Thanks again for all your help,

Mike

Link to comment
Share on other sites

  • Developers

JDeB,

Thank you for your assistance on this, it is now working for me.  I do have a couple questions though.

1) what is this code used for?

$s_title = $title
Was going a different avenue there... forgot to remove it...just delete it...

2) Why didn't splashoff() work?  I thought that close an open window was what it was supposed to do.

SplashOff() only works in the original script... which is in a loop sleeping until you signal it to close...

You have to realise that you are running everytime a new instance of this program. only the first one stays open

3) Is there any way to programatically retrieve the window title?

Thanks again for all your help,

Mike

<{POST_SNAPBACK}>

You set it in your program so what would you want to do here ?

Do you mean you only want to specify it once and save it ?

If so... that could be done for example with an INI file ...

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

You set it in your program so what would you want to do here ?

Do you mean you only want to specify it once and save it ?

If so... that could be done for example with an INI file ...

Just wondering on this, was just trying to make it a little idiot proof. Things I normally work on are for our helpdesk, so...

Thanks again for all your help on this, it is now working as needed here.

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...