Jump to content

Need some help setting GUIctrl's to variables...


Go to solution Solved by BrewManNH,

Recommended Posts

OK, so please, please, please bear with me... Today is LITERALLY the first day I've ever messed with AutoIt. I had heard about it, never used it. I'm not a programmer, I'm a small time web developer (meaning I know CSS, HTML, and barely enough PHP to get by), so the theory and structure is familiar...-ish....

I've got just about everything down pat with my little script... it's design is to take user input and generate a file and then launch Outlook with the ImportPRF switch importing that file into the existing Outlook profile (eliminating the need to create another POP3 account, since my organization disables PST files by GPO).

I've got everything set up right (I think), but when I do this:

filewrite("C:\Temp\File.txt", $string & @CRLF)
filewrite("C:\Temp\File.txt", $another-string & @CRLF)
filewrite("C:\Temp\File.txt", $a-third-string & @CRLF)

I do not get the anticipated values of the strings.... In fact, the only string that behaves as it should is the one I set manually with an If-ElseIf-Then statement.

What I want it to do (and it's very clearly commented) is this:

it opens, if outlook is open, closes it. it asks 2 questions (the answers are to be set as strings), one is a text box, one is a radio selection. It finds the path of Outlook.exe and sets that as $path.

Then, a user clicks the big, obnoxiously obvious button and it sets the answers as strings, outputs some manual text and the string answers to file, and launches:
 

$path\outlook.exe /importprf C:\Temp\outputted_text.txt    ;---obviously better coded in the script

I just dont know how to do it. I've Google'd my brains out trying to find the answer, but it's just way more complicated than I can do...

Any help guys???

Here's my complete source:

 

#include <GUIConstantsEx.au3>

;---Create the gui layout and brand it as such

GUICreate("Voicemail to Outlook 2010 Migration Tool", 600, 600)
GUISetIcon("C:\Apps\mhk.ico")
GUICtrlCreatePic("C:\Apps\mhk.jpg",20,20,100,100)
GUICtrlCreatePic("C:\Apps\mhk.jpg",480,20,100,100)
GUISetBkColor(0xffffff) 
GUISetState(@SW_SHOW)
GUISetFont(15, 800)
GUICtrlCreateLabel("Voicemail Migration Tool", 180, 25)
GUISetFont(12, 400)
GUICtrlCreateLabel("This allows users to setup Outlook 2010", 160, 60)
GUICtrlCreateLabel("to receive voicemails in their inbox.", 180, 75)
GUICtrlCreateLabel("________________________________________________________", 50, 120)

;---Start polling for information...
   ;---Text input

GUISetFont(12, 400)
GUICtrlCreateLabel("Please enter your voicemail extension:", 35, 155)
$voiceMail = GUICtrlCreateInput("", 310, 153, 75, 25)

   ;---Radio Buttons!!!

GUICtrlCreateLabel("Choose your VoiceMail server:", 35, 188)
$svrRadio = GUICtrlCreateRadio("CHG", 265, 185)
$svrRadio = GUICtrlCreateRadio("DAL", 265, 215)

;---Now, let's see what our working directory will be...

If FileExists("C:\Program Files (x86)\Microsoft Office\Office14\outlook.exe") Then
   GUISetFont(12, 600)
   dim $path = "C:\Program Files (x86)\Microsoft Office\Office14"
   GUICtrlCreateLabel("Detected 32 bit Outlook 2010 on 64 bit Windows", 35, 270)
   GUICtrlSetColor(-1, 0x0000fA)
   
      ElseIf FileExists("C:\Program Files\Microsoft Office\Office14\outlook.exe") Then
         GUISetFont(12, 600)
         dim $path = "C:\Program Files\Microsoft Office\Office14"
         GUICtrlCreateLabel("Detected 32/64 bit Outlook 2010 on 32/64 bit Windows", 35, 270)
         
            ElseIf FileExists("C:\Program Files (x86)\Microsoft Office 15\root\office15\outlook.exe") Then
               GUISetFont(12, 600)
               dim $path = "C:\Program Files (x86)\Microsoft Office 15\root\office15"
               GUICtrlCreateLabel("Detected 32 bit Outlook 2013 on 64 bit Windows", 35, 270)
               
                  ElseIf FileExists("C:\Program Files\Microsoft Office 15\root\office15\outlook.exe") Then
                     GUISetFont(12, 600)
                     dim $path = "C:\Program Files\Microsoft Office 15\root\office15"
                     GUICtrlCreateLabel("Detected 32/64 bit Outlook 2013 on 32/64 bit Windows", 35, 270)


;---Just in case the user has Office installed in a non %programfiles% location
                     
                  Else 
                     GUISetFont(14, 900)
                     GUICtrlCreateLabel("Unable to detect installed Windows/Outlook version.", 35, 270)
                     GUICtrlSetColor(-1, 0xff0000)
                     GUISetFont(12, 400)
                     GUICtrlCreateLabel("Please copy and paste the path that contains outlook.exe in the box below.", 35, 300)
                     $path = GUICtrlCreateInput("", 35, 320, 535, 25)
EndIf

;---Let them know what it is we're running (like they really care...)

If IsDeclared($path) Then
   GUICtrlCreateLabel("Executing " & $path & "\outlook.exe", 35, 360)
   GUICtrlCreateLabel(" /importprf c:\temp\voicemail.txt", 45, 390)
EndIf

;---Make sure they've never tried the migration before. And if they have, KILL IT WITH FIRE!!!

If FileExists("C:\Temp\Voicemail.txt") Then
   GUICtrlCreateLabel("Deleting previously used Migration Settings", 45, 400)
   FileDelete("C:\Temp\Voicemail.txt")
EndIf

;---Pretty, pretty button. Once clicked, it SHOULD set all the selections to their assigned strings and then execute the command

GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)

;--This alerts whether Outlook is actively running or not and kills it if it is.
   ;---It appears at the top, but was loading before all the other stuff, and it didn't look as neat that way
   
If ProcessExists('outlook.exe') Then
      $outlook_open = MsgBox(0,'Outlook is still running!','Press Ok to close Outlook automatically. You may save any open documents that you have before clicking OK.')
      ProcessClose('outlook.exe')
      Sleep(2000)
         If Not ProcessExists('outlook.exe') Then
            GUISetFont(13, 800)
            GUICtrlCreateLabel("Outlook is not running. We may continue.", 140, 100)
            GUICtrlSetColor(-1, 0x00af00)
         Else
            
            GUISetFont(13, 800)
            GUICtrlCreateLabel("Unable to close Outlook. Quitting in 10 seconds.", 110, 100)
            GUICtrlSetColor(-1, 0xff0000)
            Sleep(10000)
            Exit
         EndIf
   Else
      GUISetFont(13, 800)
      GUICtrlCreateLabel("Outlook is not running. We may continue.", 140, 100)
      GUICtrlSetColor(-1, 0x00af00)
   EndIf

;---This is what we want to execute AFTER the strings have been set upon button pressing

FileWrite("c:\temp\migrate_voicemail.txt", "some things here:" & $voicemail & @CRLF)
FileWrite("c:\temp\migrate_voicemail.txt", "some more things here:" & $chgRadio & @CRLF)
FileWrite("c:\temp\migrate_voicemail.txt", "even more things here:" & $dalRadio & @CRLF)

;---Launches Outlook and imports our generated text file into the already existing Outlook profile, eliminating the need for a 2nd profile/PST

Run(@comspec & ' c/ start' & '"' & $path & '\outlook.exe /importpfr c:\temp\migrage_voicemail' & "'", @SW_HIDE)

;---The following part seemed pretty important in the tutorial, so I'm going to leave it here....

While 1
   $msg = GUIGetMsg()
   
   ;---I think this allows you to close the window using the little red 'X'...
   
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
   EndSelect
WEnd

And a screenshot of how it looks :D

FJZAuOo.png

Any help would be appreciative...

Link to comment
Share on other sites

when i do this:
 

FileWrite("C:\Temp\File.txt",  GUICtrlRead($voiceMail) & @CRLF)
FileWrite("C:\Temp\File.txt",  GUICtrlRead($svrRadio) & @CRLF)
FileWrite("C:\Temp\File.txt",  GUICtrlRead($path) & @CRLF)

I get this:

4

 

but when I do this:
 

FileWrite("C:\Temp\File.txt", $voiceMail & @CRLF)
FileWrite("C:\Temp\File.txt", $svrRadio & @CRLF)
FileWrite("C:\Temp\File.txt", $path & @CRLF)

i get this:

10
13
C:\Program Files (x86)\Microsoft Office\Office14

in the part of my code that states

GUICtrlCreateLabel("Please enter your voicemail extension:", 35, 155)
$voiceMail = GUICtrlCreateInput("", 310, 153, 75, 25)

   ;---Radio Buttons!!!

GUICtrlCreateLabel("Choose your VoiceMail server:", 35, 188)
$svrRadio = GUICtrlCreateRadio("CHG", 265, 185)
$svrRadio = GUICtrlCreateRadio("DAL", 265, 215)

I think the problem is, even though I'm defining the strings $voiceMail and $svrRadio, I'm pretty sure I'm doing it wrong... There needs to be a an action take that takes the input (the text from the input box piped to the $voiceMail string and the selection of which radio button piped to the $svrRadio string.

That's the part I'm having trouble with. Creating a function that on the click of my button, assigns the given strings, outputs the given text and string contents into C:TempFile.txt, and executes "$pathoutlook.exe /importprf C:TempFile.txt".

the filewrite part of my script is behaving exactly as it should, it just needs to be located in the button function and needs the strings set at the correct values.

And I'm not looking for somebody to just write it up for me... I would like to actually learn it, would love to see how my scenario is done and explained n00b style. I'm just all Google'd out and dont know where else to look...

Link to comment
Share on other sites

$svrRadio = GUICtrlCreateRadio("CHG", 265, 185)

$svrRadio = GUICtrlCreateRadio("DAL", 265, 215)

You can't declare 2 gui controls on one variable. Use an array

$svrRadio[0] = GUICtrlCreateRadio("CHG", 265, 185)
$svrRadio[1] = GUICtrlCreateRadio("DAL", 265, 215)

or 2 variables - $svrRadio1 ; $svrRadio2. Also don't declare $path in every statements. IMO in your case it would be best to declare all of your variables, arrays etc in a global scope statements at the beginning of the script.

Global $path, $radioButtons ; etc...
FileWrite("c:\temp\migrate_voicemail.txt", "some things here:" & $voicemail & @CRLF)

FileWrite("c:\temp\migrate_voicemail.txt", "some more things here:" & $chgRadio & @CRLF)

FileWrite("c:\temp\migrate_voicemail.txt", "even more things here:" & $dalRadio & @CRLF)

Why are you trying to writing 3 variables in on file? Anyway in order to use the data from a given GUI control you have to use GUICtrlRead - Guictrlread($voicemail) etc.

IMO this is useless

If IsDeclared($path) Then

   GUICtrlCreateLabel("Executing " & $path & "\outlook.exe", 35, 360)

   GUICtrlCreateLabel(" /importprf c:\temp\voicemail.txt", 45, 390)

EndIf

since you have declared $path. Also what's the point of those labes? Just trying to send a message to the user? If yes, then use MsgBox() or TrayTip()...

GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)

In order to execute a command with this button you have to assign a handle to the button -

$button = GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)

and

While 1

   $msg = GUIGetMsg()

   Select

      Case $msg = $GUI_EVENT_CLOSE

         ExitLoop

      Case $msg = $button
; do something here
   EndSelect

WEnd
Edited by hiho
Link to comment
Share on other sites

hiho, on 23 May 2013 - 8:01 PM, said:

$svrRadio = GUICtrlCreateRadio("CHG", 265, 185)

$svrRadio = GUICtrlCreateRadio("DAL", 265, 215)

You can't declare 2 gui controls on one variable. Use an array

$svrRadio[0] = GUICtrlCreateRadio("CHG", 265, 185)
$svrRadio[1] = GUICtrlCreateRadio("DAL", 265, 215)

or 2 variables - $svrRadio1 ; $svrRadio2. Also don't declare $path in every statements. IMO in your case it would be best to declare all of your variables, arrays etc in a global scope statements at the beginning of the script.

Global $path, $radioButtons ; etc...

 

The array part makes sense. I'm not comprehending declaring the variables in the global scope, but hopefully the help file will explain what all that means :P

FileWrite("c:\temp\migrate_voicemail.txt", "some things here:" & $voicemail & @CRLF)

FileWrite("c:\temp\migrate_voicemail.txt", "some more things here:" & $chgRadio & @CRLF)

FileWrite("c:\temp\migrate_voicemail.txt", "even more things here:" & $dalRadio & @CRLF)

Why are you trying to writing 3 variables in on file? Anyway in order to use the data from a given GUI control you have to use GUICtrlRead - Guictrlread($voicemail) etc

.

Because I need to output a bunch of static text, then the contents of the array/variables, then more static text into a file that will be used in a command line execution of "outlook.exe /importprf [the-file-that-was-written-to].txt"

 

IMO this is useless

If IsDeclared($path) Then

   GUICtrlCreateLabel("Executing " & $path & "\outlook.exe", 35, 360)

   GUICtrlCreateLabel(" /importprf c:\temp\voicemail.txt", 45, 390)

EndIf

since you have declared $path. Also what's the point of those labes? Just trying to send a message to the user? If yes, then use MsgBox() or TrayTip()...

 

I agree wholeheartedly. I tried the MsgBox() method and my boss didn't like it. He wanted it in the main gui window. And the reason I put the line "If IsDeclared($path) Then" is because on rare occasions we have quote/unquote "Power Users" who install office in a place other than C:Program Files or C:Program Files (x86), so I didn't want it to display what it displays unless $path had a solid declaration. Instead, it displays a text box so the "Power User" can paste his office installation directory in the box.

GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)

In order to execute a command with this button you have to assign a handle to the button -

$button = GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)

and

While 1

   $msg = GUIGetMsg()

   Select

      Case $msg = $GUI_EVENT_CLOSE

         ExitLoop

      Case $msg = $button
; do something here
   EndSelect

WEnd

 

Ok, I see what you mean, in the While 1... that is essentially where all the actionable items are... so I could do something like

While 1
   $msg = GUIGetMsg()
   
   ;---I think this allows you to close the window using the little red 'X'...
   
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
;the button action
      Case $msg = $button
         FileWrite("C:\Temp\File.txt", "My static text:" & GUICtrlRead($voiceMail) & @CRLF)
         FileWrite(("C:\Temp\File.txt", "My static text:" & GUICtrlRead($svrRadio[x]) & @CRLF)
         Run(@comspec & ' c/ start' & '"' & $path & '\outlook.exe /importpfr C:\Temp\File.text' & '"', @SW_HIDE)
   EndSelect
WEnd
Link to comment
Share on other sites

I'm so close to the answer, I can taste it... just having a problem with the array.

I modified the While 1 so that when my button is pressed, it does THIS (just me testing the waters, this wont be the final... like I said, 2 days ago was the first time I ever touched AutoIt)

While 1
   $msg = GUIGetMsg()   
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $button
         FileWrite("C:\Temp\voicemail.txt", "$voiceMail: " & $voiceMail & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", "$svrRadio[0]: " & $svrRadio[0] & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", "$svrRadio[1]: " & $svrRadio[1] & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", "$path: " & $path & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", "$svr: " & $svr & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$voiceMail:" & GuiCtrlRead($voiceMail) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$svrRadio[0]:" & GuiCtrlRead($svrRadio[0]) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$svrRadio[1]:" & GuiCtrlRead($svrRadio[1]) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$path:" & GuiCtrlRead($path) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$svr:" & GuiCtrlRead($svr) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", @CRLF)
         ;Run(@comspec & ' c/ start' & '"' & $path & '\outlook.exe /importpfr C:\Temp\File.text' & "'", @SW_HIDE)
         $alert = MsgBox(0, "Message", 'Your outlook should launch and prompt for your voicemail password.') 
   EndSelect
WEnd

now, when i run the script and select the radio button CHG and click my $button button, then select the DAL radio and click $button, I get 2 files, one outputs to:
 

$voiceMail: 10
$svrRadio[0]: 12
$svrRadio[1]: 13
$path: C:\Program Files (x86)\Microsoft Office\Office14
$svr: 

$voiceMail: 10
$svrRadio[0]: 12
$svrRadio[1]: 13
$path: C:\Program Files (x86)\Microsoft Office\Office14
$svr:

the other outputs to

$voiceMail:12345
$svrRadio[0]:1
$svrRadio[1]:4
$path:0
$svr:0

$voiceMail:12345
$svrRadio[0]:4
$svrRadio[1]:1
$path:0
$svr:0

so that tells me that the $svrRadio array values are changed with the GuiCtrlRead(svrRadio[#]), so I now have this:

Global $voiceMail, $svrRadio[2], $svr, $path, $button, $alert

   ;---Radio Buttons!!!

GUICtrlCreateLabel("Choose your VoiceMail server:", 35, 188)
$svrRadio[0] = GUICtrlCreateRadio("CHG", 265, 185)
$svrRadio[1] = GUICtrlCreateRadio("DAL", 265, 215)

If GuiCtrlRead($svrRadio[0]) = 1 Then
   $svr = "IP_address_1"
ElseIf GUICtrlRead($svrRadio[1]) = 1 Then
   $svr = "IP_address_2"
   EndIf

however, that doesn't seem to be giving a value to $svr. I've tried every combination of:

If GuiCtrlRead($svrRadio[0]) = 1
If GuiCtrlRead($svrRadio[0]) = "1"
If $svrRadio[0] = 1
If $svrRadio[0] = "1"

and it returns the same thing....

FileWrite("C:Tempvoicemail.txt", "$svr: " & $svr & @CRLF)  will return in the txt "$svr: "

and

FileWrite("C:Tempvoicemail2.txt", "$svr:" & GuiCtrlRead($svr) & @CRLF) will return "$svr:0".

I get both of those returns regardless of whether I have CHG or DAL radio button pressed.

Thank all of you for your help. It is greatly appreciated

Link to comment
Share on other sites

Do yourself, and anyone following this thread, a favor. Don't post parts of the non-working script, post it all. This way we can see exactly what you're doing and what you might have changed. Even if the script won't run the way you want it to, seeing a complete script is better than looking through the keyhole at what you're doing in it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Do yourself, and anyone following this thread, a favor. Don't post parts of the non-working script, post it all. This way we can see exactly what you're doing and what you might have changed. Even if the script won't run the way you want it to, seeing a complete script is better than looking through the keyhole at what you're doing in it.

you got it

#include <GUIConstantsEx.au3>
Global $voiceMail, $svrRadio[2], $svr, $path, $button, $alert

;---Create the gui layout and brand it as such

GUICreate("Voicemail to Outlook 2010 Migration Tool", 600, 600)
GUISetIcon("C:\Apps\mhk.ico")
GUICtrlCreatePic("C:\Apps\mhk.jpg",20,20,100,100)
GUICtrlCreatePic("C:\Apps\mhk.jpg",480,20,100,100)
GUISetBkColor(0xffffff) 
GUISetState(@SW_SHOW)
GUISetFont(15, 800)
GUICtrlCreateLabel("Voicemail Migration Tool", 180, 25)
GUISetFont(12, 400)
GUICtrlCreateLabel("This allows users to setup Outlook 2010", 160, 60)
GUICtrlCreateLabel("to receive voicemails in their inbox.", 180, 75)
GUICtrlCreateLabel("________________________________________________________", 50, 120)

;---Start polling for information...
   ;---Text input

GUISetFont(12, 400)
GUICtrlCreateLabel("Please enter your voicemail extension:", 35, 155)
$voiceMail = GUICtrlCreateInput("", 310, 153, 75, 25)

   ;---Radio Buttons!!!

GUICtrlCreateLabel("Choose your VoiceMail server:", 35, 188)
$svrRadio[0] = GUICtrlCreateRadio("CHG", 265, 185)
$svrRadio[1] = GUICtrlCreateRadio("DAL", 265, 215)

If GuiCtrlRead($svrRadio[0]) = 1 Then
   $svr = "IP_address_1"
ElseIf GUICtrlRead($svrRadio[1]) = 1 Then
   $svr = "IP_Address_2"
   EndIf

;---Now, let's see what our working directory will be...

If FileExists("C:\Program Files (x86)\Microsoft Office\Office14\outlook.exe") Then
   GUISetFont(12, 600)
   dim $path = "C:\Program Files (x86)\Microsoft Office\Office14"
   GUICtrlCreateLabel("Detected 32 bit Outlook 2010 on 64 bit Windows", 35, 270)
   GUICtrlSetColor(-1, 0x0000fA)
   
      ElseIf FileExists("C:\Program Files\Microsoft Office\Office14\outlook.exe") Then
         GUISetFont(12, 600)
         dim $path = "C:\Program Files\Microsoft Office\Office14"
         GUICtrlCreateLabel("Detected 32/64 bit Outlook 2010 on 32/64 bit Windows", 35, 270)
         
            ElseIf FileExists("C:\Program Files (x86)\Microsoft Office 15\root\office15\outlook.exe") Then
               GUISetFont(12, 600)
               dim $path = "C:\Program Files (x86)\Microsoft Office 15\root\office15"
               GUICtrlCreateLabel("Detected 32 bit Outlook 2013 on 64 bit Windows", 35, 270)
               
                  ElseIf FileExists("C:\Program Files\Microsoft Office 15\root\office15\outlook.exe") Then
                     GUISetFont(12, 600)
                     dim $path = "C:\Program Files\Microsoft Office 15\root\office15"
                     GUICtrlCreateLabel("Detected 32/64 bit Outlook 2013 on 32/64 bit Windows", 35, 270)


;---Just in case the user has Office installed in a non %programfiles% location
                     
                  Else 
                     GUISetFont(14, 900)
                     GUICtrlCreateLabel("Unable to detect installed Windows/Outlook version.", 35, 270)
                     GUICtrlSetColor(-1, 0xff0000)
                     GUISetFont(12, 400)
                     GUICtrlCreateLabel("Please copy and paste the path that contains outlook.exe in the box below.", 35, 300)
                     $path = GUICtrlCreateInput("", 35, 320, 535, 25)
EndIf

;---Let them know what it is we're running (like they really care...)

If IsDeclared($path) Then
   GUICtrlCreateLabel("Executing " & $path & "\outlook.exe", 35, 360)
   GUICtrlCreateLabel(" /importprf c:\temp\voicemail.txt", 45, 390)
EndIf



;---Pretty, pretty button. Once clicked, it SHOULD set all the selections to their assigned strings and then execute the command

$button = GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)
GUISetFont(7, 400)
GUICtrlCreateLabel("© 2013 [My Company]. All Rights Reserved.", 190, 587)

;--This alerts whether Outlook is actively running or not and kills it if it is.
   ;---It appears at the top, but was loading before all the other stuff, and it didn't look as neat that way
   
If ProcessExists('outlook.exe') Then
      $outlook_open = MsgBox(0,'Outlook is still running!','Press Ok to close Outlook automatically. You may save any open documents that you have before clicking OK.')
      ProcessClose('outlook.exe')
      
      ;---It was taking a second or so for ProcessClose to close Outlook and was thusly still seeing the Outlook process
         ;-running and forcing the script to close. Making it wait 2 seconds before continuing is the obvious fix :P
      
      Sleep(2000)
         If Not ProcessExists('outlook.exe') Then
            GUISetFont(13, 800)
            GUICtrlCreateLabel("Outlook is not running. We may continue.", 140, 100)
            GUICtrlSetColor(-1, 0x00af00)
         Else
            GUISetFont(13, 800)
            GUICtrlCreateLabel("Unable to close Outlook. Quitting in 10 seconds.", 110, 100)
            GUICtrlSetColor(-1, 0xff0000)
            Sleep(10000)
            Exit
         EndIf
   Else
      GUISetFont(13, 800)
      GUICtrlCreateLabel("Outlook is not running. We may continue.", 140, 100)
      GUICtrlSetColor(-1, 0x00af00)
   EndIf

;---The following part seemed pretty important in the tutorial, so I'm going to leave it here....

While 1
   $msg = GUIGetMsg()   
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $button
         ;---Make sure they've never tried the migration before. And if they have, KILL IT WITH FIRE!!!

         ;If FileExists("C:\Temp\voicemail.txt") Then
            ;GUICtrlCreateLabel("Deleting previously used Migration Settings", 45, 400)
            ;FileDelete("C:\Temp\voicemail.txt")
            ;EndIf
         FileWrite("C:\Temp\voicemail.txt", "$voiceMail: " & $voiceMail & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", "$svrRadio[0]: " & $svrRadio[0] & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", "$svrRadio[1]: " & $svrRadio[1] & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", "$path: " & $path & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", "$svr: " & $svr & @CRLF)
         FileWrite("C:\Temp\voicemail.txt", @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$voiceMail:" & GuiCtrlRead($voiceMail) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$svrRadio[0]:" & GuiCtrlRead($svrRadio[0]) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$svrRadio[1]:" & GuiCtrlRead($svrRadio[1]) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$path:" & GuiCtrlRead($path) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", "$svr:" & GuiCtrlRead($svr) & @CRLF)
         FileWrite("C:\Temp\voicemail2.txt", @CRLF)
         ;Run(@comspec & ' c/ start' & '"' & $path & '\outlook.exe /importpfr C:\Temp\File.text' & "'", @SW_HIDE)
         $alert = MsgBox(0, "Message", 'Your outlook should launch and prompt for your voicemail password.')
      Case $msg = $alert
         ;Exit   
   EndSelect
WEnd
Link to comment
Share on other sites

  • Solution

You're reading the state of the checkbox before the user even sees it, and then you're not reading it ever again. So that means that whatever the user clicks on won't make any difference because it's not being seen.  Plus, because it's being read before anyone clicks on it, the $svr variable won't ever get a value, because neither of them are 1 when you do the GUICtrlRead.

I'm not 100% sure this is how you want it, but this should be closer to what you're trying to get to.

#include <GUIConstantsEx.au3>
Global $voiceMail, $svrRadio[2], $svr, $path, $button, $alert
;---Create the gui layout and brand it as such
GUICreate("Voicemail to Outlook 2010 Migration Tool", 600, 600)
GUISetIcon("C:\Apps\mhk.ico")
GUICtrlCreatePic("C:\Apps\mhk.jpg", 20, 20, 100, 100)
GUICtrlCreatePic("C:\Apps\mhk.jpg", 480, 20, 100, 100)
GUISetBkColor(0xffffff)
GUISetFont(15, 800)
GUICtrlCreateLabel("Voicemail Migration Tool", 180, 25)
GUISetFont(12, 400)
GUICtrlCreateLabel("This allows users to setup Outlook 2010", 160, 60)
GUICtrlCreateLabel("to receive voicemails in their inbox.", 180, 75)
GUICtrlCreateLabel("________________________________________________________", 50, 120)
;---Start polling for information...
;---Text input
GUISetFont(12, 400)
GUICtrlCreateLabel("Please enter your voicemail extension:", 35, 155)
$voiceMail = GUICtrlCreateInput("", 310, 153, 75, 25)
;---Radio Buttons!!!
GUICtrlCreateLabel("Choose your VoiceMail server:", 35, 188)
$svrRadio[0] = GUICtrlCreateRadio("CHG", 265, 185)
$svrRadio[1] = GUICtrlCreateRadio("DAL", 265, 215)

;---Now, let's see what our working directory will be...
Global $path = ""
If FileExists("C:\Program Files (x86)\Microsoft Office\Office14\outlook.exe") Then
GUISetFont(12, 600)
$path = "C:\Program Files (x86)\Microsoft Office\Office14"
GUICtrlCreateLabel("Detected 32 bit Outlook 2010 on 64 bit Windows", 35, 270)
GUICtrlSetColor(-1, 0x0000fA)
ElseIf FileExists("C:\Program Files\Microsoft Office\Office14\outlook.exe") Then
GUISetFont(12, 600)
$path = "C:\Program Files\Microsoft Office\Office14"
GUICtrlCreateLabel("Detected 32/64 bit Outlook 2010 on 32/64 bit Windows", 35, 270)
ElseIf FileExists("C:\Program Files (x86)\Microsoft Office 15\root\office15\outlook.exe") Then
GUISetFont(12, 600)
$path = "C:\Program Files (x86)\Microsoft Office 15\root\office15"
GUICtrlCreateLabel("Detected 32 bit Outlook 2013 on 64 bit Windows", 35, 270)
ElseIf FileExists("C:\Program Files\Microsoft Office 15\root\office15\outlook.exe") Then
GUISetFont(12, 600)
$path = "C:\Program Files\Microsoft Office 15\root\office15"
GUICtrlCreateLabel("Detected 32/64 bit Outlook 2013 on 32/64 bit Windows", 35, 270)

;---Just in case the user has Office installed in a non %programfiles% location
Else
GUISetFont(14, 900)
GUICtrlCreateLabel("Unable to detect installed Windows/Outlook version.", 35, 270)
GUICtrlSetColor(-1, 0xff0000)
GUISetFont(12, 400)
GUICtrlCreateLabel("Please copy and paste the path that contains outlook.exe in the box below.", 35, 300)
$path = InputBox("", "Please copy and paste the path that contains outlook.exe in the box below.")
EndIf
;---Let them know what it is we're running (like they really care...)
If $path <> "" Then
GUICtrlCreateLabel("Executing " & $path & "\outlook.exe", 35, 360)
GUICtrlCreateLabel(" /importprf c:\temp\voicemail.txt", 45, 390)
EndIf

;---Pretty, pretty button. Once clicked, it SHOULD set all the selections to their assigned strings and then execute the command
$button = GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)
GUISetFont(7, 400)
GUICtrlCreateLabel("© 2013 [My Company]. All Rights Reserved.", 190, 587)
GUISetState(@SW_SHOW)
;--This alerts whether Outlook is actively running or not and kills it if it is.
;---It appears at the top, but was loading before all the other stuff, and it didn't look as neat that way
If ProcessExists('outlook.exe') Then
$outlook_open = MsgBox(0, 'Outlook is still running!', 'Press Ok to close Outlook automatically. You may save any open documents that you have before clicking OK.')
ProcessClose('outlook.exe')
;---It was taking a second or so for ProcessClose to close Outlook and was thusly still seeing the Outlook process
;-running and forcing the script to close. Making it wait 2 seconds before continuing is the obvious fix :P
Sleep(2000)
If Not ProcessExists('outlook.exe') Then
  GUISetFont(13, 800)
  GUICtrlCreateLabel("Outlook is not running. We may continue.", 140, 100)
  GUICtrlSetColor(-1, 0x00af00)
Else
  GUISetFont(13, 800)
  GUICtrlCreateLabel("Unable to close Outlook. Quitting in 10 seconds.", 110, 100)
  GUICtrlSetColor(-1, 0xff0000)
  Sleep(10000)
  Exit
EndIf
Else
GUISetFont(13, 800)
GUICtrlCreateLabel("Outlook is not running. We may continue.", 140, 100)
GUICtrlSetColor(-1, 0x00af00)
EndIf
;---The following part seemed pretty important in the tutorial, so I'm going to leave it here....
Global $hFile, $hFile2
While 1
$msg = GUIGetMsg()
Select
  Case $msg = $GUI_EVENT_CLOSE
   ExitLoop
  Case $msg = $button
   ;---Make sure they've never tried the migration before. And if they have, KILL IT WITH FIRE!!!
   If GUICtrlRead($svrRadio[0]) = 1 Then
    $svr = "IP_address_1"
   ElseIf GUICtrlRead($svrRadio[1]) = 1 Then
    $svr = "IP_Address_2"
   EndIf
   ;If FileExists($hFile) Then
   ;GUICtrlCreateLabel("Deleting previously used Migration Settings", 45, 400)
   ;FileDelete($hFile)
   ;EndIf
            $hFile = FileOpen("C:\Temp\voicemail.txt", 2)
   FileWriteLine($hFile, "$voiceMail: " &$voiceMail & @CRLF)
   FileWriteLine($hFile, "$svrRadio[0]: " & $svrRadio[0] & @CRLF)
   FileWriteLine($hFile, "$svrRadio[1]: " & $svrRadio[1] & @CRLF)
   FileWriteLine($hFile, "$path: " & $path & @CRLF)
   FileWriteLine($hFile, "$svr: " & $svr & @CRLF)
   FileWriteLine($hFile, @CRLF)
            FileClose($hFile)
            $hFile2 = FileOpen("C:\Temp\voicemail2.txt", 2)
   FileWriteLine($hFile2, "$voiceMail:" & GUICtrlRead($voiceMail) & @CRLF)
   FileWriteLine($hFile2, "$svrRadio[0]:" & GUICtrlRead($svrRadio[0]) & @CRLF)
   FileWriteLine($hFile2, "$svrRadio[1]:" & GUICtrlRead($svrRadio[1]) & @CRLF)
   FileWriteLine($hFile2, "$path:" & $path & @CRLF)
   FileWriteLine($hFile2, "$svr:" & $svr & @CRLF)
   FileWriteLine($hFile2, @CRLF)
            FileClose($hFile2)
   ;Run(@comspec & ' c/ start' & '"' & $path & '\outlook.exe /importpfr C:\Temp\File.text' & "'", @SW_HIDE)
   $alert = MsgBox(0, "Message", 'Your outlook should launch and prompt for your voicemail password.')
  Case $msg = $alert
   ;Exit
EndSelect
WEnd

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Essentially, that was exactly what I was looking for... just looking through it, I noticed 4 changes you made:

  1. you moved GUISetState(@SW_SHOW) to below the button to execute everything...
  2. Added a couple more Global entries
  3. Changed my $path If Then statement  away from IsDeclared to <> ""
  4. Changed my FileWrites to FileWriteLine
  5. Made a variable that was my text text file.

Now, I understand numbers 2, 3, and 5, why did GUISetState(@SW_SHOW) get moved? was moving that what caused the script to be able to read the states of the user input? And what is the advantages to FileOpen and FileWriteLine over what I was using (FileWrite)? Looking at the help file, I see what it does, I just dont understand why that was used.... (I miss the days of batch files "echo whatever text>>filename.txt"...)

Regardless, thanks a ton for the help BrewManNH!

Link to comment
Share on other sites

I moved the GUISetState so that everything is on the GUI is created before showing it, it's just nicer if the computer is slow that you're not seeing things being popped into the GUI after showing (just my opinion).

 

I used FileWriteLine instead of FileWrite, because it automatically appends @CRLF to the line when you write to the file. Although I forgot to remove the "& @CRLF" from each line, it writes it the same way. It makes for less typing.

 

Here's the same code but with the  "& @CRLF" removed from the FileWriteLines.

 

#include <GUIConstantsEx.au3>
Global $voiceMail, $svrRadio[2], $svr, $path, $button, $alert
;---Create the gui layout and brand it as such
GUICreate("Voicemail to Outlook 2010 Migration Tool", 600, 600)
GUISetIcon("C:\Apps\mhk.ico")
GUICtrlCreatePic("C:\Apps\mhk.jpg", 20, 20, 100, 100)
GUICtrlCreatePic("C:\Apps\mhk.jpg", 480, 20, 100, 100)
GUISetBkColor(0xffffff)
GUISetFont(15, 800)
GUICtrlCreateLabel("Voicemail Migration Tool", 180, 25)
GUISetFont(12, 400)
GUICtrlCreateLabel("This allows users to setup Outlook 2010", 160, 60)
GUICtrlCreateLabel("to receive voicemails in their inbox.", 180, 75)
GUICtrlCreateLabel("________________________________________________________", 50, 120)
;---Start polling for information...
;---Text input
GUISetFont(12, 400)
GUICtrlCreateLabel("Please enter your voicemail extension:", 35, 155)
$voiceMail = GUICtrlCreateInput("", 310, 153, 75, 25)
;---Radio Buttons!!!
GUICtrlCreateLabel("Choose your VoiceMail server:", 35, 188)
$svrRadio[0] = GUICtrlCreateRadio("CHG", 265, 185)
$svrRadio[1] = GUICtrlCreateRadio("DAL", 265, 215)

;---Now, let's see what our working directory will be...
Global $path = ""
If FileExists("C:\Program Files (x86)\Microsoft Office\Office14\outlook.exe") Then
    GUISetFont(12, 600)
    $path = "C:\Program Files (x86)\Microsoft Office\Office14"
    GUICtrlCreateLabel("Detected 32 bit Outlook 2010 on 64 bit Windows", 35, 270)
    GUICtrlSetColor(-1, 0x0000fA)
ElseIf FileExists("C:\Program Files\Microsoft Office\Office14\outlook.exe") Then
    GUISetFont(12, 600)
    $path = "C:\Program Files\Microsoft Office\Office14"
    GUICtrlCreateLabel("Detected 32/64 bit Outlook 2010 on 32/64 bit Windows", 35, 270)
ElseIf FileExists("C:\Program Files (x86)\Microsoft Office 15\root\office15\outlook.exe") Then
    GUISetFont(12, 600)
    $path = "C:\Program Files (x86)\Microsoft Office 15\root\office15"
    GUICtrlCreateLabel("Detected 32 bit Outlook 2013 on 64 bit Windows", 35, 270)
ElseIf FileExists("C:\Program Files\Microsoft Office 15\root\office15\outlook.exe") Then
    GUISetFont(12, 600)
    $path = "C:\Program Files\Microsoft Office 15\root\office15"
    GUICtrlCreateLabel("Detected 32/64 bit Outlook 2013 on 32/64 bit Windows", 35, 270)

    ;---Just in case the user has Office installed in a non %programfiles% location
Else
    GUISetFont(14, 900)
    GUICtrlCreateLabel("Unable to detect installed Windows/Outlook version.", 35, 270)
    GUICtrlSetColor(-1, 0xff0000)
    GUISetFont(12, 400)
    GUICtrlCreateLabel("Please copy and paste the path that contains outlook.exe in the box below.", 35, 300)
    $path = InputBox("", "Please copy and paste the path that contains outlook.exe in the box below.")
EndIf
;---Let them know what it is we're running (like they really care...)
If $path <> "" Then
    GUICtrlCreateLabel("Executing " & $path & "\outlook.exe", 35, 360)
    GUICtrlCreateLabel(" /importprf c:\temp\voicemail.txt", 45, 390)
Else
    Exit
EndIf

;---Pretty, pretty button. Once clicked, it SHOULD set all the selections to their assigned strings and then execute the command
$button = GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)
GUISetFont(7, 400)
GUICtrlCreateLabel("© 2013 [My Company]. All Rights Reserved.", 190, 587)
GUISetState(@SW_SHOW)
;--This alerts whether Outlook is actively running or not and kills it if it is.
;---It appears at the top, but was loading before all the other stuff, and it didn't look as neat that way
If ProcessExists('outlook.exe') Then
    $outlook_open = MsgBox(0, 'Outlook is still running!', 'Press Ok to close Outlook automatically. You may save any open documents that you have before clicking OK.')
    ProcessClose('outlook.exe')
    ;---It was taking a second or so for ProcessClose to close Outlook and was thusly still seeing the Outlook process
    ;-running and forcing the script to close. Making it wait 2 seconds before continuing is the obvious fix :P
    Sleep(2000)
    If Not ProcessExists('outlook.exe') Then
        GUISetFont(13, 800)
        GUICtrlCreateLabel("Outlook is not running. We may continue.", 140, 100)
        GUICtrlSetColor(-1, 0x00af00)
    Else
        GUISetFont(13, 800)
        GUICtrlCreateLabel("Unable to close Outlook. Quitting in 10 seconds.", 110, 100)
        GUICtrlSetColor(-1, 0xff0000)
        Sleep(10000)
        Exit
    EndIf
Else
    GUISetFont(13, 800)
    GUICtrlCreateLabel("Outlook is not running. We may continue.", 140, 100)
    GUICtrlSetColor(-1, 0x00af00)
EndIf
;---The following part seemed pretty important in the tutorial, so I'm going to leave it here....
Global $hFile, $hFile2
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            ;---Make sure they've never tried the migration before. And if they have, KILL IT WITH FIRE!!!
            If GUICtrlRead($svrRadio[0]) = 1 Then
                $svr = "IP_address_1"
            ElseIf GUICtrlRead($svrRadio[1]) = 1 Then
                $svr = "IP_Address_2"
            EndIf
            ;If FileExists($hFile) Then
            ;GUICtrlCreateLabel("Deleting previously used Migration Settings", 45, 400)
            ;FileDelete($hFile)
            ;EndIf
            $hFile = FileOpen("C:\Temp\voicemail.txt", 2)
            FileWriteLine($hFile, "$voiceMail: " & $voiceMail)
            FileWriteLine($hFile, "$svrRadio[0]: " & $svrRadio[0])
            FileWriteLine($hFile, "$svrRadio[1]: " & $svrRadio[1])
            FileWriteLine($hFile, "$path: " & $path)
            FileWriteLine($hFile, "$svr: " & $svr)
            FileClose($hFile)
            $hFile2 = FileOpen("C:\Temp\voicemail2.txt", 2)
            FileWriteLine($hFile2, "$voiceMail:" & GUICtrlRead($voiceMail))
            FileWriteLine($hFile2, "$svrRadio[0]:" & GUICtrlRead($svrRadio[0]))
            FileWriteLine($hFile2, "$svrRadio[1]:" & GUICtrlRead($svrRadio[1]))
            FileWriteLine($hFile2, "$path:" & $path)
            FileWriteLine($hFile2, "$svr:" & $svr)
            FileClose($hFile2)
            ;Run(@comspec & ' c/ start' & '"' & $path & '\outlook.exe /importpfr C:\Temp\File.text' & "'", @SW_HIDE)
            $alert = MsgBox(0, "Message", 'Your outlook should launch and prompt for your voicemail password.')
        Case $msg = $alert
            ;Exit
    EndSelect
WEnd
I also removed the GUICtrlCreateInput and used an InputBox in it's place. This way your $path variable isn't ever a control but a string pointing to the path of Outlook, this was causing your script to not output the correct information if you had to manually input the path.

 

You shouldn't ever declare a variable conditionally if you're going to absolutely need it later, you should declare it, preferably with a default value, then set its value somewhere. This way you're sure it's declared, although it may end up being blank if you don't set the value. In this rewrite, if the user doesn't input a value for the path, the script exits, otherwise it might cause issues with the migration software.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Well, it works brilliantly, adapted for the lines that i need for the /importprf switch for outlook.exe. I have one last issue before I can officially call this v1.0. I cannot for the life of me get it to run what I need it to run... I've tried both deviations listed:

RunWait(@ComSpec & " /c " & '"' & $path & '\outlook.exe /importprf C:\Temp\voicemail.txt' & '"', "", @SW_HIDE)


Run('"' & $path & '\outlook.exe /importpfr C:\Temp\voicemail.txt' & '"')

and neither will work :-/

its supposed to be the same thing as opening cmd and typing:
$pathoutlook.exe /importprf C:Temp

I know my $path is correct

I know C:Tempvoicemail.txt is correct
I know outlook.exe /importprf is correct...

I'm just doing something wrong....

Link to comment
Share on other sites

Your quotes are in the wrong place, try this.

 

RunWait(@ComSpec & " /c " & '"' & $path & '\outlook.exe" /importprf C:\Temp\voicemail.txt', "", @SW_HIDE)
; actually try this first then try the line above if it works.
RunWait(@ComSpec & " /k " & '"' & $path & '\outlook.exe" /importprf C:\Temp\voicemail.txt')
EDIT: Try it without hiding the command console window and let the window stay open after it's finished to see if it runs correctly, then you can hide everything. Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Your quotes are in the wrong place, try this.

 

RunWait(@ComSpec & " /c " & '"' & $path & '\outlook.exe" /importprf C:\Temp\voicemail.txt', "", @SW_HIDE)
; actually try this first then try the line above if it works.
RunWait(@ComSpec & " /k " & '"' & $path & '\outlook.exe" /importprf C:\Temp\voicemail.txt')
EDIT: Try it without hiding the command console window and let the window stay open after it's finished to see if it runs correctly, then you can hide everything.

 

BrewManNH, you are a genius... amazing how the location of a quote can make a huge difference... the script works flawlessly, and supervisors are very pleased

Link to comment
Share on other sites

Lets hope they give you a raise now. ;)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

jparnell8839,

And if they do, the "Donate" button is at top right. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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