Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Convert Batch file to VB or Registry for Context Menu Access

- - - - -

  • Please log in to reply
32 replies to this topic

#1
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
First, I'm no programmer. I cobbled together this bat file that essentially creates a specific directory structure based on a parent "series" folder (12300, 12400, 12500, etc.). Nested within that folder will be a client folder. Inside the Client folder will be a specific job folder (12312 Brochure, 12317 Flyer, etc.) Inside the job folder will be HSD, Design, LFC, PROOF, and Materials. Inside the Materials folder will be a "yyyy.mm.dd Files received" folder. The series, client, and job folders are variable.

I would like to add this functionality to the context menu for Win 7. I'm not sure how to go about doing this. I've seen another thread that leads a user through a similar process, but I have no idea how to convert my code to registry entries. Here is the code:

@ECHO OFF

:BEGIN
CLS
SET AGPath=X:\01 PC WIP\
SET /P Cust=Customer Name:
SET /P InvNo=Invoice Number (Last 5 digits only):
SET /P Job=Type of job:
SET SERIES=%InvNo:~0,3%00 PC\

CLS
echo Is this correct?
echo %AGPath%%SERIES%
echo %Cust%\
echo %InvNo% %Job%

SET /P Appr=Y(yes) N(no) C(cancel):
if '%Appr%' == 'y' goto Appr
if '%Appr%' == 'n' goto BEGIN
if '%Appr%' == 'c' goto Cancel

:Appr
mkdir "%AGPath%%SERIES%%Cust%\%InvNo% %Job%\materials\yyyy.mm.dd Files Received"
mkdir "%AGPath%%SERIES%%Cust%\%InvNo% %Job%\HSD"
mkdir "%AGPath%%SERIES%%Cust%\%InvNo% %Job%\Design"
mkdir "%AGPath%%SERIES%%Cust%\%InvNo% %Job%\LFC"
mkdir "%AGPath%%SERIES%%Cust%\%InvNo% %Job%\PROOF"
CLS
echo Process Complete
Pause
goto end

:Cancel
CLS
echo Process canceled by user.
Pause
goto end

:END


I know my code is probably junk, but hey. Thanks for any help!


How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,029 posts
  • OS:none specified
  • Country: Country Flag

I've seen another thread that leads a user through a similar process, but I have no idea how to convert my code to registry entries. Here is the code:

Provide a pointer to it, maybe it can be adapted.

I know my code is probably junk, but hey. Thanks for any help!

Rest assured, it is :yes: (no offence whatever intended :)).
Besides some "style" for which everyone has it's preferences (as an example you need not an :END label in NT batch, since the re is the implied :EOF label), this snippet:

SET /P Appr=Y(yes) N(no) C(cancel):
if '%Appr%' == 'y' goto Appr
if '%Appr%' == 'n' goto BEGIN
if '%Appr%' == 'c' goto Cancel

is WRONG :ph34r: for TWO reasons:
it doesn't take into account small and CAPITAL letters and will "continue" execution if *anything* but y, n or c is input :w00t:
This approach is safer/better:

SET appr=cancel
SET /P Appr=Y(yes) N(no) C(cancel):
if /i '%Appr%' == 'y' goto :Appr
if '/i %Appr%' == 'n' goto :BEGIN
if /i '%Appr%' == 'c' goto :Cancel <- third condition not really needed, *anything* but y, Y, n, N will get to :Cancel
GOTO :Cancel


The yyyy.mm.dd values are not "initialized/set" anywhere, is this really the wanted result, litterally yyyy.mm.dd? :unsure:

jaclaz

#3
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
If you learned about HTA and the various scripting langauges that can be used you could
make something like this to present to the end user.
Attached File  UserInputDemo.png   135.49KB   10 downloads

<!--
February-05-13
 Hta And Script By Gunsmokingman Aka Jake1Eye
 This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use.
 This is only posted as example code and meant only to used as such.
-->
<TITLE>Demo User Input</TITLE>
<HTA:APPLICATION ID="UserIn"
SCROLL="No"
SCROLLFLAT ="No"
SingleInstance="Yes"
ShowInTaskbar="No"
SysMenu="No"
MaximizeButton="No"
MinimizeButton="No"
Border="Thin"
BORDERSTYLE ="complex"
INNERBORDER ="No"
Caption="Yes"
WindowState="Normal"
APPLICATIONNAME="DmUserIn"
Icon="%SystemRoot%\explorer.exe">
<STYLE type="text/css">
Body
{
Font-Size:9.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;
BackGround-Color:#EFE9E3;
Text-Align:Center;
Vertical-Align:Top;
}
TD
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;
}
.Tbx
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;
}
BUTTON
{
Height:15pt;
width:60pt;
Cursor:Hand;
Font:8.05pt;
Font-weight:bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:#404040;
Text-Align:Center;
Vertical-Align:Middle;
filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#E5E5E5',EndColorStr='#7D7D7D');
Margin:1;
Margin-Top:15pt;
Padding:2;
Border-Left: 1px Transparent;
Border-Right: 2px Transparent;
Border-Top: 1px Transparent;
Border-Bottom: 2px Transparent;
}
</STYLE>
<script LANGUAGE='VBScript'>
'-> Resize And Place In Approx Center Of Screen
Dim Wth, Hht :Wth = int(475) :Hht = int(255)
window.ResizeTo Wth, Hht
MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))
'-> Function To Process The Submit Button
Function MySubmit()
If Len(In1.value) = 0 And Len(In2.value) = 0 And Len(In3.value) = 0 Then
alert("No Textboxes Have Any Information")
ElseIf Len(In1.value) >= 1 And Len(In2.value) = 0 And Len(In3.value) = 0 Then
alert("Only TextBox 1 Information : " & In1.value & vbCrlf & _
"Please Fill In Textboxes 2 And 3 Then Press Submit")
ElseIf Len(In1.value) >= 1 And Len(In2.value) >= 1 And Len(In3.value) = 0 Then
alert("TextBox 1 Information : " & In1.value & vbCrlf & _
"TextBox 2 Information : " & In2.value & vbCrlf & _
"Please Fill In Textboxes 3 Then Press Submit")
ElseIf Len(In1.value) >= 1 And Len(In2.value) >= 1 And Len(In3.value) >= 1 Then
If Len(In2.value) = 5 Then
alert("Sucess All 3 Textboxes Filled In" & vbCrlf & _
"TextBox 1 Information : " & In1.value & vbCrlf & _
"TextBox 2 Information : " & In2.value & vbCrlf & _
"TextBox 3 Information : " & In3.value)
Else
alert("Error Needs The Last Five Digits From Invoice Number : " & In2.value)
End If
End If
End Function
</SCRIPT>
<BODY>
<!-- Customer Name Area -->
<TABLE><TD Style='width:101;'>Customer Name</TD><TD>
<INPUT Type='TextBox' ID='In1' Class='Tbx' Size='40' MAXLENGTH='128'>
<TD></TABLE>
<!-- Two Textboxes Start -->
<TABLE>
<!-- Invoice Number Area -->
<TD Style='width:101;'>Invoice Number</TD>
<TD><INPUT Type='TextBox' ID='In2' Class='Tbx' Size='5' MAXLENGTH='5'
Style='Margin-Right:15;' Title="Use Only The Last Five Digits
Of The Invoice Number"></TD>
<!-- Type Of Job Area -->
<TD Style='width:101;'>Type Of Job</TD>
<TD><INPUT Type='TextBox' ID='In3' Class='Tbx' Size='10' MAXLENGTH='15'><TD>
</TABLE>
<!-- Buttons Start -->
<BUTTON ID='Bn1' OnClick='MySubmit()'>Submit</BUTTON>
<BUTTON ID='Bn2' OnClick='window.close()'>Close</BUTTON>
<BODY>



GunSmokingMan



#4
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Jaclaz, yes, the yyyy.mm.dd is literal. The date correlates to the date of files received, which may not be the day the script is run. I'm including it to show the proper format. Thanks so much for your suggestions. Now if I could just integrate it into the context shell somehow. I'm at a loss there. That other thread tells me that the potential is there, but I have no idea how to approach converting the syntax to registry entries.

Gunskokingman,
Wow, that's very nice, and looks like a much nicer way to present it. Unfortunately you lost me at HTA. I couldn't even find that on wikipedia. (I don't think you fully appreciate the breadth of my ignorance. :unsure: ) It looks like a vbscript, which I've worked with a little in the past, but mostly by reverse engineering existing code. The demo works great. Now I just have to figure out how to make it do work with the input and integrate it into the context menu. Thanks for getting me started!

#5
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,029 posts
  • OS:none specified
  • Country: Country Flag

That other thread tells me that the potential is there, but I have no idea how to approach converting the syntax to registry entries.

And - AGAIN - can you post a link to THAT thread (so that possibly we can see if THAT sollution may be adapted to your issue?

Generic "context shell" advice:
http://wstudios.home...iate/index.html

BTW "conttext" of WHAT :w00t: ? (like folder, file, desktop, etc. )
I.e. are you looking to add it to right click when WHAT is selected/in focus?
Example for Desktop:
http://www.howtogeek...-menu-in-vista/

JFYI ;):
http://en.wikipedia.org/wiki/HTA
http://en.wikipedia....TML_Application

jaclaz

Edited by jaclaz, 06 February 2013 - 07:48 AM.


#6
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Oh, HT(ML)A. I did see that in the list, but thought HTML must be wrong. Nope. Just me. (Here's what I figured he was talking about: http://en.wikipedia....lly_tiled_array)

I would like to add this app to the right-click context menu of Windows Explorer in Win 7 (32 and 64). I suppose I shouldn't have assumed the batch file's function would have made that obvious.
Here's the post I Googled that lead me here: http://www.msfn.org/...ght-click-menu/

Thanks. You've given me a lot of good info to look into. I really like the VB interface, so I will try to develop what Gunsmokingman has provided as well.

#7
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,029 posts
  • OS:none specified
  • Country: Country Flag
Good :).
The reg file posted here:
http://www.msfn.org/...post__p__905087
will do that alright (to add to a folder context menu)
AGAIN, to WHICH context menu do you want to add the .hta?
Context means "contextual to something" (or "linked" to something), usually an object that is selected, (like as said examples, folder, file, desktop, etc.) to WHICH of these objects do you want to "link" the right click menu entry?

jaclaz

#8
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
If you need any help just post, the varibles for the Textboxes are In1.value, In2.value, In3.value


GunSmokingMan



#9
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Jaclaz, I understand the concept of context. I wish I knew better how to covey the context I mean. It should be available within Windows Explorer, -the file browser window, in panes where the files and directories are listed. It's the same context within Windows Explorer wherein one would find; View, Group By, Sort By, Refresh, Properties, etc. Is there something I I'm not getting?

I've worked up a flowchart to help me think through the logic of what needs to happen. Thoughts/suggestions welcome:
Posted Image

Edited by 13ruce, 06 February 2013 - 01:23 PM.


#10
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
Nice Flow Chart, but to many yes/no/cancel for my liking

1:\ Collect all information needed
2a:\ Confirm information
2b:\ redo if wrong,
2c:\ then offer to exit and do nothing
3:\ Process information to the various varibles
4:\ Check for folder,
5:\ Process all information
6:\ Finish dialog if needed


GunSmokingMan



#11
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Thanks for you input. There is only one Yes/No/Cancel (at the confirmation stage). The first choice is only Next or Cancel, and is available in case the user inadvertently invoked the app. I think having an "out" is appropriate in both stages of the process. The last choice is internal only, and checks to see if the folder already exists. Certainly we don't need to create an existing directory, so it seems appropriate to end the process there. However, maybe it would be a good idea to open the browser to that location if it does exist before ending.

#12
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Maybe instead of the current flow, the dialog could use a "back" option to allow text corrections to be made. Would that be better?

#13
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
Confirmation, user makes sure all info there if not then ask user to quit or redo
If all information is correct then ask yes to go on or no to quit
Then process all the varibles, run them threw the script, option finish
I dont like having a window open to some folder for no reason.


GunSmokingMan



#14
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag

I dont like having a window open to some folder for no reason.


In our workflow, if the user gets that far, they have work to do in that folder. It can be inferred that the user isn't already viewing that folder (else they would not have invoked the app), so it makes sense to open that location as a convenience. Does that makes sense?

#15
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
Code Update when all three textboxes are filled in, then it ask yes to go on,no and redo, cancel to close
   If Len(In2.value) = 5 Then
    Dim A :A=MsgBox("Is All The Information Correct" & vbCrlf & _
       "TextBox 1 Information : " & In1.value & vbCrlf & _
       "TextBox 2 Information : " & In2.value & vbCrlf & _
       "TextBox 3 Information : " & In3.value & vbCrlf & vbCrlf & _
       "Ok To Continue" & vbCrlf & "No Redo The Information" & vbCrlf & _
       "Cancel To Close And Exit",4131)
     If A = 6 Then 
      alert("Script Place Holder For Yes Actions")
     ElseIf A = 7 Then
      In1.value="" :In2.value="" :In3.value="" :
     ElseIf A = 2 Then
      window.close()
     End If
    Else
    alert("Error Needs The Last Five Digits From Invoice Number : " & In2.value)
    End If 



GunSmokingMan



#16
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Very nice! I plugged in the new code and it's much more like what I'm going for. Thank you so much!

#17
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
I noticed this in your code:
<!--
February-05-13
Hta And Script By Gunsmokingman Aka Jake1Eye
-->

My first order of business was to update that to:
<!--
February-05-13
Hta And Script By Gunsmokingman Aka Jake1Eye
Any horrible abberations herein are the fault of 13ruce
and are in no way to be attributed to the excellent
script stylings of Gunsmokingman Aka Jake1Eye
-->

You're welcome.

Edited by 13ruce, 06 February 2013 - 03:33 PM.


#18
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
I only put that there so it posted here as it original writer.
What you do change or I may help with you can place
what you feel is needed.


GunSmokingMan



#19
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,029 posts
  • OS:none specified
  • Country: Country Flag
I am starting to understand the requirement (about right click).

If I get it right what you need is a shell extension (and not a contextual menu entry).

If this is correct, I doubt you can have it. :(
Do the following:
  • get http://www.nirsoft.n...s/shexview.html
  • check which shell extensions you have on your system
  • post info about one that is present on your right click menu (where/when you would like to see this script entry)

Before the above, try actually reading the initially given:
http://www.howtogeek...-menu-in-vista/
AND test it

jaclaz

Edited by jaclaz, 06 February 2013 - 03:58 PM.


#20
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Before the above, try actually reading the initially given:
http://www.howtogeek...-menu-in-vista/
AND test it

jaclaz


As soon as I have a working app, I definitely will. Thanks again!

#21
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
I made some changes to the HTA
<!--
February-06-13
 Hta And Script By Gunsmokingman Aka Jake1Eye
 This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use.
 This is only posted as example code and meant only to used as such.
-->
<TITLE>Demo User Input2</TITLE>
<HTA:APPLICATION ID="UserIn2"
SCROLL="No"
SCROLLFLAT ="No"
SingleInstance="Yes"
ShowInTaskbar="No"
SysMenu="No"
MaximizeButton="No"
MinimizeButton="No"
Border="Thin"
BORDERSTYLE ="complex"
INNERBORDER ="No"
Caption="Yes"
WindowState="Normal"
APPLICATIONNAME="DmUserIn2"
Icon="%SystemRoot%\explorer.exe">
<STYLE type="text/css">
Body
{
Font-Size:9.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;
BackGround-Color:#EFE9E3;
Text-Align:Center;
Vertical-Align:Top;
}
TD
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;
}
.Tbx
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;
}
BUTTON
{
Height:15pt;
width:60pt;
Cursor:Hand;
Font:8.05pt;
Font-weight:bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:#404040;
Text-Align:Center;
Vertical-Align:Middle;
filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#E5E5E5',EndColorStr='#7D7D7D');
Margin:1;
Margin-Top:15pt;
Padding:2;
Border-Left: 1px Transparent;
Border-Right: 2px Transparent;
Border-Top: 1px Transparent;
Border-Bottom: 2px Transparent;
}
</STYLE>
<script LANGUAGE='VBScript'>
'-> Resize And Place In Approx Center Of Screen
Dim Wth, Hht :Wth = int(475) :Hht = int(255)
window.ResizeTo Wth, Hht
MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))
Dim Tm1
'-> Function To Process The Submit Button
Function MySubmit()
If Len(In1.value) = 0 And Len(In2.value) = 0 And Len(In3.value) = 0 Then
alert("No Textboxes Have Any Information")
ElseIf Len(In1.value) >= 1 And Len(In2.value) = 0 And Len(In3.value) = 0 Then
alert("Only TextBox 1 Information : " & In1.value & vbCrlf & _
"Please Fill In Textboxes 2 And 3 Then Press Submit")
ElseIf Len(In1.value) >= 1 And Len(In2.value) >= 1 And Len(In3.value) = 0 Then
alert("TextBox 1 Information : " & In1.value & vbCrlf & _
"TextBox 2 Information : " & In2.value & vbCrlf & _
"Please Fill In Textboxes 3 Then Press Submit")
ElseIf Len(In1.value) >= 1 And Len(In2.value) >= 1 And Len(In3.value) >= 1 Then
If Len(In2.value) = 5 Then
Menu.style.visibility = ""
In1a.value=In1.value
In2a.value=In2.value
In3a.value=In3.value
Else
alert("Error Needs The Last Five Digits From Invoice Number : " & In2.value)
End If
End If
End Function
'-> Process Varibles And Display Message
Function ProcessInfo()
Tx1.style.visibility = ""
Tx1.innerHTML="Processing, " & In1.value & ", " & _
In2.value & ", " & In3.value
Tm1 = window.setTimeout("Part1Finish()",5000,"VBScript")
End Function
'-> Part 1 Finished
Function Part1Finish()
window.clearTimeout(Tm1)
Part2Finish()
End Function
'-> Process Ant End Request
Function Part2Finish()
Tx1.style.color="#3377AD"
Tx1.innerHTML = "Process Completed, Preparing To Close"
Tm1=window.setTimeout("Finished()",3000,"VBScript")
End Function
'-> Clear Timer Close Hta
Function Finished()
window.clearTimeout(Tm1)
window.close()
End Function
</SCRIPT>
<BODY>
<!-- Customer Name Area -->
<TABLE><TD Style='width:101;'>Customer Name</TD><TD>
<INPUT Type='TextBox' ID='In1' Class='Tbx' Size='40' MAXLENGTH='128'>
<TD></TABLE>
<!-- Two Textboxes Start -->
<TABLE>
<!-- Invoice Number Area -->
<TD Style='width:100;'>Invoice Number</TD>
<TD><INPUT Type='TextBox' ID='In2' Class='Tbx' Size='5' MAXLENGTH='5'
Style='Margin-Right:15;' Title="Use Only The Last Five Digits
Of The Invoice Number"></TD>
<!-- Type Of Job Area -->
<TD Style='width:89;'>Type Of Job</TD>
<TD><INPUT Type='TextBox' ID='In3' Class='Tbx' Size='13' MAXLENGTH='16'><TD>
</TABLE>
<!-- Buttons Start -->
<BUTTON ID='Bn1' OnClick='MySubmit()'>Submit</BUTTON>
<BUTTON ID='Bn2' OnClick='window.close()'>Close</BUTTON>
<!-- Text Display For Script Messages -->
<DIV ID='Tx1' Style="visibility:hidden;Width:100%;Text-Align:Center;">
</DIV>
<!-- Pop Up Dialog -->
<DIV ID='Menu' Style="visibility:hidden;Position:Absolute;
Top:9;Left:9;Width:425;Height:195;Text-Align:Left;Padding:3pt;
Border-Left: 1px Solid; Border-Right: 2px Solid;
Border-Top: 1px Solid; Border-Bottom: 2px Solid;
filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#EFEAE4',EndColorStr='#9E9E9E'); ">
<!-- Textboxes Customer Name To Edit -->
<TABLE><TD Style='width:101;'>Customer Name</TD><TD>
<INPUT Type='TextBox' ID='In1a' Class='Tbx' Size='40' MAXLENGTH='128'>
</TD></TABLE>
<!-- Textboxes Invoice Number To Edit -->
<TABLE><TD Style='width:101;'>Invoice Number</TD><TD>
<INPUT Type='TextBox' ID='In2a' Class='Tbx' Size='5' MAXLENGTH='128'>
</TD></TABLE>
<!-- Textboxes Type Of Job To Edit -->
<TABLE><TD Style='width:101;'>Type Of Job</TD><TD>
<INPUT Type='TextBox' ID='In3a' Class='Tbx' Size='13' MAXLENGTH='16'>
</TD></TABLE>
<!-- Text Option For Dialog -->
<TABLE Style='Width:100%;'><TD Style='Text-Align:Left;Padding:3;'>
 » Please Check To Make Sure All Information Is Correct,
If Not You Can Edit Out The Wrong Information With The Correct Information.
Press Either The Continue Button Or Use The Cancel To Close This App.
</TD></TABLE>
<!-- Button To Control Dialog -->
<TABLE Style='Width:100%;'><TD Style='Text-Align:Center;'>
<BUTTON OnClick="In1.value='' :In2.value='' :In3.value='' :A=1
In1.value=In1a.value :In2.value=In2a.value :In3.value=In3a.value
Menu.style.visibility = 'hidden' :ProcessInfo()">Continue</BUTTON>
<BUTTON OnClick='window.close()'>Cancel</BUTTON>
</TD></TABLE>
</DIV>
</BODY>



GunSmokingMan



#22
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
I've added a couple more conditions to the function to ensure none of the fields are empty and cause an error. Is this the best way to accomplish it?

If Len(In1.value) > 0 Then
		If Len(In3.value) > 0 Then
			If Len(In2.value) = 5 Then
				Dim A :A=MsgBox("Is this correct?" & vbCrlf & _
				"TextBox 1 Information : " & In1.value & vbCrlf & _
				"TextBox 2 Information : " & In2.value & vbCrlf & _
				"TextBox 3 Information : " & In3.value & vbCrlf & vbCrlf & _
				"Click OK to continue," & vbCrlf & "No to start over, or" & vbCrlf & _
				"Cancel to exit",4131)
				If A = 6 Then 
				alert("Script Place Holder For Yes Actions")
				ElseIf A = 7 Then
				In1.value="" :In2.value="" :In3.value="" :
				ElseIf A = 2 Then
				window.close()
				End If
			Else
			alert("Error: Please enter the last 5 digits of invoice number: " & In2.value)
			End If
		Else
		alert("Error: Please enter a job type (ie.: BC, Brochure, Flyer, etc.):")
		End If
	Else
	alert("Error: Please enter a client name:")
	End If


#23
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag

I made some changes to the HTA


Nice improvement!

#24
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
What I use to make sure none of the textboxes have value, plus an additional check on
the Invoice Number, for a length of 5 digits.
ElseIf Len(In1.value) >= 1 And Len(In2.value) >= 1 And Len(In3.value) >= 1 Then   
If Len(In2.value) = 5 Then

Nice try at coding, but you can use And or Or in If statements

Have you tried the updated HTA


GunSmokingMan



#25
13ruce

13ruce

    Newbie

  • Member
  • 19 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Thanks for the tip. Yes, I did try your updated HTA. That's what I meant by "Nice improvement!"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN