Save as window

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Rory
Pro Scripter
Posts: 50
Joined: Thu Mar 23, 2006 2:50 pm
Location: Wisconsin

Save as window

Post by Rory » Thu Mar 23, 2006 3:13 pm

Is it possible to access the "Save as" window through MS scheduler and have it appear?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Mar 23, 2006 3:43 pm

Which Save As window? On another application? You want to automate another application to invoke the Save As window? Yes, if that's what you want to do it is possible.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Rory
Pro Scripter
Posts: 50
Joined: Thu Mar 23, 2006 2:50 pm
Location: Wisconsin

Post by Rory » Thu Mar 23, 2006 4:11 pm

I am using Macro Scheduler with a dialog to create a CNC programs for our machine tools. I am using the WriteLn> function to create each line and then executing the file to open it in notepad.
What I woud like to do is to give the user to option to save as a different part number without writing over the top of the one that already exists.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Mar 23, 2006 4:22 pm

To invoke the Save As box in Notepad just do:

SetFocus>Notepad*
Press ALT
Send>fa
Release ALT
WaitWindowOpen>Save As

Have you read the "Scripting Windows for Beginners" guide in the help file which takes you through a Notepad example?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Rory
Pro Scripter
Posts: 50
Joined: Thu Mar 23, 2006 2:50 pm
Location: Wisconsin

Post by Rory » Thu Mar 23, 2006 4:41 pm

Maybe I am going about this in the wrong order. What I am trying to do is to create the file before opening it in notepad. I have it checking to see if the file exists and if it does, this is where I would like to give the option of replacing or save as new it before it just gets replaced. Also if I could get the Save as dialog window to open before creating the file it would allow the user to place the file in another directory.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Mar 23, 2006 4:50 pm

You want to open Notepad's Save As window before opening Notepad !? Wow, I'd like to see that. You got a magic wand?

Erm, I think what you might really be saying is you want a way to prompt the user IF the file already exists, and ask the user whether to overwrite or provide a new file name ... before doing anything else. Am I right? If so, something like:


IfFileExists>filename
Ask>File Exists, Shall I Overwrite?,answer
If>answer=NO
Input>filename,Enter New Filename
Endif
Endif


That uses a simple YES/NO box and then IF the user says NO to the overwrite prompt it uses an Input box to request the new filename.

Alternatively you could use the dialog designer to build your own custom dialog which can be made to look the way you want.

Does this help?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Rory
Pro Scripter
Posts: 50
Joined: Thu Mar 23, 2006 2:50 pm
Location: Wisconsin

Post by Rory » Thu Mar 23, 2006 4:57 pm

Yes it does help.

Thank you very much

Rory
Pro Scripter
Posts: 50
Joined: Thu Mar 23, 2006 2:50 pm
Location: Wisconsin

Post by Rory » Thu Mar 23, 2006 6:41 pm

Looking through the help menu, I see under the dialog description "FileBrowse" and "MainMenu" yet these do not appear on the dialog designer. I think this may be what I am looking for. How do I access and activate them?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Mar 23, 2006 6:46 pm

They're not in the designer because there is no way to graphically create them. But there are examples in the help file and here on the forum. You add them to the code in the Dialog block. Here's a simple example:

Dialog>Dialog1
Caption=Dialog1
Width=445
Height=250
Top=211
Left=103
Button=Browse,152,48,75,25,0
Edit=FileEdit,112,80,121,msEdit1
FileBrowse=Browse,FileEdit
MainMenu=File,Open(10),Save(20),Exit(30)
MainMenu=Edit,Copy(40),Cut(50),Paste(60)
MainMenu=Help,About(70)
EndDialog>Dialog1

Show>Dialog1,r
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts